Stepper motor driver

From RepRapWiki
Jump to: navigation, search

To make a stepper motor work, you need to use

  1. a stepper driver chip or
  2. a microcontroller and, optionally, one or two full h-bridge chips.


Driving stepper motors

Stepper Driver

These chips keep the power that drives the motors separate from the power that is on the arduino. The arduino can't provide enough juice to power the stepper motors directly. This is why you have to use separate chips to sort of act as valves that control how the motor spins.

Another benefit that stepper driver chips provide, is that they provide fractional steps. This helps smooth out the motion of the stepper motor. Without fractional steps, stepper motors can have a tendency to vibrate or resonate at certain RPMs.

Microcontroller-based Stepper Drivers

Microcontroller based steppers drivers can achieve very high rotation speeds in stepper motors. Using a microcontroller, it is possible to have extreme control over exactly how each individual coil is energized inside the motor. This is absolutely necessary to obtain high speeds because as speed increases, timing of the coils firing must be perfectly in sync. Quoting from Dr. Iguana:

If you've ever pushed someone on a swing, you know that a small, well timed push can cause that person to swing higher and higher. Miss a push or two by even a small amount and the 'power transfer' is significantly less. This is the situation in stepper motors at high speeds. If you don't match the pushes or steps to the actual state of the motor it will run poorly.

In order to handle current higher than what the microprocessor can allow, the controller needs to use full H-bridge chips.

Normally, an H-bridge is used for controlling a plain old DC-motor but in this case, the h-bridge chips are used for exactly controlling the amount of electricity that goes to each individual coil on the stepper motor. Thus, for bipolar stepper motors, it needs 2 chips per motor.

Open Source Stepper Drivers


The AVRSTMD is an open source microcontroller-based stepper driver. It uses an atmega48 processor and two National Semiconductor LMD18245T current limited h-bridge chips.

Dr. Iguana

The Dr. Iguana stepper driver is based on a dsPic33 microcontroller and two L298N H-Bridge chips. It can achieve speeds up to 800 RPM. A very good source of information about microcontroller stepper drivers can be found on his website here along with all the schematics, gerber files, source code and BOM for the stepper driver.

Dr. Iguana. "A Better DIY Stepper Motor Driver". A series of pages (and a video) that give some tips for high-speed stepper motor driver design.

RepRap Stepper Motor Driver v1.x

  • obsolete*

Cache-2950488044 8ba115bd24 m.jpg

The first generation of RepRap stepper motor drivers. (Note: These boards were used in the generation 2 collection of electronics.) Uses the L297/L298 stepper motor driver combo. Half-stepping. Handles up to 2A. All through hole. A nice, solid driver. It uses some old technology, so it's not as fancy as the newer stepper drivers, but it gets the job done. Read the documentation page here

RepRap Stepper Motor Driver v2.x

  • obsolete*

Cache-3218206144 6461b3e2c0 m.jpg

The second generation of RepRap stepper motor drivers. (Note: These boards were used in the generation 3 collection of electronics but could be retrograded to generation 2.)

Uses the Allegro A3982 chip which does a bunch of nice things and makes the board much simpler. It also drops the price by $10 compared to the v1.x series. It can handle up to 2A, and does half-stepping. The only downside is that it's SMT, which can be a bit scary for people. It's all large SMT parts, so it's pretty simple to solder, especially with the solder paste / hotplate method. Read the documentation page here.

The PSMD Triple Axis Stepper Driver has all the same connectors and is a pin-compatible alternative to the RepRap Stepper Motor Driver v2.x.

Stepper drivers vs stepper controllers

To run a stepper motor, two things are normally required: A controller to create step and direction signals (at ±5 V normally) and a driver circuit which can generate the necessary current to drive the motor. In some cases, a very small stepper may be driven directly from the controller, or the controller and driver circuits may be combined on to one board.

The stepper controller drives 3 wires -- traditionally labeled "step", "dir", "GND" -- which carry motion information to the stepper driver. (Often these 3 lines are opto-isolated at the front end of a stepper driver). The stepper controller is typically a pure digital logic device, and requires relatively little power.

