A4988 Driver Connected to 2 Steppers?

For my project I want to run 2 identical stepper motors at the exact same constant speed but in opposite directions. I’m using some small Portescap motors (20M020D2B Bipolar, 12v, 100mA rated current per phase http://www.portescap.com/sites/default/files/20m020d_specifications.pdf) and the A4988 driver carrier.

Is it possible to connect the 2 motors to the one board?

I don’t see a problem, as long as the respective windings are connected in parallel. In fact, I predict that it will work exactly as you want.

To reverse the direction of rotation of a bipolar motor, swap the two leads of either coil.

[quote=“Jim Remington”]I don’t see a problem, as long as the respective windings are connected in parallel. In fact, I predict that it will work exactly as you want.

To reverse the direction of rotation of a bipolar motor, swap the two leads of either coil.[/quote]
Excellent, thanks Jim!

I’ve got my 2 steppers connected to the same A4988 driver board (coils reversed so they spin in opposite directions) with the DIR pin connected to +5V (since the direction is constant). All seems to work with the following code:

``````// Accelerates up to MaxSpeed. Does this by setting a low initial speed,
// then increasing the speed a small amount every "interval" number of
// milliseconds.

#include <AccelStepper.h>

int motorDirPin = 3;
int motorStepPin = 2;

//set up the accelStepper intance
//the "1" tells it we are using a driver
AccelStepper stepper(1, motorStepPin, motorDirPin);

float maxSpeed = 100;  // # of steps per second to speeed up to (full step)
//float maxSpeed = 500;  // # of steps per second to speeed up to (1/16 step)

unsigned long time;
unsigned long previousAccel = 0;
int interval = 100;   // # of milliseconds between speed increases (full step)
//int interval = 25;   // # of milliseconds between speed increases (1/16 step)

void setup()
{
stepper.setMaxSpeed(maxSpeed);
stepper.setSpeed(10);
}

void loop()
{
while (stepper.speed() < maxSpeed) {
time = millis();
if (time > previousAccel + interval) {
previousAccel = time;
stepper.setSpeed(stepper.speed() + 2);
}
stepper.runSpeed();
}
stepper.setSpeed(maxSpeed);
stepper.runSpeed();
}``````

But I notice that at slower speeds the motors vibrate - quite a lot. That could be a big problem when they go inside my plastic model. Is that just the nature of steppers? The speed I’m aiming for is probably less than 60 rpm.

Also, I tried pulling up M1-3 to get the maximum resolution (so that the acceleration looks as smooth as possible) but that seems to make the motor vibrate more. Again, is this just the expected behaviour of a stepper? I’m only looking at them because DC motors are too loud.

Stepper motors vibrate. At certain speeds resonance occurs and the vibration gets much worse. Use the microstepping feature of the driver to substantially reduce noise and vibration.

Hello, RossW.

As Jim mentioned, stepper motors typically have some vibration, but microstepping usually helps. What are you using as a power source? Have you set the current limit on your DRV8825 carrier, and if so, what did you set the VREF voltage to?

You might try testing at the intermediate microstepping modes (1/2, 1/4 , 1/8, 1/16), adjusting the step rate for each case to keep the speed the same, and see how it impacts the vibration.

-Brandon

[ul]
[li]I’m using a switching regulated 12V power supply.[/[/li]
[
]I set the current limit on the A4988 carrier board using the equation on the product page. The stepper is rated at 100mA per coil so I set Vref to a little less than 40mV.[/*]
[/ul]

I tried 1/2 step and 1/16 step modes by connecting M1-M3 to +5V as per the product page for A4988 carrier board. It seemed to vibrate more with than with the full step mode.

Caveat: I’m not using a Pololu A4988 board; I got it off eBay. I’ve just ordered 2 today from here, though.

Hello.

Are you running two stepper motors with the setup you described in your last post? If so, please note that when using two stepper motors in parallel, you should set the current limit to be twice the current per phase rating of those stepper motors (e.g. if each stepper motor is rated for 100mA per phase, you should set the current limit to 200mA when using them in parallel).

-Brandon

[quote=“BrandonM”]Hello.

Are you running two stepper motors with the setup you described in your last post? If so, please note that when using two stepper motors in parallel, you should set the current limit to be twice the current per phase rating of those stepper motors (e.g. if each stepper motor is rated for 100mA per phase, you should set the current limit to 200mA when using them in parallel).

-Brandon[/quote]
Thanks Brandon! I had t even thought of that!

I removed the 2nd motor to see if the vibration would decrease, but no luck - nothing changed. I’m thinking now I can’t use steppers in this application since I need to spin them at such a slow RPM (< 60 RPM).

I should have mentioned in my previous post that if you are still using the A4988 carriers you got from e-Bay, they might not have the same formula for setting the current limit with the VREF voltage, so you might double check that the setting you used makes sense for your carrier.

-Brandon

[quote=“BrandonM”]I should have mentioned in my previous post that if you are still using the A4988 carriers you got from e-Bay, they might not have the same formula for setting the current limit with the VREF voltage, so you might double check that the setting you used makes sense for your carrier.

-Brandon[/quote]
Thanks Brandon. I will try again once I get the new A4988 carrier boards I ordered from here a few days ago. The ones I got off eBay didn’t have a spec sheet.

Just got my Pololu A4988 carrier boards today and swapped them in but the steppers still vibrate like crazy at low RPMs (constant speed). I connected the boards using the minimal connection diagram and calculated Vref to be 80mV with 2 stepper motors connected (100mA per phase per motor) in parallel and programmed the Arduino Uno R3 board with this code:

``````// Accelerates up to MaxSpeed. Does this by setting a low initial speed,
// then increasing the speed a small amount every "interval" number of
// milliseconds.

#include <AccelStepper.h>

int motorDirPin = 3;
int motorStepPin = 2;

//set up the accelStepper intance
//the "1" tells it we are using a driver
AccelStepper stepper(1, motorStepPin, motorDirPin);

float maxSpeed = 100;  // # of steps per second to speeed up to (full step)

unsigned long time;
unsigned long previousAccel = 0;
int interval = 100;   // # of milliseconds between speed increases (full step)

void setup()
{
stepper.setMaxSpeed(maxSpeed);
stepper.setSpeed(10);
}

void loop()
{
while (stepper.speed() < maxSpeed) {
time = millis();
if (time > previousAccel + interval) {
previousAccel = time;
stepper.setSpeed(stepper.speed() + 2);
}
stepper.runSpeed();
}
stepper.setSpeed(maxSpeed);
stepper.runSpeed();
}``````

I had tried steppers because I’d heard they were quieter than DC motors (they’re going into a plastic model and I have to reduce the sound to near 0 if at all possible) but perhaps that’s true with discrete steps or at higher RPMs. Sigh.

Your current limit setting sounds correct. I noticed you are using a version of the AccelStepper library, and it looks like your code is doing a little more than simply stepping the motor at some set speed. You might try a simpler code, like the one found in our “Setting the Current Limit on Pololu Stepper Motor Driver Carriers” blog post to see if you get the same results.

By the way, while some stepper motors might be quieter than some brushed DC motors, they certainly are not silent. Some people have even use it to their advantage to reproduce songs using stepper motors, such as in this example where the Mario theme being played by a few stepper motors.

-Brandon

I’ve tried the code previously but I’ll do so again now that I have an official Pololu A4988 board.

Would 1/16 micro stepping make the slow RPM any smoother/quieter?

I would expect a stepper motor making 1/16 microsteps to typically be smoother and quieter than it would be while taking full steps.

-Brandon

Same vibration observed with this code and M1-M3 connected to +5V (which yields the approximate RPM I’m looking for):

[code]
void setup()
{
digitalWrite(3, HIGH);
digitalWrite(2, LOW);
pinMode(3, OUTPUT);
pinMode(2, OUTPUT);
}

void loop()
{
digitalWrite(2, HIGH);
delay(1);
digitalWrite(2, LOW);
delay(1);
}[/code]

It is hard to say from just a description if the vibration you are seeing is normal or not. Could you post a video that shows it?

-Brandon

Thank you for making the video. It is hard to get a good sense of the vibration from the video, but from what I can tell, it looks like they are operating normally.

-Brandon