a4988 stepper motor driver not working. Output pins not giving any voltage.

Hi, First of all, i wanted to tell everyone that i am a mechanical student so don't know much about electronics. :~ I started building one project for which i need to use Stepper motors. So i bought Nema 17 stepper motor, Arduino Mega and the stepper motor driver a4988. So i made the connections like this.... i connected my arduino mega to my laptop via USB cable provided with the board. Then i connected pin 13 of the board to the direction pin of the a4988, pin 12 to the step pin of a4988. Then i connected the reset pin and the sleep pin together, which is in the a4988. Then i connected +5V to the VDD and the respective ground. and then i connected VMOT to +12V and the respective ground. Then i connected my bipolar stepper motor, which has 4 wires to the ports 1a 1b 2a and 2b. Then i copied the program for one of the sites and uploaded that program to the arduino mega. It uploaded succesfully. But the motor was not moving.

I tried many-many different connections but was not able to rotate the shaft of the motor. So finally i started checking each component. I used one of the examples of the arduino, which i uploaded to it and it was working fine. Then i checked the Nema 17 motor by checking the resistance between the 2 wire which i got to be around 4ohms for both the coils. then i connected a 9v battery to one of the coils and tried turning the motor shaft but it was harder to move in comparison to when the battery was not connected. i did the same with the other coil. this proves that the coils are ok and the circuit is complete and the coils are producing magnetic field. this proves that the stepper motor is fine.

then i checked the a4988 stepper motor. i checked the voltage between the vdd and gnd, it was 5v. then between vmot and the gnd, it was 12v. then i checked the voltage difference between direction and step(just like that :P). after that the main problem came out. I checked the voltage between the 2 of the output pins and it was zero. then the other two output pins, which was again zero. i checked whether i was checking the voltage between the 2 wires of the same coil, and it was right.

Now i think that stepper motor driver a4988 is somewhat defective :cold_sweat:. It is not giving any output to the output pins which are connected to the motor.

Please help me with this problem. I tried many different programs that i found on the internet, but none of them are working. the only reason that i can think of is that the a4988 is defective. If you think it is defective then please reply fast so that i can return it back(i bought it from ebay.in).

Thanks in advance.

The following simple code will drive a motor with an A4988 stepper motor driver. It doesn’t use any library so it should be very easy to follow. You may need to adjust the pins to suit your application.

You don’t say what brand of A4988 driver you are using but I know the Pololu website has detailed wiring instructions for their board and I think Sparkfun also has.

Draw a clear diagram of how you actually have things connected and post a photo of it here.

Post a link to the specifications for your motor. Nema 17 only tells us the physical size of the front face.

// testing a stepper motor with a Pololu A4988 driver board
// on an Uno the onboard led will flash with each step
// as posted on Arduino Forum at http://forum.arduino.cc/index.php?topic=208905.0

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 50;
byte ledPin = 13;
int pulseWidthMicros = 50;  // microseconds
int millisbetweenSteps = 50; // 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);
    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);
    digitalWrite(stepPin, LOW);
    
    delay(millisbetweenSteps);
    
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
  
}

void loop() 
{ 

}

…R