The stepper driver connects to the 4 thick wires of the stepper motor. It contains the big power transistors, and requires a thick power cable to a DC power supply, because all the power to drive the motors runs through it.

PWM and Stepper Drivers

The vast majority of stepper drivers are connected to some controller with a 3 wire interface: the controller pulses the STEP pin to move the motor one step(*), the controller sets the DIR pin to choose whether a step is a clockwise step or a counterclockwise step, and a common GND pin.

From Wikipedia:Pulse-width_modulation: Pulse-width modulation (PWM) is a very efficient way of providing intermediate amounts of electrical power between fully on and fully off. A simple power switch with a typical power source provides full power only, when switched on. PWM is a comparatively recent technique, made practical by modern electronic power switches.

Stepper drivers normally work by chopping up a supply voltage using an embedded PWM chip. These chips do require minor support circuitry (which is the primary thing you pay for when you buy a stepper driver). The PWM chips themselves usually have a unit price below 10 USD, depending mostly on their rated current. A chopping driver, aka a current limiting driver, keeps the motor working and the current in the motor at a safe level, even when driving a "3V" motor from a "24V" power supply. All chips listed here have "thermal shutdown".

(*) Many chips also have built-in microstepping. When microstepping is enabled, each pulse on the STEP pin moves the motor one microstep.

Stepper driver chips

Here's a list of stepper driver chips (newest first):

Manufacturer Model Peak current Package Additional notes
Trinamic "stepper driver and controller 5041" 1.1 A (?) QFN48 (7x7) drives the Z axis in the T-Bone.[1][2]
Trinamic TMC4361 motion controller + Trinamic TMC2660 stepper driver 2.6 A (?) QFP44 drives the X, Y, E axis in the T-Bone.[3][4]
Allegro A4989 10 A TSSOP38 The A4989 is designed to drive external power N-channel MOSFETs. The A4989 in the Powerlolu (Powerlolu) drives IRLR024N MOSFETs which allow it to drive 10 A. Pin compatible with the A3986.
STMicroelectronics L6470 7 A HTSSOP28 or POWERSO36 Been used in a RepRap twice. Marlin-based RepRap firmware with L6470 support. RepRap PCB. File:GE stepper version 0.8b.sch, File:GE stepper version 0.8b.brd, File:Reprap.lbr.

L6470 Arduino library on Github.

