A4983 and A4988 Getting Started Guide

Thanks Ben

That solved it.

Sam

decrDude,

Your guide is a lifesaver. One thing Iā€™d like to suggest for your guide, make sure on your diagram it says ā€œDigital Pin 2, Digital Pin 3, etcā€ Ive been fighting with this because i had it hooked up on analog and was attempting to run right from your code. Was actually getting movement, but couldnā€™t figure out whyā€¦sporadic behaviorā€¦etcā€¦Thanks to Ben and Ryan on this forum, everything works perfectly!

Great guide! It made it very easy to get my motor up and running.

Instead of measuring current in one of the legs of motor, I measured the total Vmot current and divided by 2. This was easier because my power supply has a built-in current meter. Anybody see a problem with that?

Hello.

We recommend measuring coil current because it is not accurate to measure the current total current drawn from your power supply if the stepper motor driver is actively limiting the current. This is because the inductance of the motor coil can keep current circulating through the coil even when no current is being drawn from the power supply. You can also get an accurate measure of the current limit by using a multimeter to measure the current limit reference voltage.

Also, even if the power supply current were an accurate representation of the coil current, you would need to divide by 1.4 to determine what you have the current limit set to (assuming you are in full-step mode), not 2. In full-step mode, both coils are always energized at approximately 70% of the current limit (specifically, sqrt(2)*current limit/2), which means:

current limit = coil current / 0.707

or

current limit = (coil current * 2) / 1.41

- Ben

I have a question about testing the coil current. Where is that done on the board exactly. I thought I was doing it right but my A4983 caught fire so I guess I didnā€™t :frowning: can someone tell me exactly where to connect my multimeter to measure the current at the coil with no motor attached. This is the stepper motor Iā€™m using pololu.com/catalog/product/1200. What should the reading on the multimeter be with that motor.

Thanks

Got it working with my other driver. Measured .420 amp at the coil. Wish I didnā€™t have to wait so long for a replacement :frowning:

I am sorry you had so much trouble. What was the issue you had when your driver caught fire? I would like to add it to my gotchas if I think it will be a common mistake.

I have updated the initial post and added an updated pdf to address some of the issues people have been having. Hope it helps!

hey guys, iā€™ve been on this pretty much all day (and i canā€™t really tell you what i wasted that much time on).
heres the problem: i tried to follow the guide and iā€™m pretty sure i did everything correct - apart from the DMM stuff.

