Electronic – Drive stepper motor from Raspberry Pi

microcontrollerraspberry pistepper motor

I am looking to drive this stepper motor from the Raspberry Pi. I have successfully followed this tutorial to get the small stepper motor used in the tutorial working correctly. I am using the L293D for the driver.

I tried switching out stepper motors (the smaller for the larger one mentioned at the beginning of this post) since the tutorial only used four wires to control the small stepper motor with the L293D I figured this would work with the larger motor. It did actually move for about 1 second and then it stopped moving now neither the small motor or large motor will function anymore.

I am guessing I burned up the L293D since I believe its only rated for something like 600mA per channel and according to the specs on the larger stepper it uses 1.5A. Is this the most likely cause for neither of them working anymore?

What would be the proper and easiest way to control the larger stepper motor from the Raspberry Pi?

Best Answer

The L293D cannot sustain the 1.5 Amperes per coil that the specified stepper motor needs. While the L293D does specify thermal protection in the datasheet, that is not foolproof. It is a fair bet that the IC has been damaged due to overload.

The other, stronger possibility, is that the back-EMF from the coils each time they are turned off, has damaged the protection diodes of the L293D, subsequently frying the driver circuitry. Using a H-bridge driver for a high current inductive load (the 1.5 Ampere drive coils of the bigger stepper motor) without external protection diodes = silicon suicide - Simply don't do it, no matter what the tutorials say. The internal protection diodes are not designed to dissipate high current transients.


The solution:

  • Instead of the L293D, use two SN754410 ICs connected in parallel, with heat sinks on each, to drive the stepper: Each SN754410 is specified for 1 Ampere per driver line, and they work well in parallel. It is good to stay within about 75% of the rated current of these half-H drivers, so with two of them, a current of 1.5 Amperes per coil will work.
  • Add protection diodes such as 1n5817 Schottky diodes, in reverse polarity, to each of the output lines, thus:

    schematic

simulate this circuit – Schematic created using CircuitLab

  • Note also the 10 uF electrolytic capacitor and the 100 nF capacitor shown between each of the Vcc lines and the ground pins. These decoupling capacitors should be added to your circuit, as close as possible to the respective pins of the IC, to prevent significant noise pulses being injected into the supply lines each time the driver switches the stepper coils on or off. Polarity of the electrolytic capacitor is critical: The negative side goes to the Ground line in each case.
  • Finally, ensure that all of the ground pins are connected together and to the ground of the supply, preferably with thick traces. Those pins serve as both ground return and heat sink paths; Not connecting them reduces the IC's capability to get rid of heat during operation.

A common hobbyist approach for connecting L293D or SN754410 drivers in parallel is to physically stack them one on top of the other, and solder the corresponding pins together. See this page for a description of this strategy:

Stacked H-Bridges

The concern with this approach is that the heat dissipation of the lower IC in the stack will be poor, so further derating of power will be called for - or the lower IC will overheat and die, if the stepper motor application requires constant operation at full load. Therefore this is not recommended if parallel connection is an option.