STMicroelectronics L9942 1.3 A PowerSSO24 SPI. Diagnostic flags for stall detection, thermal warning, thermal shutdown, open load, overload. Full-, 1/2-, 1/4-, and 1/8-step modes.
Trinamic TMC249A [5][6] 4 A SO28 SPI. Status flags for stall detection, overcurrent, open load, over temperature, temperature pre-warning, undervoltage. load measurement. Drives 8 external MOSFETs -- datasheet includes list of recommended power transistors. Drop-in replacement for TMC239. Full-, 1/2-, 1/4-, 1/8-, and 1/16-step modes (1/64-step with additional components).
HHBYtech THB7128 3.3 A HZIP19 Suggested for the Gen7T electronics. Compared to TB6560AHQ better pin placement (e.g. all motor connector pins on one side, same as TB6600HG) and less picky on surrounding PCB design.
Toshiba TB6560AHQ 3.5 A HZIP25 and HQFP64 Used in the Gen7T and Sanguish and Sanguinoshiba electronics plus the open source stepper driver for open source ecology[citation needed]. See also: 4 Axis TB6560 CNC Stepper Motor Driver Board Controller.
Toshiba TB6600HQ; TB6600HG 4.5A HZIP25-P-1.00F Used in PiBot TB6600 Stepper Driver.Test on GEN7V1.4-1.41 and PiBot for Repetier V1.0-1.4. Compared to TB6560AHQ better pin placement (e.g. all motor connector pins on one side, same as THB7128).
Allegro A3967 0.75 A SOIC Used in Easy Driver boards sold on Sparkfun. Not sure if they can be used in RepRaps but they're good for experimenting. Slightly underpowered, at only 750 mA/phase.
Allegro A3977 2.5 A PLCC or TSSOP Abandoned in stepper motor driver v2.0.
Allegro A3979 2.5 A TSSOP Abandoned due to tiny size in v2.1.
Allegro A3982 2 A SOICW Improved over v1.2 in v2.2. Also used in Stepper Motor Driver 2.3.
Allegro A3992 1.5 A DIL or TSSOP Used in Gen L Electronics.
Allegro A4984 2 A TSSOP or QFN Used in Stepsticka4984. Full-, 1/2-, 1/4, and 1/8-step modes. motor short circuit protection. Almost identical to A4988, except it lacks the "M3" pin that indicates 1/16 microstepping, and some people prefer this TSSOP package over a QFN package.
Allegro A4983 2 A QFN Discontinued product, replaced by A4988. Used in A4983 Breakout Board.
Allegro A4988 2 A QFN Used in Pololu stepper driver boards and the G3D driver. Identical and pin compatible to A4983, but also pullup on M1 and motor short circuit protection. Full-, 1/2-, 1/4-, 1/8-, and 1/16-step modes.
Texas Instruments DRV8811 2.5 A HTSSOP Used in generation 6 electronics. This is probably why the FiveD firmware was modified.
STMicroelectronics L297   DIP20 or SO20 Translates "step, dir" inputs to the 6 pin "phase sequence" outputs that go to a dual full bridge like the L298. Full and 1/2 step modes. Last stepper motor driver to use this was Stepper Motor Driver 1.2.
STMicroelectronics L298 4 A Multiwatt15 or PowerSO20 Dual full-bridge. When properly connected to something like the L6506 or L297, as in the Stepper Motor Driver 1.2, the L298 can be used to build a (current limited) chopping motor driver. When its sense outputs are directly connected to ground, as in the Valkyrie Redux, no current limiting.
Texas Instruments SN754410 1 A DIP 16 Dual full-bridge. "Improved Functional Replacement for ... L293". No current limiting (other than thermal shutdown).
STMicroelectronics L293D 0.6 A Powerdip 16 or SO20 Dual full-bridge. Multiples can be stacked on top of each other to divide up amperage. No current limiting.
Texas Instruments DRV8825 2.5 A HTSSOP  

The "Peak current" column is wildly optimistic. (See "The Motor Driver Myth" ).

The through-hole packages, are widely considered the easiest to solder by hand ("HZIP", "DIL", "DIP", "Powerdip", etc). The "SOIC" and "PLCC" are relatively easy-to-solder packages, for surface-mount devices. The "TSSOP" and "QFP" and "QFN" surface-mount packages are difficult to solder by hand.

There's a nice comparison table and review of microstepping driver ICs at Web archive backup: "Bipolar microstepping motor driver roundup as of Aug 2013" (via "Alternative stepper motor driver?").

Stepper drivers

Sourcing stepper motor drivers can be a bit difficult. The RepRap V2.3 stepper drivers are very hard to purchase pre-assembled. Builders with just a little bit of skill can source parts and assemble the controllers. Those without skills or materials to assemble the boards can buy generic stepper drivers. In Europe it will usually be more cost-effective to get pre-assembled boards than it will be to buy parts and perform a DIY assembly.

Available stepper drivers
Manufacturer Verified? Location Max current Microstepping Comments
Stepper Motor Driver 2.3 (using A3982) Yes US 2 A 1/2 Listed for comparison.
StepStick Yes Open Source 2 A 1/16 Pin compatible and very similar characteristics to Pololu Stepper Driver Board.
Pololu stepper driver board Yes US 2 A 1/16 Can get very warm; active fan cooling or passive small heatsink is needed above ~0.5 A.
MKS TB6600 (using TB6600) Yes CN 4.5 A 1/1,1/2A,1/2B, 1/4,1/8,1/16 *it offer an solution that suit for your CNC mill and 3D Printer, easy convert your CNC into a 3D Printer. *Limit input voltage: 45v.
EasyDriver (using A3967) Yes US 0.75 A 1/8 Slightly underpowered compared to other drivers, at only 750 mA/phase. bothacker uses EasyDriver[7], and reports that it has plenty sufficient power for Mendel. Recommended.
... 4 Axis Stepper Motor Driver Controller (using A3977) Yes US 2.5 A 1/8 4 stepper drivers on a single board.
PiBot_TB6600_Stepper_Driver (using Toshiba 6600HQ) Yes CN 0-4.5 A 1/1,1/2A,1/2B, 1/4,1/8,1/16
  • PiBot_Stepper_Driver Board is a opensource driver board.
  • it offer an solution that suit for your CNC mill and 3D Printer, easy convert your CNC into a 3D Printer.
  • NEMA14 and NEMA17 stepper motor compatible.
  • photoelectric-isolation used in the input port,compatible more drive Level.
  • Carry a 60*60*10 aluminum heat sink, 6*1W external resistance sensor. A more powerful driver current.
  • Limit input voltage: 45v.
  • Thermal shut down (TSD) protection,Under voltage lock out (UVLO) protection, Over-current detection (ISD) protection.
