Physical motion of some form helps differentiate a robot from a computer. It would be nice if a motor could be attached directly to a chip that controlled the movement. But, most chips can’t pass enough current or voltage to spin a motor. Also, motors tend to be electrically noisy (spikes) and can slam power back into the control lines when the motor direction or speed is changed.
Specialized circuits (motor drivers) have been developed to supply motors with power and to isolate the other ICs from electrical problems. These circuits can be designed such that they can be completely separate boards, reusable from project to project.
A very popular circuit for driving DC motors (ordinary or gearhead) is called an H-bridge. It’s called that because it looks like the capital letter 'H' when viewed on a discrete schematic. The great ability of an H-bridge circuit is that the motor can be driven forward or backward at any speed, optionally using a completely independent power source.
An H-bridge design can be really simple for prototyping or really extravagant for added protection and isolation. An H-bridge can be implemented with various kinds of components (common bipolar transistors, FET transistors, MOSFET transistors, power MOSFETs, or even chips).
The example provided on this page features:
R1 and R2 are pull-up resistors. These can be any value from 10 kilohm to 100 kilohm.
These make sure the inputs are both on unless a signal from the microcontroller tells one or the other to turn off. With both on or both off, the motor doesn’t spin because there’s no voltage difference between them.
Think of these as default values. Unless a different value is specified, the lines are pulled up. This means the circuit can come loose or be disconnected completely and the motor won’t spin or stutter.
Technically, R1 and R2 could be eliminated, although then the motors are likely to jerk when the microcontroller powers up or powers down.
IC1 is a dual MOSFET transistor driver chip. Anything from the TC4424 family will do. The MAX4427 and TC4427A is the same but with a lower amperage rating. The IXDN404 has the highest amperage rating (best choice). The DIP part can be purchased at DigiKey or Mouser as part #IXDN404PI.
Direct motor driving with this chip is only possible for motors that draw less than 100 mA (TC4427A), 150 mA (TC4424), or 340 mA (IXDN404) under load. To determine if your motors qualify, use a multimeter to measure how much current your motor uses under load (for example, when actually driving your robot around) when the motors are connected directly to the battery (not through these chips).
This chip is not really supposed to drive a motor by itself. If you find the chip gets very hot and the motor doesn’t spin (or barely spins or stalls when loaded) then you need to have the chip drive some real power MOSFETs like it is supposed to. It’s not that much more difficult and it really makes a huge difference in performance.
This chip provides two independent inputs that are compatible with CMOS or TTL chips. This circuit design uses IN A to vary power (on, off, or pulsed in-between) and IN B to determine direction.
OUT A follows the IN A signal but uses the full voltage from the power source, not the tiny voltage from the input signal itself. OUT B follows IN B in the same way.
For example, if IN A is turned on completely (2.4 volts or better) and IN B is turned off completely (0.8 volts or less) then OUT A turns on completely (up to 22 volts) and OUT B turns off completely (GND). The motor gets 22 volts.
This chip is constructed to protect the static sensitive MOSFETs, but also to protect the input sources from current being jammed back by the motors. Optoisolator ICs could be used at the inputs if greater protection, freedom from noise, or electrically-isolated operation is desired. However, I’ve never had to resort to optoisolators.
Normally four transistors are needed in an H-bridge. Each transistor forms a corner in the letter 'H', with the motor being the bar in the middle.
In this design, each output of the chip forms a complete vertical side of the letter 'H', with the motor still being in the middle. Because a side is now a single output, short-circuits can’t form from the top of a side to the bottom of a side. No matter what the inputs, all power must travel from one side to the other -- through the motor.
A mechanical switch, relay, or logical gate could be used to turn the inputs on and off. It would work just fine at providing no movement (on/on or off/off), forward movement (on/off), or reverse movement (off/on). To provide power levels in between (like 50%), rapid pulses of on or off can be provided by pulse-width modulation using a chip or timer.
An important note regarding current rating: The plastic DIP package can only dissipate enough heat when the power usage is below 730 milliwatts. For example, it isn’t possible to continuously run the TC4424 chip at both its absolute maximum voltage (22 V) and absolute maximum amperage (3 A) rating. That would result in 66 watts of power usage. (That’s almost 100x the maximum allowed.)
I’m sincerely grateful for the feedback.
Paul is correctly pointing out that the chip only needs to dissipate the portion of power used in the chip’s resistance.
For current to flow, the chip must have one gate high and one gate low. Therefore, Paul is adding the typical high and low resistance (from the 4427 datasheets) together to calculate the total amount of resistance the chip causes.
When a moving motor is added to the circuit, the motor uses up some (hopefully most) of the power. Just dive for that robot if the motors stall!
In summary, the chip can’t run at maximum volts and maximum amps because most of the 66 watts (47 watts typical) would need to be dissipated by the chip. (See the temperature of a similar motor driver chip heat up and cool down.)
My original source had D1 and D3 listed as small-signal diodes. I couldn’t find any at the time, so, I used 1N5817 Schottky diodes instead. It turns out that Schottky diodes are much better for motor circuts because they react more quickly.
The key factors in substitution are:
In the case of the 5817s, the datasheets answers are:
When a motor accelerates or decelerates for any reason (signal, load, or friction), there is reluctance for the electric field present in the motor coils to change. More properly, the changing field induces power. This “refunded” power can jam back into the chips.
D1 and D3 protect the chips from overvoltage by turning on when more voltage is coming from the motor than is coming from the batteries. The batteries absorb the power.
The turn-on rating of the diode must be lower than the turn-on rating of the chip, or else the diode won’t turn on early enough to protect the chip.
Because the diode is installed in “reverse”, the power can’t flow from the batteries to the motors. If the diode was installed differently, power would immediately flow to the motors, bypassing the chip outputs (or worse, short-circuiting through the chip).
By the way, this arrangement is why the reverse or breakdown voltage of the diodes is important. If the reverse voltage rating was less than the full battery voltage, the battery would break down the reversed diode and just shoot through. In this case, the 1N5817 has a 20 V reverse breakdown voltage, so it can be used with batteries and power supplies up to this voltage.
D2 and D4 are also Schottky diodes; the same as D1 and D3.
D2 and D4 protect the chips from undervoltage (less than ground) by turning on when the voltage in the motor is below GND. Once again, the batteries take care of the problem, rather than power flowing backwards from the chip.
D1 through D4 could be eliminated. In fact, Bugdozer runs without the diodes. However, parasitic voltages can and do temporarily overwhelm voltage regulators (reset!) and can even destroy the driver chips.
Despite what may seem complicated at first, the photograph below includes added features such as an LP2954 5V voltage regulator, a bicolor LED, and two switches for testing.
One H-bridge drives one motor. For a common two-wheeled robot, obviously two copies of the H-bridge circuit are needed.
(Click the picture above for a movie)
Where do you go from here?
I originally wrote this web page in December 2000. I’ve received a lot of email regarding this subject, especially from people seeking to drive larger motors or achieve better performance. My friend, Don Kerste, recently gave me grief for still using an IXDN404 chip in my newer robots.
If you are making a small robot or device that uses a miniature gearmotor that requires less than 100 mA continuously when running, then this motor driver with a 4424, 4427, or IXDN404 chip without diodes is perfectly adequate. If you need more current, up to a total of 340 mA, make sure to use the IXDN404 chip and go ahead and add the 1N5817 diodes.
If you need even more current, but you are locked into using this chip, then you can obtain almost 2/3 of an amp (~680 mA) continuously by stacking two chips together with copper foil in between. This allows the chips to dissipate heat.
Soldering two identical IXDN404PI motor driver DIP chips together with copper foil for a cheap heatsink.
Suppose this is still not enough current. In other words, the chip is heating up too much or the motor isn’t turning. Not every motor driver is appropriate for every situation. This is a simple, low-cost, low-power motor driver.
If you have a microcontroller that can control a more complex circuit, you can build a transistor based H-bridge. Or, at the opposite end of the spectrum, if you are going to control the motor manually, consider a simple manual motor direction switch.
There are much more powerful solutions available if you need something that can electronically drive motors with multiple amps of current, can control all of the motor states (forward, reverse, brake, and coast), or if you really want to understand how motor driver circuits work. I dedicate nearly 70 pages to motor drivers in my second book, Intermediate Robot Building. The book includes many more schematics, efficiency results for other driver chips, and even a speed-controllable power MOSFET driver.