Controlling 3 Stepper Motors with 1 Arduino / Circuit Board

Hi all,

I am working on an art project that involves three stepper motors that must operate independently in stages, i.e. STAGE 1: stepper 1 and 2 operate. STAGE 2: stepper 2 operates. STAGE 3: stepper 3 operates.

I am hoping to have all stepper motors controlled by the same Arduino (but with different drivers). Wondering if anyone knows if Arduinos exist with this capability? Will an Arduino Mega to 3x drivers be sufficient? I have no experience with Raspberry Pis, but they may offer what I need.

Thank you,

Liam

It depends on the stepper driver you use. This one, for example:

A4988 Stepper Motor Driver Carrier | Buy in Australia | POLOLU-1182 | Pololu | Core Electronics

is controlled with Step and Dir commands. That requires 2 GPIO ports per stepper, or a total of 6 ports for your three steppers. That is well within the capabilities of the Arduino UNO, Nano or Mega. Whether or not you need to go with a Mega depends on the other devices you need to control with the GPIO ports,such as indicator LEDs or a character display, but it’s not likely.

The one I would personally recommend is this:

CNC Shield Version 4.0 Controller Pack - Maker Store PTY LTD

It comes complete with the Nano and the driver modules and only requires a power supply and motors to be up and running. A quick search Indicates that Core doesn’t stock it any more, but perhaps they could look through their old stock for you. Be very careful of cheap imitations - there are many copies around which have a significant error in the design and do not work properly without changes to the board. Steer clear of the platform sellers and be sure your supplier is confident that their product complies with the original design. There is a similar product available for the UNO which I believe is correct.

2 Likes

Hi Jeff105671,

Thank you :slight_smile:

I will look into the CNC Shield! Sounds promising.

In regard to drivers with 2 ports per stepper… how does this work with stepper motors that have 4 output pins, which seems to be the standard? Do two pins go into one port.

Cheers,

Liam

Some stepper drivers are only a driver, and require that the MCU controls each of the stepper motor inputs separately. This could require 3, 4, 5, 6 or even 8 MCU ports depending on the motor. However most currently available stepper drivers incorporate a controller. This type of driver/controller takes the Step and Direction inputs from the MCU (2 ports) and converts it into the 4 inputs that a bipolar stepper requires. They are configured with jumpers or pin settings for things like microstepping, and usually have a potentiometer for setting the maximum current. These drivers will not work with a unipolar stepper (although very often the unipolar stepper can be converted to bipolar) and steppers with 6 or 8 inputs need to be configured as 4-wire bipolar (which simply involves ignoring some wires or connecting some of them together).

2 Likes
  1. Arduino Mega is fine (many pins, plenty of memory). If you need higher step rates or very tight real-time behaviour, consider Teensy 4.1, Arduino Due, or ESP32 as alternatives (more CPU horsepower).
  2. Use step/dir drivers (A4988, DRV8825, TMC2209, TMC2130…). TMC2209/TMC2130 are quiet and advanced (UART/SPI features). A4988/DRV8825 are cheap and common.
  3. 2 pins (STEP, DIR) + optional ENABLE, MS1/MS2/MS3 if your driver uses them for microstepping. Common ground required. Motor power (VMOT) from appropriate external supply — do not power the motors from the Arduino.
  4. Use AccelStepper (non-blocking; handles multiple steppers concurrently). Avoid blocking stepper code (e.g. naive for loops) if you need independent operation.
  5. Choose motor supply voltage appropriate to motors and drivers. Set current limit on each driver, use heatsinks, and add decoupling caps on VMOT.
  6. Add diodes/fuses, keep drivers cool, and test at low current first.
2 Likes

Awesome! Thank you! Currently driving 3x stepper motors with 3x A4988s and an ELEGOO Mega. Working great so far.

2 Likes