A4983 and A4988 Getting Started Guide

One of the biggest things that frustrates me about forums and the internet is that a lot of good information is distributed. It takes a lot of time for each person to consolidate it as opposed to a knowledgeable person consolidating the information for everyone.

I felt like the A4983 and A4988 documentation is slightly lacking and I am trying to supplement it.

I am sure what I have created has issues and please point them out. I will fix them.

UPDATE - I have created a board to make the learning process even easier. See here:

PololuPres_V3.pdf (738 KB)
PoluluPres.pdf (734 KB)
StepperTester.pdf (17 KB)

Thanks - that was a huge help!

decrDude,

Thank you. I have fought my way through this before, and your summary is well done.

One question - On the last page, you show MS1 pulled up to 12 Volts. Shouldn’t that be pulled up to the logic voltage? (either 5 volts or 3.3 volts, depending on your controller)

Al

You are correct! I have fixed it.

Ah nice job! Handy to have. :slight_smile:

Hi!

Thanks for the tutorial. I need to verify something:

Did I set the current correctly? Let’s check it:

  1. Stepper#1 = using it in Bipolar mode, Voltage rating 4V, Current rating: 1200mA
  2. Stepper#2 = using it in Bipolar mode, Voltage rating 3.8V, Current rating: 670mA

I’m using a 12V DC power supply (80 W) for: 2Stepper#1 and 1Stepper#2 => VMOT is at 12V DC for each stepper.

According to the tutorial, the current should be limited during the calibrating stage to 70% of the nominal value (per coil) of the stepper.

So, I have: 469mA for Stepper#2 and 840mA for Stepper#1. I did calibrate those. Next phase was to test the steppers. I’ve picked the small one (Stepper#2) and done the connections as seen in the picture (attachement), on a breadboard.


I’ve used JAL to write the code you’ve provided for the testing:

include 16f877_20
include jpic
include jdelay

var bit DIR is pin_b1 -- alias
pin_b1_direction = output

var bit STEP is pin_b4 -- alias
pin_b4_direction = output

var bit _EN is pin_b7 -- alias
pin_b7_direction = output

_EN = high -- driver->coil outputs are disabled

procedure clockwise is
DIR = low
STEP = low
delay_2us -- delay time
STEP = high
delay_2us -- delay time
end procedure

_EN = low -- activating the driver's outputs
delay_2us -- delay time

for 10001 loop -- 10001 cycles loop
clockwise
end loop

As you see, this sample contains only the code needed for the clockwise rotation, since that is my freaking problem right now :imp:.

Those being said, I’ve programed the μctrl and done the connections. I’ve checked them for 8 time already, they are properly done since the stepper rotates counterclockwise (with DIR = high), but it does not rotate clockwise (with DIR = low). :open_mouth:

Any suggestions?


I’ve handled the driver and the motor properly → respected the warnings on the webpage and datasheet.

I’ve checked the connectivity of the pins soldered to the PCB driver. All of them are fine.

For safety, I’ll try to test the big stepper too … maybe something happened and the driver is malfunctioning. (I’m going to use the driver specially configured for that motor).

Be back with intel after the swap and test! Cheers!

:laughing: :laughing: :laughing: I’ve found the problem with the spinning direction: I’ve been looking at it top view (above the shaft). Now I’ve checked it bottom view and it is accordingly to the datasheet … noob :laughing: :laughing: :laughing:

The other problem with the spinning was induced due to the fact that I’ve wrapped something around the shaft and it vibrated and went contrariwise … noob, again :laughing: :laughing: :laughing:

Those being said, I am waiting now only for the confirmation regarding the current value set during the calibration stage.

Back in business … testing the LCD, keyboard and then the positioning sensors … and then assembling the whole project and tests again … until fine tunning.

The hardest part was to get accustomed with the steppers and their drivers … first time using them.

Thanks and take care! :smiley:

Hello.

Those currents look okay to me.

- Jan

Hi!

Thanks, Jan for the help! :wink:

