Go Down

Topic: Due A4988 4wire stepper (Read 302 times) previous topic - next topic


Sorry if I'm not using this forum correctly but I've tried looking for my answer.  Here's the question.  I have a Due and some A4988 driver boards to run a old small 4 wire stepper motor. Thinking it's a bipolar.  Anyway, I've tried every library I could upload and use their programs to run this stepper. Nothing. I can make the motor tic 1 step hooking the individual coils to power by hand so I know this motor should work, but every program uploads and shows it uploaded correctly but it's not even letting power get to the motor from my external p/s. Do I need to change pins from what most programs show ie-8 step 9-direction to another pins since I have Due and not Uno? Maybe I just have 5 bad A4988 boards. Just getting pissed it's not working after 20+ hrs messing with it.  SUGGESTIONS???  Thanks for the help


Mar 25, 2019, 05:13 am Last Edit: Mar 25, 2019, 05:31 am by JCA79B
Do you have a meter to read the resistance of the motor wires? What color are they? Are there any part #s and brand name on the motor? What kind of power supply, voltage and current, are you using? How big is the motor, 2 inches square, 3?
EDIT: Hopefully you did not switch wires while the driver(s) were powered, that will kill them instantly.
The most intelligent people in the world are the ones who don't think of themselves as the most intelligent person in the world.


Mar 25, 2019, 08:21 am Last Edit: Mar 25, 2019, 08:22 am by ard_newbie
You should have a wiring close to this (from Pololu web site https://www.pololu.com/product/1182):

To test whether your stepper motor is broken or not, you don't need a library, simply code a serie of
digiatlWrite(pinstepper, High); delay(XX); digitalWtite(pinstepper, Low); delay(XX); in loop() and  connect the Direction pin to Gnd.


I know which wires go to which coil. That's not the issue.  The issue is getting the sketches to run the motor. I have had every possible combination of your diagram wired up.  Ran the enable high then low.  Nothing. Jumped the reset to the sleep and still nothing.  I've tried all 5 drivers and no good. The stepper is a very old small 3.5v unit. I'm thinking I have an old or incapable library in my sketch.  I found this library that I'm going to try
// testing a stepper motor with a Pololu A4988 driver board or equivalent

// on an Uno the onboard led will flash with each step

// this version uses delay() to manage timing

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 250; // milliseconds - or try 1000 for slower steps

void setup() { 

  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros); // this line is probably unnecessary

    digitalWrite(stepPin, LOW);
    digitalWrite(ledPin, !digitalRead(ledPin));

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    // delayMicroseconds(pulseWidthMicros); // probably not needed

    digitalWrite(stepPin, LOW);
    digitalWrite(ledPin, !digitalRead(ledPin));

void loop() { 


Mar 26, 2019, 12:36 pm Last Edit: Mar 26, 2019, 12:41 pm by JCA79B
Hmmm, that program looks kinda familiar, does it work? Did you measure the coil resistance from wire to wire?
The most intelligent people in the world are the ones who don't think of themselves as the most intelligent person in the world.


I will do a thorough description tomorrow. But can you tell me definitively that pin 8 one the Due is the same as pin 8 on a Uno? I'm thinking the issue is b/c I have a Due and most of these sketches are written for Uno.  Is that silly?  Convince me that they are the same.


The pin numbers used in digitalWrite() and digitalRead() are always the numbers printed on the Arduino board. Pin 8 is always the one labelled "8".

There are some different capabilities. All pins on the DUE can do PWM but not all on the UNO.
"The problem is in the code you didn't post."


First thing to do in troubleshooting is reduce the variables and proceed in small steps.

Use the A4988 without connecting the Due (other than for 5V), connecting a pull-up and push button
to the step pin, so you can test the A4988 in isolation.

Get that working first.  Once that's working you know the driver and motor is working.

If you have a known good stepper motor, use that first, then move to the problem motor,
so you can tell if its driver or motor.

Note its vital to set the current limit on the A4988 to roughly the right value for each motor,
too much current may burn out the driver (from experience on the Pololu DRV8825 modules
its perfectly possible to select self-destruct levels of current!).

Secondly make sure the Due pins are working by driving an LED (with 1k series resistor)
from the pins you are going to use.

Then connecting the Due and A4988 together is pretty much guaranteed to work, as you've
proved each separately.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Mar 27, 2019, 05:28 pm Last Edit: Mar 27, 2019, 05:39 pm by flyn50
Mark T, wonderful response and thats obvious, of which i didnt think of.. i will try that.. i did a lot of research last night in forums here and discovered some talk about the Arduino IDE software that if you use a Due you need to set the software up to know you have a Due and install the Due Sam boards (32bits ARM-cortex-M3) using the boards manager.. im at work now and not checked at home if i had done that b/c im getting old and cant remember.. lol. this may be the whole problem.. i will keep you informed.. if this is the case then Arduino needs to make this more known to do this as i only ran across this after at least a month of research into the problem
i just looked at my unused IDE here at work and i see that just enables the program to allow a Due to be found. which i know i have it found at home, so i guess i did this step alread b/c i know it shows up in my devices.. so.......


Ok I numbered my untouched new A4988 driver. I didn't wire it to my Due but I tried to step it manually by touching the step jumper to the + 5v p/s. Nothing lit up on the led I hooked to the outputs instead of a stepper. I tried jumping it to grd and still nothing.  See my pics attached here. I've jumped the reset and sleep together and nothing. Tried not jumped together and nothing. I repeated all this with the LED and then with stepper instead of LED. NOTHING!,  Can someone verify I've hooked all the necessary jumpers to the driver needed to check it?  As you can see I'm using same 5v for Vmot as the Vdd. I've even hooked the enable to +5v and then to grd and still nothing.  I attached pic of the drivers I bought. HELP


I've had trouble posting my images.  To big. 


Current controlling stepper drivers require the inductance of the motor windings to function at all,
replacing with LEDs could easily destroy the driver and LED as there is nothing to limit the current
without the winding inductance (or did you have a resistor too?).

Hook up exactly as per the circuit Pololu give, with a motor, having first adjusted the current
setting pot just as per their instructions.

Are the A4988 modules from a respectable source?
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


THEY ARE from BIQU, they seem like nice units.no i did not use a resistor as i figured the led would light for a sec and blow if it got too much current. but i got nothing. I dont see how the inductance of a motor could have an impact on the driver. but maybe so..


im a complete overlooking the obvious IDIOT sometimes.. after researching more, ive realized  i need more than 5V hooked to the Vmot to operate.. that may be one, if not the only prob.
will let you know when i get home tonight if this was the fix.
thanks for bearing with me yall


OMG.  that's all that was wrong.  needed more than the 5v i was using for Vmot on the driver. everything works now properly.  WOW. I i have either 3/5 bad or fried drivers tho.  least i have 2 good ones left. thank you everyone for the help. 

Go Up