2

So, I have been following this tutorial on how to run a stepper motor with Arduino using an A4988 Stepper Driver. This is the tutorial: How To Control a Stepper Motor with A4988 Driver and Arduino. I have connected the wires according to this schematic:

Schematic

I have connected the wires exactly like this and triple-checked it! The problem is the stepper motor is not turning. This is the code(it's simple):

// defines pins numbers
const int stepPin = 3; 
const int dirPin = 4; 

void setup() {
  // Sets the two pins as Outputs
  pinMode(stepPin,OUTPUT); 
  pinMode(dirPin,OUTPUT);
}

void loop() {
  digitalWrithe(dirPin,HIGH); // Enables the motor to move in a particular direction
  // Makes 200 pulses for making one full cycle rotation
  for(int x = 0; x < 200; x++) {
    digitalWrite(stepPin,HIGH); 
    delayMicroseconds(500); 
    digitalWrite(stepPin,LOW); 
    delayMicroseconds(500); 
  }
  delay(500); // One second delay
}

One weird thing:

When I connect the sleep and reset pin on the A4988 board the stepper motor starts turning. Like why?

NOTE: I replaced the MEGA with a UNO because at the moment I'm just testing.

Gaurav Mall
  • 124
  • 8
  • Have you tried pulling Sleep and Reset to HIGH, like shown on page 1 and 7 of the [A4988 datasheet](https://www.pololu.com/file/0J450/A4988.pdf)? – chrisl Apr 11 '20 at 11:55
  • I have NOT. Because I didn't see it. Wait I'll try it out. Thanks! – Gaurav Mall Apr 11 '20 at 11:57
  • I have the same problem. My motor is vibrating but not realy moveing. Can you help me? – PurpleOwl Apr 01 '21 at 23:44
  • @PurpleOwl See the answer below, that's what I tried and it worked for me. You essentially need to connect the sleep and reset pin together. If they still don't work, see the debugging options below. – Gaurav Mall Apr 03 '21 at 07:19

1 Answers1

3

You have to connect the sleep and reset pin together. I assume that you took this schema on how to mechatronics. In his video you see that the sleep and reset pins are connected. I don't know why but it has to be like that.

Then, if the motor vibrates or click, it may be one of these problems:

  • You didn't connect the motor properly
  • The current is set too low on the board (screw on the motor driver)
  • The battery (Vmot) isn't powerful enough

If it's not one of those problems, the A4988 chip might have an issue. I have a similar problem where it turn in one direction and only when the pwm signal goes throught the direction pin instead of the step pin.

user
  • 46
  • 2
  • Thanks! The question is from about two years ago. So, I figured it out myself then. But appreciate your effort and am accepting it as an answer. Thanks again :) – Gaurav Mall Dec 17 '20 at 18:21