I need to confirm something: Since then minimum Ton = Toff = 1us, then the driver should rotate the shaft (rotor) with 1 revolution for every 400us, right? That should be the maximum speed, at least theoretical.

I want to obtain 100 revolutions per second. Is the motor capable of this speed? - I mean both of them. If not, what is the maximum speed obtained for them, if tested by you. Please provide intel about the signal applied on STEP input.

Thanks and take care! :slight_smile:

Hello.

Yes, the Ton/Toff requirements mean that you can theoretically supply a 500 kHz signal on the step line and expect the driver’s outputs to respond appropriately, but this is a case where theoretical maximum speed is so far from reality that it doesn’t really even make sense to consider it a theoretical speed. You will not get these stepper motors to turn at 150,000 RPM! Coil inductance and rotor inertia limit the stepper motor’s ability to respond to the rotating magnetic field; if you step the field too quickly, the rotor won’t step (it might do weird things like vibrate in place, rotate in reverse, or seemingly move in a random sequeunce).

The maximum step rate of your stepper motors will depend on things like your supply voltage, the current limit you have set, and the load on your motor. Also, achieving the highest step rates generally requires you to accelerate the motor by gradually increasing frequency of the signal on the step pin. If you want a ballpark figure for maximum achievable step rates, you should look at the pull-out torque graphs on the stepper motor product pages. Given the highest pps (pulses per second) datapoints on these graphs, I’d say you shouldn’t expect more than 10 or 20 revolutions per second. You will not get 100 RPS. I suggest you try it for yourself, starting with low speeds and gradually ramping the speed up until the stepper motor stops rotating.

The signal on the step pin is pretty simple. Just drive the pin high for at least a microsecond every time you want the stepper motor to advance by one step, and make sure to drive it low for at least one microsecond before you drive it high again. For example, if you want to make the stepper motor turn at 60 RPM (1 revolution per second), you could put the driver in full-step mode and alternate between driving the step pin high for 2.5 ms and low for 2.5 ms. This will cause it to take one step every 5 ms, or 200 steps every 200*5ms=1s. The simplest input you can provide the step pin is probably a 50% duty cycle PWM, and the PWM frequency will control the step rate.

- Ben

Thanks for the explanation! I’ll try it and see what is happening. Take care!

Hi,

