Skip to content

Stepper Motor Drivers

bdring edited this page Feb 15, 2021 · 2 revisions

Stepper Motor Drivers

Overview

Grbl_ESP32 supports many types of stepper motor drivers. A stepper motor driver uses the step, direction and enable signals from the controller and creates the coil currents required to run a stepper motor. Anything that can accept these step, direction and enable signals, like an ODrive Servo motor can be considered the equivalent of a stepper motor.

StepStick Style Drivers (AKA Pololu)

StepStick or Pololu style drivers use a standard 2 column, 8 row format of the pins. They all share the same basic pinout so they can generally be swapped with each other. Most of these are 3.3V compatible and can be used with the ESP32. Some have an on board 5V Vcc source and therefore are generally not compatible. The motor current and microstepping for each may be different, so you may need to adjust something related to that when swapping.

You typically adjust the motor current with a potentiometer. You adjust the microstepping level with some jumpers on the pins labeled MS1, MS2 and MS3. The ESP32 can handle very high high step rates, so some controllers eliminate the microstepping jumpers and hardwire them to the finest microstepping level.

You can set an enable pin for these drivers by defining STEPPERS_DISABLE_PIN to your enable pin (e.g. GPIO_NUM_2). To invert the enable signal, you can define DEFAULT_INVERT_ST_ENABLE to 1, but these drivers usually require the enable signal to not be inverted.

To keep your drivers enabled for longer than the motion, you can set $Stepper/IdleTime to some timeout in milliseconds. A timeout of 255 is the maximum, and means that the drivers will always remain enabled.

Here are a few common StepStick style drivers

  • Allegro A4988 - I like these for small motors like NEMA14. They tend to run better than some others at very low currents.
  • TI DRV8825 - This have a high power level, but tend to be noisy, even when the motor is not running.
  • Some Trinamic Drivers (in stand alone mode) - These are known for their very low noise level.
  • S109 (Toshiba 7S109) - This has a 5V output that could damage the ESP32. See this issue on Github.

Trinamic (SPI) Controlled Drivers

Many Trinamic drivers have so many adjustments that a pot and a few jumpers are not sufficient. They use an SPI communications bus to make the adjustments. The firmware must set these values. many of the common things to be changed can be adjusted via the $$ settings.

The drivers can use individual CS (Chip Select) circuits or they daisy chain a single CS circuit for all drivers. There is a full wiki page on the use of these drivers.

Trinamic (UART Controlled Drivers)

These are not currently supported by Grbl_ESP32.

External Motor Drivers

These are offer a lot of power and a wide variety of microstepping options. They generally use opto isolators on the step, direction and enable inputs. This means the signal lights an LED, that LED shines on a detector and the detector transmits the signal to the driver. This means the the driver is electrically isolated from the CNC controller. This prevents noise or voltage spikes at the machine side from damaging the CNC controller (ESP32) side. This is why each input has a + and - connection. There is no common ground between them.

The LED in the circuit requires a current limiting resistor. Generally there is one inside the driver that is sized for 5V. This means you don't need a resistor when the signal is 5V and you can add an additional external resistor if you want to operate above 5V. Unfortunately the ESP32 is a 3.3v device.

Most people have reported that 3.3V still generally works, but you might be very close to the threshold of not working if the voltage drops. I do not recommend running them at 3.3V. You can use a voltage level shifter, but be careful which one you use. Common ones like the TI TSX0101use a pull up resistor for the high signal. That resistor cannot drive the current needed (a few milliamps) for the LED. Use could use a transistor array or something like the 74ACT245 chip.

Closed Loop Stepper Motor Drivers

These work very similar to the external motor drivers above. They often have an alarm output in case the closed loop feature detects a stall. Grbl_ESP322 does not directly support that, but in theory this could be wired to a hold or reset input.

Clone this wiki locally