5

I bought a L293D motor driver shield and have used it with a pre-made sketch for driving a pair of stepper motors, but I'm not familiar with its capabilities.

The sketch I've used so far doesn't use microstepping when it's set up for this shield (though it does use it with the Adafruit shield).

I've done some searching, and it's not clear if the L293D chips on the shield can do microstepping, and if so, how.

Are L293D chips (and thus the motor driver shield that uses them) capable of microstepping? If so, how can I add this capability into my sketch?

1

2 Answers 2

4

It would be more accurate to say that it can be used as part of a microstepping system, though it's probably not a good choice for any use today.

The L293D is merely an (effectively obsolete implementation of an) H-bridge, not a stepper motor sequencer, hence it is no more capable of autonomously driving a motor in full or half step mode than it is of microstepping - it can only do any of these when it is controlled by a sequencer, such as an L297 chip, or software running on an Arduino's processor.

Microstepping requires partially actuating the coils to interpolate between the angular positions which would be achieved by activating each in turn fully. It can be thought of as a proportional extension of how half-stepping uses actuating both coils at the same power to achieve a halfway in between position, only now the coils are actuated at different power levels to achieve finer gradations of position, though achieving accurate interpolation requires care as the relationship is not linear.

Modern power electronics no longer use variable analog drivers, as these convert the unused power to heat. Instead, the goal is to use switches which come as close as possible to only ever being fully on or fully off. Reduced driver power is achieved by pulse width modulating the switch, varying the average amount of power delivered to the load over a short period of time. In a stepper motor setting, this on-off modulation can be done to achieve microstepping and or also to achieve current regulation when a many-times-rated-voltage supply is used to allow overcoming winding inductance at high step rates.

The L293D (and its larger cousin the L298) are quite inefficient bipolar transistor bridges (they aren't very good switches compared to MOSFETs), and should probably not be chosen for new designs today. They are, however, capable of being used to microstep a motor when actuated by a sequencer which pulse width modulates the phase signals. Adafruit, who appear to be the original creators of this shield design, have in fact published microstepping driver code for their L293D board on github.

https://github.com/adafruit/Adafruit-Motor-Shield-library

Given that the ebay seller you link to as the source of the board is using Adafruit's own schematic on their product page, it's a bit unclear why your software is differentiating between this board vs an Adafruit one, unless by the the Adafruit board you mean their V2 shield. The V2 design uses a more efficient TB6612FNG FET bridge, but of more relevance to microstepping offloads the sequencing task from Arduino software to a PCA9685 chip which is apparently capable of microstepping (as well as simpler modes) by itself. Depending on the computational load and/or your level of determination, you may be able to get the ATmega microstepping the L293D in the context of your overall project.

1

Not directly. The L293D is a digital H-bridge chip. L293 series devices allow you to supply enough power for small motors, and the "D" model has internal protection diodes. There are other ICs and breakout boards that are designed specifically for microstepping. Here are a few options...

  • The SparkFun EasyDriver ($14.95) will probably be the quickest solution.
  • There are a variety of stepper driver ICs on the market with a wide range of power ratings. For instance, ST makes the L6219 ($4.86) and ON also makes several versions of the LB1847 ($4.19-$6.90). TI also makes a few.

Datasheets will typically say whether a driver is capable of microstepping at the beginning. Just make sure the driver you choose is capable of handling the stall current of your stepper.

Are your steppers unipolar (6+ wires) or bipolar (4 wires)? That may make a difference in how you wire them, although some unipolar motors can be driven as if they were bipolar.

6
  • No. There's a fundamental misunderstanding in this answer. Microstepping is not practically implemented via analog circuitry, rather it is done in the time domain with switches that are always either fully on (to the best of their ability) or fully off. As the L293 is merely a bridge, with no chopping or other current control of its own, the ability to microstep - or not - depends on what is driving it. That said, the L293, like any bipolar driver has internal losses that make it a severely obsolete part! Mar 27, 2016 at 1:39
  • @ChrisStratton, I am fairly new to SE. Can you recommend changes to improve the answer? From my understanding, a microstepper approximates two out-of-phase sinusoids. With that assumption, given a square wave generated from an L293D, it could be theoretically possible to build an analog circuit that would convert a square wave to a sine wave. The problem is that it would be difficult to create such a circuit that would work correctly at more than one frequency. Mar 27, 2016 at 4:17
  • No. Do not try to convert the digital output to analog - that way only leads to losses. The key concept to grasp is that microstepping is ultimately about a time average over short periods of time. It does not have to be achieved by an analog circuit at all. Rather it can be (and usually is) done by purely digital means, modulating the on-time of a purely on/off switching device. Anything other than an on/off switch converts unacceptable amounts of power to heat when it is "partially on" - but a time average of on and off does not, except in the switching transition itself. Mar 27, 2016 at 4:23
  • 1
    Unclear. The L293D is a rather disappointing device, but the problem it (sort of) solves is different part of the system than where micro stepping would, or would not, be implemented. It is a bridge, while microstepping is implemented in the bridge controller (which is probably also the current regulating chopper). Mar 27, 2016 at 4:50
  • 1
    Most of the micro-stepping circuits I am familiar with are hybrids (not purely digital). The current from each h-bridge is sensed (usually with a current-sensing resistor) and fed back to an analog comparator. This is compared to the output of a DAC (digital to analog converter) which outputs a voltage proportional to the desired current for the coil for the micro-step. The comparator output normally resets a flip-flop which is part of the digital timing circuit for the chopper-drive. The analog input used to set the drive-current is often the reference voltage for the DACs.
    – Tut
    Mar 28, 2016 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.