Stepper motor and A4988 driver

Hello everyone !

I have the project to build a moving target using a stepper motor controlled by Python. But first of all, I need to use a driver A4988 to make the connection between the stepper motor (Nema 17) and my Arduino Uno.

But I don't understand why it doesn't work.
Here is the site where I bought my driver : https://www.pololu.com/product/1182
I tried to follow the instruction but maybe I missed something.

#define STEP_PIN 5
#define DIR_PIN 4

void setup(){
  Serial.begin(115200);
  Serial.println("Test A4988");
  pinMode( STEP_PIN, OUTPUT );
  pinMode( DIR_PIN, OUTPUT );
  digitalWrite( DIR_PIN, LOW);
}

int stopper=0;
void loop(){
  if (stopper==0){
    for (int i=0; i<2000; i++){
      digitalWrite( STEP_PIN, HIGH );
      delayMicroseconds( 800 );
      digitalWrite( STEP_PIN, LOW );
      delayMicroseconds( 800 );
    }
    stopper=1;
  }
}

I attached my plan.
I hope someone was in my case and had resolved the problem.
Thanks.

There is no way that a 9V smoke alarm battery will power a stepper. You need a power supply that is rated for the voltage and current that the stepper requires. The A4988 driver requires a minimum of 8V. The stepper data sheet will have the coil current rating listed.

And you should really have the 100uf cap across the motor power input. Don't forget to set the coil current limit. See the Pololu page.

When you do get a proper power supply, I would suggest that you test the stepper at a much slower speed.

delayMicroseconds( 800 );

Asking the stepper to go from stopped to 625 steps per second, instantaneously, probably won't work. Try more like a couple hundred milliseconds delay to get started.

Stepper basics

Thanks for your answer.

I'm gonna try Wednesday and I will tell you if it worked.

I will use a low frequency generator to power the stepper, is it right ?
But there is something I don't understand : I have to power the A4988 with a different source ? So I have to use a second low frequency generator to power my A4988 ? Or can I use the same for the both at the same voltage and current ?

I will use a low frequency generator to power the stepper, is it right ?

No, you will use a DC power supply that outputs at least 8V (up to 35V) and enough current (Amps) to drive the stepper. The required current depends on the rated coil current of the stepper (again, check the stepper data sheet).

The A4988 gets two power supplies, one to power the stepper (8-35V ?? Amps) and a 5V logic supply (can be from the Arduino). This is all shown on the page that I linked and in the stepper basics thread that I linked.

There is no call for a "low frequency generator" in the stepper circuit, all power is DC. The step frequency is provided by the controlling Arduino.

I'm currently trying with a DC power supply at 12V but it still doesn't work. There is no current and I don't know why... and I think this is the main problem.

I have put the the 100uf cap across the motor power input but I wonder if it doesn't make too much resistance so the DC power supply don't debit.

I have refreshed my map.

Image from Reply #4 so we don't have to download it. See this Simple Image Guide

...R

Just make a simple pencil drawing with the connections clearly labeled and post a photo of the drawing. I can't read the pin labes in your Fritzing picture.

The Pololu A4988 web page has a clear wiring diagram and lots of other useful info.

Post a link to the datasheet for your stepper motor.

...R