DIY CNC No GB 2.5 A 1/8 Can drive 1 stepper; discount when buying several.
Arduino Motor Shield No US 0.6 A ? Requires Arduino as controller. Can drive 2 servos, 4 DC, or 2 (bipolar or unipolar) steppers. Website notes that you can increase the max current by piggy-backing (soldering a chip onto a chip) another L293D chip on top of the first (and another one on top of that)
... TB6560AHQ based No GB/PRC 1.5 - 3 A 1, 1/2, 1/8, 1/16 Can drive 3 to 5 steppers depending on model; read more.
Stepper Driver 2.3 Clone by kymberlyaandrus Yes US 2 A 1/2 Same schematic but physically smaller than the original version. The trim pot doesn't have a start/end point so adjusting the current can be more difficult than other boards. The terminal blocks are nice because they don't require making special connectors.
Gecko Drive Yes US 3.5 A 1/10 (only) Can drive 4 steppers
Nanotec SMC11 Yes GER 1.4 A 1/16 with cooling until 2.5 A
LiniStepper by Roman Black no US 3 A 1/18 and "stepless" Open Source: Circuit Diagram, PCB (Board) Layout, and PIC Software all available.
Tri Duino Stepper ??? ??? ??? ??? Open Source
A3979breakout ??? ??? ??? ??? ???
grblshield No US 2.5 1/8 3 axis controller plugs onto Arduino Uno or similar

PMinMo stepper motor driver comparison.

Mid-Band Resonance Compensation

Gecko drivers have a feature called mid-band resonance compensation which keeps stepper motors from stalling due to resonance issues that can occur when the motor is turning in the range of 5-15 RPMs. This can be very useful when controlling the steppers on a Tiag mill, for example. However, the stepper motors in a Mendel never run anywhere near that range, so mid-band resonance compensation provides no benefit to a Mendel build.


Pololu Modules

  • Stepper Motor is "jittering"
    • The Pololu modules shut down when they're too hot. Ensure proper cooling.
  • Stepper motor draws too many amps
    • Pololu modules have a small SMD potentiometer for adjusting the current. Connect one stepper at a time and adjust the amperage until you're satisfied with the setting.
    • Adjust so the steppers can still hold the torque but don't get too hot. Personally, I go near the amperage specified per coil.


The transistors most likely to fail in a RepRap are the transistors directly connected to the motor. There seem to be three schools of thought in response:

  • make those transistors easy to replace when they inevitably fail, or
  • somehow protect those transistors so they are highly unlikely to fail, even under common fault conditions -- Protected Mosfet, or
  • both.

Modern stepper motor drivers have "thermal shutdown" -- when they sense they are getting too hot, they automatically turn everything off and let everything cool off. That may ruin your plastic print, but at least no permanent damage has been done. (That's not to say that modern stepper drivers can't be permanently destroyed; you're just going to be more clever in how you do it).

In particular, I hear that motor drivers often fail when the motor is disconnected while the power is turned on. ( Troubleshooting#Electrical Problems, Talk:Monotronics, RepRapPro Setting Motor Currents, RAMPS 1.4#Pre-Flight Check, etc.) What exactly is the failure mode? Is there some way to design the motor driver to be immune to such failures? Preferably a way that costs less than simply buying a new $11 "Stepper Motor Driver Carrier" every time I blow one out?

Further reading