Connecting two stepper motors to a single Arduino board

Hi there!

I am planning on using a single Arduino UNO board to drive two stepper motors, rated at 1.68A each. Presently, I am planning to use two A4988 stepper motor drivers to drive this. I’m still uncertain on my choice of stepper motor drivers but there seems to be a lot of online resources on wiring this particular type of driver up to the logic circuit, and I’m a newbie when it comes to electronics, hence why it’s my choice. I’m aware that the rated continuous current this driver can deliver is 1A per phase, so I’m planning to purchase compatible heat sinks alongside them to bring the currents up to about 1.68A. Must this current entirely be supplied in order to get the motor moving without a load, or will it start moving at much lower a current, with current requirement increasing with greater driven loads?

I’m open to other suggestions of drivers if you have any.

It appears to me (based on the A4988 connection diagram appended below) that the 5V port on the logic board is used to power a single stepper motor driver. Is there a way of using the same 5V port to power a second stepper motor driver, or an alternate port I could use in the board to power a second driver? What will I be trading-offs with connecting two drivers to a single board (in terms of the depletion of processing resources) (i.e. less voltage available to power other devices on the board). I’ve heard of shields that can house more than one stepper motor driver whilst only needing a single power input from the Arduino, although I haven’t been able to personally find these. Would you be able to point me in the direction of one? Thanks for your help! :slight_smile: :slight_smile: :slight_smile: :slight_smile:

J

jp2617:
Is there a way of using the same 5V port to power a second stepper motor driver

Sure. That connection is only powering the A4988 chip itself, not the motor as well. Since the A4988 doesn't draw much current, it's no problem to power multiple of them from the Uno's 5V pin.

jp2617:
What will I be trading-offs with connecting two drivers to a single board (in terms of the depletion of processing resources)

Assuming you want to control the steppers independently, you're going to need to send the step pulses to each driver. That does require some processing resources, but certainly the Uno is capable of doing this and other things. The main consideration is that your code needs to be written in a way where you're not wasting the processing resources spinning away doing nothing in blocking code (e.g. the delay function).

jp2617:
i.e. less voltage available to power other devices on the board

The concern would be more about current than voltage. The 5V pin does have a limit in how much current it can supply. That limit will depend on how the board is powered.

If you are powering the board via the USB connection, then it will be limited by the capabilities of your power supply.

If you are powering it via the barrel jack, then it will be limited by the voltage regulator on the Uno. That will depend on the input voltage (higher input voltages cause the regulator to have to dissipate more heat for a given current and thus reduces the maximum current before thermal shutdown occurs). The 5 V rail on the Uno is powering the components on the Uno itself, as well as any other current draws on the IO pins and the 5V and 3.3v pins. But the A4988 is not drawing a large amount of current (I'm having trouble determining exactly how much from looking at the datasheet) so it's not a huge concern.

But note that is only powering the drivers. You will need to provide a separate power supply for the motors. You can't power them from the Uno.

jp2617:
I've heard of shields that can house more than one stepper motor driver whilst only needing a single power input from the Arduino, although I haven't been able to personally find these. Would you be able to point me in the direction of one?

I'm amazed you couldn't find them. They are very common. Here's one:

pert:
The main consideration is that your code needs to be written in a way where you're not wasting the processing resources spinning away doing nothing in blocking code (e.g. the delay function).

You can start with Arduini playground stepper library, but that does not support automatic control of more than one stepper.

I did use AccelStepper library because only that allows to use half-steps of my 28BYJ-48 stepper motors.
I did manage to control two steppers for Pan Tilt camera system or xy microscope positioning table using AccelStepper class for both motors myself. The library contains MultiStepper class that allows to control multiple steppers (up to 10) in a coordinated fashion:
https://www.airspayce.com/mikem/arduino/AccelStepper/classMultiStepper.html

jp2617:
I am planning on using a single Arduino UNO board to drive two stepper motors, rated at 1.68A each. Presently, I am planning to use two A4988 stepper motor drivers to drive this.

If the motors need 1.68 amps then you would be better to use DRV8825 drivers. The A4988 would struggle to provide enough current - you would need heat sinks and a cooling fan.

The Pololu web page for the DRV8825 has a good wiring diagram and lots of other useful info.

...R
Stepper Motor Basics
Simple Stepper Code

I have tried to dissect Marlin firmware to figure out how they run multiple stepper motor and update a display and running extruder heater in monitor temperatures all at the same time but I still have it figured out how to use or how Marlin actually works doing that

0-0-0-0-0-0:
I still have it figured out how to use Marlin

Presumably that should be haven't ?

But what's Marlin got to do with this thread anyway?

DRV8825 definitely, not A4988, its just more robust and can handle over 1A, no decision to make!!

Connecting several things to the same 5V pin means making a cable harness of some sort as
you have to split the power. For this you can solder, use terminal blocks, crimp connectors, or
simply use an external 5V regulator on a separate board if you want. Stripboard can be a
convenient substrate for mounting several modules on and wiring them, if you solder.