First of all, I am using polulu stepper motor driver a4988 ( http://www.pololu.com/product/1182 )
secondly, the stepper motor that i am using is Nema 17 which is bipolar. ( https://ultimachine.com/content/kysan-1124090-nema-17-stepper-motor )
Lastly my connections are as follows:

I don’t see a ground between the mega and the stepper driver.

A drawing of the connections is much easier to follow than a series of photos. I would need to make a drawing from your photos before I could give advice, and guess what, I'm going to leave the drawing to you.

If you have followed the advice on the Pololu website I don't understand why your motor is not working. But without a drawing of what you have actually done I have nothing to compare with their website.

...R

@justone i gave power supply to the driver using an smps. so it has its own ground. the vcc of a4988 is connected to 5v power supply from the smps and the gnd is connected to the ground of the smps only. i have also connected the vmot to the +12v supply from the smps and connected the respective ground. if i am doing something wrong then please correct me

@Robin2 the connections that i made are the same as shown in the circuit diagram. but the thing is, i checked the voltage between 1a, 1b output ports of the a4988 and it had no fluctuations. the voltage was absolute zero. same was the case with 2a, 2b output ports.

Well i think that some or the other component of a4988 is not working. one more thing, do i have to connect enable pin, and there are 3 more pins namely ms1, ms2 and ms3. i don't know what do do with those pins. i connected them to the vcc so that i can have sixteenth step rotation. but it didn't work out.

i also connected the sleep and reset pins of a4988. as shown in the circuit diagram, but i am not sure if i have to do this or not.

My main concern is whether the driver board is fine or not. As i bought it from ebay.in i can return it within 7 days . so if you can tell me whether the driver board is working or not, that would be great.

i also used your program but it didn't work. anyway thanks for your help everyone.

Well let’s see if this will be of help.

@justone I have done the connections using that very diagram. And I am pretty sure that I did exactly the same. I even tried many different programs, but none of them worked. Again I am saying that I think the stepper driver is faulty. What is your opinion. I've tried everything, but nothing seems to work. Defective driver looks like the only problem.

There is no way to know from this distance whether it is definitely faulty. Returning it might be the simplest option. The absence of volts doesn't sound good, but I never measured mine and it's a very complex controller so it may not show up on a multimeter.

What current setting is the board set for? If that is too low it would explain why nothing happens. The Pololu website explains how to adjust it.

If you had another board you could try that (buy 2 next time?).

You say you bought it on Ebay - does that mean it's a clone rather than a "real" Pololu board. If so it's possible there are differences. The EasyDriver boards are different from the Pololu boards, for example.

Is it possible that you wired it up wrongly at some stage and may have damaged it?

Is there any possibility the motor is faulty?

...R

Well, it's true that I bought this front eBay.in and this doesn't look like a clone. Well from the starting only I did the right connection so that I don't destroy anything. So that's not an option. As I have described in my first post(refer to that post), that I have tested the motor, which seems to be Fine but I can't be 100% sure. I used a 9v battery to check it. And I will surely buy 2 next time. I changed the value of current but nothing happened. I checked the voltage by connecting the two wires of the multimeter to the outpjt pins while the motor was already connected.

I am only going by the picture you posted concerning the hookup of the ground.

I just tried connecting the gnd to the arduino, but it didn't work. I connected the vcc to the 5v and gnd to gnd of the arduino.

“~Sleep” is an input, as is “~Reset”, and both must be tied to Vcc otherwise - no cheese!

As per the manual: " The RESET input sets the translator to a predefined Home state (shown in figures 8 through 12), and turns off all of the FET outputs."

do i have to connect ms1, ms2 and ms3 to some pins or just leave them unconnected?
and what about the enable pin.
i want full steps, so that i can have more torque.

Follow the wiring diagram that was posted earlier. It is sufficient to connect sleep and reset to each other. There is no need to connect the MS pins.

I am rather worried by your statement

I just tried connecting the gnd to the arduino, but it didn't work.

.

If that was not already connected then your wiring cannot have matched the diagram even though you told us it did.

Do as I said earlier and draw a diagram of how everything is actually wired and post a picture of it.

Post a link to the location where you bought the device.

Have you tried the simple code I posted earlier?

...R

here is the full connection that i have done.
please correct me if i am doing something wrong. i have tried everything that was posted here, please correct me if you think that i didn’t do exactly as told.

You are not showing any connection to the Arduino ground. Where is the +5v coming from?

Apart from that the connections seem to be correct.

...R

i really didn't connect the arduino gnd. the +5v power supply is from a smps that i bought. its the same smps which is giving +12v to the vmot for the motor. i tried connecting the vcc and gnd of a4988 to arduino board but it didn't workout.

NOTHING CAN BE EXPECTED TO WORK IF THERE IS NO COMMON GROUND WITH THE ARDUINO.

You were told to connect the ground several posts back.

The diagram you CLAIMED to have followed clearly shows that the Arduino ground is connected.

This is just wasting everyone's time, yours included.

...R

But when he hooked up the ground it didn’t fix it so that makes it not necessary. ]:slight_smile:

Here is the way I would do it