the facts: i have one stepping motor (#1209) and an 4988. everything set up like described - the part about calibrating the 4988. the thing is, if i connect the motor without the DMM i get a noise from the motor. there definitely is current flowing.
if i connect the dmm on one of the coils (chip -> dmm -> coil ā€œinā€ -> coil ā€œoutā€ -> chip) and power everything on again i get a VERY silent noise. i can only hear it if iā€™m very near and everything else is silent. definitely not much going on there. additionally, the DMM keeps telling me that there are 0A.

i guess iā€™m doing something stupid and maybe even obvious with the DMM, but i donā€™t see the problem. maybe someone else can help me out with a tip or twoā€¦

edit:
by now iā€™ve tried using the test-program on the arduino and the motor actually moves. still, the DMM wonā€™t show any current. thats a bit weird because the motor clearly movesā€¦

Well in situations like you are having I usually will sanity check my tools.

Hook up your DMM to a circuit with a known current and see if you can use it under normal circumstances. Find some tutorial and follow it for measuring DC current.

You should definitely see some Amperage under the first setup. Perhaps your DMM is setup to show AC current?

The DMM wonā€™t work when the motor is running. At least not with the DC Current setting. Well at least mine wonā€™tā€¦
The AC Current setting shows a small amperage but it is probably nonsense data because we donā€™t really have an AC source.

Hope that helps.

Make sure you are not trying to step the motor while you are measuring the current. If you are stepping the motor, the average coil current will be zero, and a multimeter is not likely to measure that very well, especially if the step rate is high.

- Ben

Great threadā€¦thanks very much for posting. I have built this

The problem is I find that I have to slow down the speed of the stepper a lot (0.5 RPS) before it can reliably operate. I suspect I need to add some acceleration code into my movement code (below). I have the pan function geared 1:1 with the stepper. Even with 0.5rps it can be a bit dodgey. Iā€™d like to get in the 1 to 1.5rps range. Anyone have a simple acceleration algorithm they can share?

thanks,
Brendin

void moveStepper(uint8_t direction,int steps)
{
  //Serial.print("Move Stepper direction=");
  //Serial.print(direction);
  //Serial.print(" steps=");
  //Serial.println(steps);
int j;
// set the enablePin low so that we can now use our stepper driver.
digitalWrite(enablePin, LOW);
// wait a few microseconds for the enable to take effect
// (That isn't in the spec sheet I just added it for sanity.)
delayMicroseconds(2);
// we set the direction pin in an arbitrary direction.
digitalWrite(dirPin, direction);
for(j=0; j<=steps; j++) {
digitalWrite(stepPin, LOW);
delayMicroseconds(1250);
digitalWrite(stepPin, HIGH);
delayMicroseconds(1250);
}
//delay(1000);
}

Hello.

Before you worry about adding acceleration, I think you should focus on making sure you have an appropriate current limit set. It looks like you might have the current limit set pretty low right now, and you also seem to be measuring the power supply current rather than the coil current, which isnā€™t necessarily a good indication of the current through your stepper motor. What is the current rating for your stepper motor?

- Ben

Hi Ben,

Iā€™m sorry I forgot to post the details since that video. Yes I have set the coil current to 0.7 * rated (2.4A per coil) kysanelectronics.com/Product ā€¦ ordID=6875 . I set the current measuring it on coil 1 vs the way I was measuring in the video.

thanks,
Brendin

The driver IC can handle a maximum current of 2 A per coil, so you cannot set the current limit to allow full current for a 2.4 A stepper motor! Additionally, the IC will typically overheat for coil currents around 1 A and above if you are not taking extra steps to keep it cool, such as adding a heat sink. Have you added a heat sink to your driver? I think you need to decrease the current limit setting quite a bit and consider adding a heat sink.

- Ben

Yes I do have a heatsink on the driverā€¦it might be visible in the video. I should set my current limit to (0.7*2) then?

I think youā€™re unlikely to get the full 2 A, even with a heat sink, but you should play around with it and see at what point the thermal protection starts kicking in. You can just write a simple program that continually steps the motor and see if you get any glitches caused by thermal shutdown. I expect the upper limit to be somewhere between 1.5 and 1.8 A, depending on the effectiveness of your heat sink and other conditions like air flow and ambient temperature.

Keep in mind that if you restrict your driver usage to full-step mode, the stepper coils will only ever see 70% of your current limit. However, if you use any of the microstepping modes, some steps will result in 100% of the current limit through one coil, and if you happen to stop moving on one of these steps, that current could be flowing for a long time.

- Ben

my stepper requires a 24VDC supply so that is the adapter I have, I was wondering how you chose the 47 uF Capacitor for the 12V supply you used, and if you could recommend the capacitor size i would need for mine. Thanks.

Hi, cfinney.

For power capacitors, you want to use the highest capacitance (biggest capacitor) that is practically fits in your system. Your capacitor choice also needs to have a voltage rating well above the voltages it will be exposed to.

- Ryan

Hi Ryan,

I have 24VDC 1.25A adapter to power my stepper that I am using with the pololu board, and I was also hoping to use this to also power my Arduino that I am using as the controller for the system. I have a 24VDC (20-35V) to 9VDC power regulator and I think I am suppose to use 2 decoupling capacitors one on the Vin side and one on the 9V out side, is this correct? I know relatively little about circuits and have no idea what is practical and what is overkill/ not enough, could you be a little more specific in how to choose a capacitor for a system?

I saw someone use a 9VDC power supply with a 9V to 5V power regulator and they used a 0.1 uF capacitor on the 9V side and a 22uF capacitor on the output.

Thanks,
Finney