Stepper motor driver
To make a stepper motor work, you need to use
- a stepper driver chip or
- a microcontroller and, optionally, one or two full h-bridge chips.
- 1 Driving stepper motors
- 2 Open Source Stepper Drivers
- 3 Stepper drivers vs stepper controllers
- 4 PWM and Stepper Drivers
- 5 Stepper driver chips
- 6 Stepper drivers
- 7 Mid-Band Resonance Compensation
- 8 Troubleshooting
- 9 Further reading
Driving stepper motors
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.
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
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
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 (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|
|???||"stepper driver and controller 5041"||1.1 A (?)||?||drives the Z axis in the T-Bone.|
|??? + Trinamic||4361 motion controller + Trinamic TMC2660 stepper driver||2.6 A (?)||?||drives the X, Y, E axis in the T-Bone.|
|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.|
|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 electronics plus the open source stepper driver for open source ecology. 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.|
|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.
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.
|Stepper Motor Driver 2.3 (using A3982)||Yes||US||2 A||1/2||Listed for comparison.|
|RobotDigg A4988 Stepper Driver||Yes||CN||2 A||1/16||with small piece heat sink, discount for 20pcs and above|
|EasyDriver (using A3967)||Yes||US||0.75 A||1/8||Slightly underpowered compared to other drivers, at only 750 mA/phase. bothacker uses EasyDriver, and reports that it has plenty sufficient power for Mendel. Recommended.|
|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. Recommended.|
|... ay.com/autohec 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||
|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)|
|... ay.com/?_from=R40&_trksid=p3907.m38.l1313&_nkw=4+axis+TB6560&_sacat=See-All-Categories 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|
|grblshield||No||US||2.5||1/8||3 axis controller plugs onto Arduino Uno or similar|
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.
- 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.
stepper motor driver
You do not need a "controller" to drive a stepper motor. All you need is a couple of transistors.
I've been driving these things just fine using an opto-isolator and a power transistor hooked up directly to my printer port since way back in 1986, and it still works today.
Personally - I think the idea of using a stepper driver is really silly. You don't need 2 computers and two sets of everything just to energize coils in sequneces! Worse - the fact that you've stuck another gadget between your computer and the stepper means that you've doubled the complexity of your computer code, and halved the useful info you can get back all at once. Yes - it's 400% sillier to use a driver, than to simply drive it direct from your PC!
One major thing lacking from drivers, is the PCs ability to measure the current the stepper is drawing. Without the driver, it's a simple matter to let the PC get this extra bit of info, and then your code can calculate the force that your steppers are experiencing - so you could for example detect a stall, or make them go faster when they're under less load, etc etc.
Just my 2 cents: You have no idea of the physics behind a motor and whats going on inside a stepper driver. Of course you are able to make a motor turn by just using some transistors and portpins. But if you want to get high performace out of it, this is the wrong way. And the complexity of your software won't increase when using a driver with a simple step and direction interface. So what's the problem?
Regards Thorsten Ostermann
The anonymous poster is right -- driving steppers using an opto-isolator and a few transistors plugged into a Centronics style printer port works fine -- and is the most common way of using EMC including EMCRepRap. Alas, it's getting harder and harder to find a computer with such a port. Those of us without such a port are forced to use unnecessarily complicated arrangements. --DavidCary 18:22, 28 September 2012 (UTC)
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
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?
- stepper motor
- Alternative electronics has some design considerations for people designing stepper motor controllers and other reprap electronics.
- The Open Circuits wiki "motor driver" article has a long list of open-source stepper motor drivers, and related information.
- The Reprapped Development Board (RDB) series of pages -- in particular, RDB STP and RDB-STP-001-G-DIY -- has some ideas about making motor drivers that are optimized for DIY, for flexibility and for upgrade-ability.
- StepperDriverWithUDN2559 FIXME: add that chip to the above list.