I have problems calibrating and using my A4983 driver. When I connect my 12V DC supply to the driver I smell within 10 seconds solder and see some smoke (melting solder?) from the driver. I’m not a pro but I can tell that it isn’t good. I followed (I hope) the starter guide posted in the first post. I can not see any unwanted solder bridges.
I made following connections (for calibration/current limiting):

  • grounded STEP, DIR, MS1, MS2, MS3, and ENABLE
  • grounded GND logic supply
  • connected SLEEP to RESET
  • VDD logic supply to the 5V pin of my arduino
  • connected 5V to VDD for selecting 5V logic
  • 1A, 1B and 2A connectd to a stepper motor (pololu #1200) to red, blue and black wire respectively.
  • 2B is also connected to the stepper motor (with wire green) but got my multimeter between it to measure the current. It measured 0,00mA.

I measured all pins and they are grounded or are high (sleep and reset are high). The used power supply is 12,2 V.
I don’t know what I have to do now, hopefully someone can tell me what is wrong. What can I measure to know if it is still alive? I’m afraid of trying it again cause I may damage the driver even more (if it is still alive).
Thanks

UPDATE
I feel like a fool but apparently I switched the polarity of the power supply. I thought it was correct so I never checked it. The motor works fine now!
Sorry for the useless post.
I could hear the local radio station coming out of the motor when I touched the current limit pot on the driver with the screwdriver. Strange.

Looks like someone else had that same experience:

1 Like

Hi

I have tried to calibrate the Pololu A4983 driver when hooked onto a Pololu #1206 Bipolar stepper as per instructions in the first post.

During calibration i get 0 Amps current, through coil number 2.(coil with green and black wires)
Even though i couldn’t calibrate the pot setting on A4983, i ran the motor using the Arduino code and A4983.
I get the desired rpm but the stepper heats up in 5 mins for no load condition.
I am able to repeat this 5 min test any number of times, but i am nervous about the heating problem.

Moreover if i measure a volt drop across coil 2, during calibration, i observe a 7V reading.
The vmot pin on the A4983 has been set to 8V.
Any guesses as to what i am doing wrong during calibration?

Thanks
Sam

Hi,

I have another question. I have a Pololu #1206 bipolar stepper and a A4983 driver. What should I change in the Arduino code to get 1 RPM as the speed for my stepper? Also, What is the lowest and highest RPM that is possible.

Thanks in advance,
aerosam

It looks like you might be doing all kinds of things wrong. Regarding the current, if your motor is moving and things are getting hot, you are obviously using some current; if you are not seeing it in your measurement, there is something wrong with the measurement. Whether or not there is a mechanical load should not affect your stepper motor much; if it’s getting too hot, you might need to lower the current. Another problem is that 8V is right at the lower limit of the range, why are you setting it there?

For your speed questions, it seems like you really are not understanding the very basics, so you should read up on stepper motors more. For the low end, you are asking the motor to make little steps that are portions of a full revolution, and you can wait as long as you want between steps to get arbitrarily low RPMs. For the upper end, it depends on things like your voltage and load, but you should be able to get several hundred RPM (several rotations per second).

- Jan

Hello.

I just want to point out that various components will generally heat up in applications like this, and that is not necessarily a bad sign. For example, the stepper motor driver IC can operate comfortably at temperatures that would burn you. You need to determine if your components are merely heating up (expected) or overheating (bad). You can help protect your stepper motor by setting the current limit of the motor driver to a value at or below your stepper motor’s rated current. The A4983 driver has built-in thermal shutdown that protects it from being damaged by overheating. If it starts cutting out after your motor has been running for a little while, it is probably overheating and you should take steps to keep it cooler (e.g. lower the current limit, add a heat sink, or improve air flow).

Also, because the stepper motor driver actively limits current, measuring coil output voltages with a multimeter while the stepper motor is connected is not likely to give you a meaningful result. Instead, try measuring the voltages with the stepper motor disconnected, or you can look at the coil voltage with an oscilloscope. (Note: do not connect or disconnect the motor while the driver is powered, as doing so could permanently damage the driver!)

- Ben

Hi Jan

The calibration problem seems to be solved. I changed my multimeter and the A4983 driver, set VMOT to 12V.
Now the motor doesn’t heat up and life seems good.
I am still having problems with getting a desired rpm.
I believe that the motor steps when it transitions from low to high. MS1/2/3 are all grounded to ensure that the motor takes full steps
1rev=200steps.
I want 200steps in 60 secs (i.e rpm=1)
Could you please tell me what i am doing wrong,in the code

void setup()
{
  pinMode(enablePin,OUTPUT);
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);
  
  //For some strange reason enable pin,should be low for the  motor to start!!
  digitalWrite(enablePin,LOW);
  digitalWrite(dirPin, HIGH);
  
}

void loop()
{
  //Hypothesis--Motor steps when stepPin transitions from LOW to HIGH
  //MS1,MS2,MS3 all held at LOW.
  //MS1 grounded through a 100kOhm resistor?--Is this necessary?
  //Motor should rotate at 1/60 rps
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(2);//Hold at high for 2 microsecs
    digitalWrite(stepPin,LOW);
    delayMicroseconds(300000-2);
  
  
  
  //Nothing happens if maintained at high
  //digitalWrite(stepPin,HIGH);
  
  //Nothing  happens if maintained at low
  //digitalWrite(stepPin,LOW);
  
}

Your problem is this line:

delayMicroseconds(300000-2);

That function takes an unsigned integer as an argument, which means the argument must be less than 65536. The compiler is just converting your argument of 299998 into an unsigned integer by disregarding all by the two low bytes, which means it is only delaying for 37854 us. Are you seeing a step rate of approximately 8 RPM?

Instead, try using the line:

delay(300);

- Ben

Thanks Ben

Will try the code change and let you know.
Currently it seems to go a lot faster than 8rpm.

Sam