HELP with NEMA 17 and pololu a4988

Hi, i bought a kit of NEMA 17 and pololu a4988. The motors are used, but they seem to be ok.

The problem was when I tried to test them. I conected the motors one by one, and I looked for a code to test them as well as the diagram to make the connections.

At first it started working fine, but after 2 cycles the motor began to fail, it got stuck, and then it began to work fine again, and then fail again. and repeat that loop over and over.

I figured that the failure just happens in the same direction. At beggining I thought the motor was the problem, but then i tried with the other 2 and they had the same fail, then i thought about pololu, but then again I tried with other and the same happened.

The motor is a Nema 17PM-K356-01VS, pololu a4988 driver and Arduino MEGA 2560.
I am using a 12V and 500 mA power Supply as well as arduino’s power supply for a4988.

This is the code I found:

//////////////////////////////////////////////////////////////////////////////////////////////////
#define VELOCIDAD 2000

int steps = 3;
int direccion = 8;
int reset = 7;
int pasos = 1000;

void setup() {
pinMode(steps, OUTPUT);
pinMode(direccion, OUTPUT);
pinMode(reset, OUTPUT);
}

void loop() {
digitalWrite(reset, LOW);
delay(100);
digitalWrite(reset, HIGH);
digitalWrite(direccion, HIGH);

for (int i = 0; i<pasos; i++)
{

digitalWrite(steps, HIGH);
digitalWrite(steps, LOW);
delayMicroseconds(VELOCIDAD);

}

digitalWrite(reset, LOW);
delay(100);
digitalWrite(reset, HIGH);
digitalWrite(direccion, LOW);

for (int i = 0; i<pasos; i++)
{

digitalWrite(steps, HIGH);
digitalWrite(steps, LOW);
delayMicroseconds(VELOCIDAD);
}

}
///////////////////////////////////////////////////////////////////////////////////////////////

PLEASE I NEED HELP!!

Please edit your post to put [ code ] tags around the code.

Your power supply is only able to deliver 500mA? Have you set the current limit on the A4988 to 250mA? Follow the instructions in their video. It's quite helpful. The reason for setting the limit low is there's two coils, so they need to share the 500mA available.

Are you sure you've wired it correctly? A Google search for that motor part number doesn't show anything useful. Can you give us a link to the page you bought it from?

You can also work out the correct wiring for yourself if you have a multimeter. I think Robin's Stepper Motor Basics has a section that tells you how to do this. A wiring error is most likely, given that symptom.

We need to know the spec of the motor - the part number you gave doesnt match anything google can find.

You need to post a link to the datasheet for the stepper motor - in particular we need to know how many amps can the coil take and what is the coil resistance.

I suspect 500mA is not enough current and a power supply with more amps (and maybe more volts) would be better.

Try running the motor at a much lower speed to start with.

What is the purpose of writing to RESET?

The Pololu A4988 web page has a good wiring diagram.

...R
Stepper Motor Basics
Simple Stepper Code

Sorry for the late answer. I found out that maybe Arduino is the problem, I measured the Vout of the pins of arduino and they spontaneously showed a different value than expected. For example, when Arduino sends HIGH, the multimeter measured around 5V, but when arduino sends LOW, the multimeter showed a value around 0.03V. But when the fail occured in LOW the value was around 2.6V, and when HIGH it suddenly drops to 0.3V.
That's why I'm thinking it could be an arduino issue. I also realized that it fails cause the arduino is doing something like a reset, I Think that because the green LED starts blinking when the fail occurs.

It is a power supply issue, not an Arduino issue. The motors draw more current than the power supply can provide, which is most likely what resets the Arduino.

Ricardo_vel:
I measured the Vout of the pins of arduino ....

That does not make any sense to us without a diagram showing exactly how YOU have everything connected.

A photo of a pencil drawing is best if you don't use proper schematic software. Please don't use Fritzing.

...R

Thanks for the advice, I am using the “Typical Application Diagram” given in the pololu a4988 datasheet for the wiring.

Now I’m getting a power supply with higher current values and see if that fixes the problem.

**The rated current of the motor is 0.9A and 5V. It also has a resistance about 4 ohms.

You probably need a somewhat more powerful supply - or to derate the motor and
drive it with 300 to 400mA - otherwise its a bit borderline when you start to get it moving.

At the very least check its 12V is holding up solidly under load.

Ricardo_vel:
I am using the "Typical Application Diagram" given in the pololu a4988 datasheet for the wiring.

Never mind "typical". Make a drawing showing YOUR ACTUAL wiring and post a photo of it.

The business of making the drawing is often illuminating.

...R

It is an Arduino issue. I tried with other applications and it keeps reseting. I tried with the 28BYj stepper and it resets, I also tried with LEDs and the same happened.

Ricardo_vel:
It is an Arduino issue.

Try another arduino board ... and see what happens. Or put big capacitors on the arduino supply rails... and see what happens.