Cant get my stepper motor to move

Hi everyone,

A while ago I got a stepper bipolar stepper motor (4 wire) - I also got a cheaper version of the A4988 Driver.

I have tried to connect it up and and I am unable to make the stepper move at all.

I am trying to use this code

//Connecting the A4988
//Connect RESET and SLEEP together
//VDD to either 3.3V or 5V
//GND to Arduino GND
//Connect 1A and 1B to stepper coil 1
//Connect 2A and 2B to stepper coil 2
//Connect VMOT to power source (9v battery + term)
//Connect GND to power source (9v battery - term)

const int stp = 13; //connect pin 13 to STEP
const int dir = 12; //connect pin 12 to direction
int a = 0; // counter

void setup()
{
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
}

void loop()
{
  if (a<200) // sweep 200 step in dir 1
  {
    a++;
    digitalWrite(stp, HIGH);
    delay(10);
    digitalWrite(stp, LOW);
    delay(10);
  }
  else
  {
    digitalWrite(dir, HIGH);
    a++;
    digitalWrite(stp, HIGH);
    delay(10);
    digitalWrite(stp, LOW);
    delay(10);

    if(a > 400) // sweep in dir 2
    {
      a=0;
      digitalWrite(dir, LOW);
    }
  }
}

As far as connection go - I am just trying with a 9v battery connect + to Vmot, - to GND, the motor to 1a 1b, 2a 2b making sure to get the phases right (i tested for continuity) Then GND from arduino Uno to the GND of driver, and 5V from arduino to Vdd

Ive connected RESET and SLEEP together.

Ive connected STEP to pin 13
and direction to pin 12

When I run the code, i begin to feel the heat sink heat up - so there is definitely current.

I have tried adjusting the trim pot - although I’m not 100% sure how to get the current i want - the trim just keeps turning in either direction forever.

I tried to use the trim pot as Vref and test from battery - side to the trim pot + at 9V, I’m getting a reading of like 0.01 A at best…no matter how i turn the trim pot

I may be doing this wrong, but I’m not sure how I’m supposed to get it right

Any help would be appreciated, just really want to make it spin, haha

Thanks in advance

MrDropsy

9V batteries are totally unsuitable for powering motors. You need a power supply capable of providing a couple of amperes. Even then, it is possible that the A4988 is not capable of providing enough current for your particular motor.

Post a link to the datasheet for your motor.
Have a look at stepper motor basics.

...R

Best to use 12V, 24V or more for chopper drivers, you need enough current
(small 9V batteries cannot provide high current, they are designed for radios and
other light loads)

Very well, ill try to use a power supply.

Ive attached the stepper motor sheet.

Perhaps someone could advise me of how to adjust the current limit - i don’t seem to be doing that correctly.

Nema17StepperMotor.pdf (23 KB)

I am still unable to make it turn even with power supply - set to 9V

now using

// 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 ----> change to millis in the future

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 100;
byte ledPin = 13;
int pulseWidthMicros = 20;  // microseconds
int millisbetweenSteps = 25; // milliseconds


void setup() { 

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

  delay(2000);

  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);

    delay(millisbetweenSteps);

    digitalWrite(ledPin, !digitalRead(ledPin));
  }

  delay(3000);


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

    delay(millisbetweenSteps);

    digitalWrite(ledPin, !digitalRead(ledPin));
  }
}

void loop() { 
}

It seems like no current is being drawn.

I suggest to carefully follow the ALL the directions (including wiring and current limit) on the product page for the Pololu A4988 driver. The power supply must be capable of supplying at least 2 amperes of current and preferably more.

Hey, guys, turns out i actually blew one of the a4988 drivers. I tried measuring the current but i think i shorted because i didn't connect meter in series.

I tried my spare a4988 and it worked - thanks all!

You must not connect/disconnect the motor while the driver is powered up, and
you must never try to operate it with a load that isn't inductive. Both will likely
destroy the driver.

The current setting can be measured by knowing the value of the shunt resistor
and measuring the voltage on the REF pin.

Iout = Vref / (Rshunt * 8)

The little adjustment pot alters Vref.