Help with GA12BY15 stepper

Dear all,

Thank you in advance for your kind help.

I am trying to drive this stepper motor (model GA12BY15, that is a BY15 motor with a gearbox) using an Arduino Nano. According to its specifications, this is a 5V, 2 phase stepper motor with 300 mA/phase current. I would like to power the entire device via the USB and avoid a second power supply for the stepper motor. This is the reason why I chose a 5V motor.

I am trying to drive it with an A4988 stepper driver, according to the scheme attached below. That is an adaptation from a tutorial I found (link for completeness https://www.lombardoandrea.com/pilotare-un-motore-passo-passo-con-arduino-e-il-driver-a4988/). The code I am trying to run as a test is super-simple, as it only changes the status of pin 3 every 4 seconds to let me check if the motor works:

void setup(){
pinMode(3, OUTPUT);
}
int status = LOW;
void loop(){
digitalWrite(3,status);
delay(4000);
status= !status;
}

I checked this with an LED and it is working.

Of course, instead, the motor does not and I have no idea where to start fixing it. Once connected and powered, the motor does not even mode a single step. The two coils seem to be fine, and I measured a resistance of 30 ohms each. Checking the voltage output of the motor wire pairs (A1-2 and B1-2 in the scheme below) I see that one stays still at around 4V, while the other is at 0. I tested more that one A4988 module and all behave the same, therefore I exclude this is due to a malfunction.

I have little to no previous experience with Arduino or electronics projects, therefore finding information and understanding what is wrong is very challenging for me. I would be grateful if someone could help me through this, and possibly also teach me something in the process.

Many thanks in advance!

The A4988 stepper driver will not work with under 8V motor power supply. Use a proper power supply (>8V) and set the driver current limit according to the instructions in the Pololu A4988 page. The stated voltage for the stepper is irrelevant. It is the coil current limit that is important.

Thank you for your advice! I did not know about the minimum voltage required for A4988.

Now, the hard cap for my project is that it must be powered by USB and use that specific motor. Rather than changing the power supply, I think I should change the stepper driver. Can you please help me understand how to drive it? I could find no information at all on Google.

Many thanks!

stefano_toso:
Now, the hard cap for my project is that it must be powered by USB and use that specific motor.

Please post a link to the datasheet for the motor.

It is not a good idea to power any motor from the Arduino 5v pin - even if it would work with 5v.

The very common 28BYJ-48 stepper motors work with 5v power and normally use a ULN2003 chip for the driver. Maybe that could also work with your motor. Note however that the 28BYJ-48 is a unipolar motor and your seems to be a bipolar motor (but I have not seen the datasheet).

...R
Stepper Motor Basics
Simple Stepper Code

stefano_toso:
I am trying to drive this stepper motor (model GA12BY15, that is a BY15 motor with a gearbox) using an Arduino Nano. According to its specifications, this is a 5V, 2 phase stepper motor with 300 mA/phase current. I would like to power the entire device via the USB and avoid a second power supply for the stepper motor.

So that motor is going to pull 600mA. The max you can get through USB is 500 and of course the driver and Nano will consume some power too. Your desire to avoid an external power supply basically makes your project unfeasible.

I see... So the best option seems to be getting a 12V external power supply. This might be feasible, however, I have a few questions:

  • Can I power the Nano with the 12V power supply?
  • How should I design the circuit? In this case, I would be using the A4988 as driver.

I assume I should replace the stepper motor as well and switch to a 12 V one, correct me if I am wrong.

Thank you for your help!

Pololu has several low voltage stepper drivers.

You will still need an external motor power supply.

First, I want to thank you all for the help so far!

Following your advice, I scavenged a 12V/5V power supply from an old CD reader, and I was able to power the Ga12By15 stepper motor through the A4988 driver. It now moves!

However, I am now testing it through the code below, and I noticed that if I change the pulse delay time (variable delaypulse) the motor behaves oddly.

With too low values (<500) the motor does not move, and whistles. I assume it is because the frequency is too high, ok.
With too high values (>1000) the motor moves badly, shacky, or does not move at all if values are even higher. This second behaviour is what puzzles me, because I assumed there should be no problems in moving slowly for a stepper motor.

For values around 900 the motor performs the best, but I still have the feeling it sometimes skips some steps. This mainly because when running the code below, that should make two full rotations in opposite direction, the motor does not come back exactly at the starting position. Additionally, I found that the variable numStepMotor must be changed to achieve a true full rotation when the delaypulse variable is changed.

This makes no sense unless I assume I have some skipping steps.

Can you please help me figure this out? Many thanks!

CODE BELOW

const int numStepMotor = 2350; // number of steps required for a full rotation (esteemed)
const long delaypulse = 900; // delay time of pulse on - pulse off

void loop() {

digitalWrite(pinReset, HIGH);

//define motor direction
digitalWrite(pinDir, HIGH);

//make one full rotation
for (int x = 0; x < numStepMotor; x++) {
digitalWrite(pinStep, HIGH);
delayMicroseconds(delaypulse);
digitalWrite(pinStep, LOW);
delayMicroseconds(delaypulse);
}

//wait some time
delay(4000);

//change motor direction
digitalWrite(pinDir, LOW);

//make one full rotation
for (int x = 0; x < numStepMotor; x++) {
digitalWrite(pinStep, HIGH);
delayMicroseconds(delaypulse);
digitalWrite(pinStep, LOW);
delayMicroseconds(delaypulse);
}

//wait some time
delay(4000);
}

That doesn't sound right. If you step the motor too fast, eventually it will not be able to manage and the whistle you're hearing is something I've experienced in a similar situation. You may need to accelerate rather than trying to start at full speed.

However, failure to step slowly is more serious - you should be able to step as slowly as you like without skipping steps. That you can't says that there is something wrong. I'll guess that your power supply is inadequate.

I think I found the origin of the problem!

I was testing it while the Arduino was both connected to the USB and the 12V power supply. Once I unplugged the USB, it completely changed its behavior. It is now turning much better.

Apparently, I didn't fry anything, but I assume there was some risk...

stefano_toso:
Can you please help me figure this out? Many thanks!

As you now have an A4988 driver try this Simple Stepper Code.

There should be no lower limit to how slow the motor steps. One step per day (or per week) should be fine. There will be an upper limit to the speed, especially if you are not using acceleration and if you are using a low voltage motor power supply.

...R
Stepper Motor Basics

Don't forget to set the current limit properly on the A4988 driver.

If you have a cheaper imitation of the Pololu module, Pololu's instructions probably will not work correctly, because the imitation manufacturers often choose different values for the current sense resistor.