Tuesday, July 28, 2009

DC Motor-Driver H-Bridge Circuit

DC Motor-Driver H-Bridge Circuit

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' on classic schematics. 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:
  • TTL/CMOS compatible Microchip or Maxim 4427A or 4424 MOSFET driver chips that protect the logic chips, isolate electrical noise, and prevent potential short-circuits inherently possible in a discrete H-bridge.
  • Schottky diodes to protect against overvoltage or undervoltage from the motor.
  • Capacitors to reduce electrical noise and provide spike power to the driver chips.
  • Pull-up resistors that prevent unwanted motor movement while the microcontroller powers up or powers down.
A diode-less version of this circuit successfully drove Bugdozer to mini-sumo victory. The more robust (diode protected) version actually illustrated below is from Sweet, the line-following robot.


Hmm. It doesn't look like the letter 'H'.
(Note: An improved version of this circuit appears on Page 197 - Figure 10-18 of Intermediate Robot Building.)

R1 and R2:
Two pull-up resistors (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 drop 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:
TC4424 dual MOSFET transistor driver chip. (The MAX4427 and TC4427A is the same but with a lower amperage rating.) The DIP part can be purchased at DigiKey as part #TC4424CPA.

WARNING:
Direct motor driving with this chip is only possible for motors that draw less than 100 mA (4427) to 150 mA (4424) 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. Check out Figure 10-13 and Figure 10-15 on pages 186 and 187 of Intermediate Robot Building. 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 and freedom from noise is desired.

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. (See Figure 9-14 on page 158 of Intermediate Robot Building.) 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. Therefore, it isn't possible to continuously run the chip at both the maximum voltage (22 V) and maximum amperage (3 A) rating. That would result in 66 watts of power usage. (That's 100x the maximum allowed.)


From: Paul Jurczak
Sent: Monday, March 12, 2001 10:59 AM
Subject: DC Motor-Driver H-Bridge Circuit

The actual DC power losses in the H-bridge would be:
I2 * (Rl + Rh)
= (3 A * 3 A) * (2.8 ohm + 2.5 ohm) = 47.7 W typical
and
= (3 A * 3 A) * (5 ohm + 5 ohm) = 90 W maximum

Which still is more than enough to melt this IC.

Paul.

I'm sincerely grateful for the feedback.


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.

D1 and D3:
Schottky small-signal diodes.

I couldn't find any! So, I used 5817 Schottky diodes instead.

The key factors in substitution are:
  • Are the diodes rated to turn on with less voltage than the TC4424's internal transistor base voltage? (600 millivolts)
  • Are the diodes rated to handle the maximum reverse voltage? (22 volts)
  • Are the diodes rated to handle the maximum current? (3 amps)
In the case of the 5817s, the datasheets answers are:
  • Yes. (400 millivolts or less)
  • Nearly. (20 volts -- so this is the circuit's new voltage maximum)
  • Yes, peak (25 amps)
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.


D2 and D4:
Schottky small-signal diodes.

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 short power supplies (reset!) and can even destroy the driver chips.


Actual implementation of motor driver

Despite what may seem complicated at first, the above photograph 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 for a movie of the H-bridge in action
(Click the picture above for a movie)

  • Pressing the right-side button makes the motor turn counter-clockwise and lights the LED green.
  • Pressing the left-side button makes the motor turn clockwise and lights the LED red.
  • Pressing both the buttons turns on the brakes (stopping the motor) and turns off the LED.
  • Pressing the brakes quickly enough provides variable speed (between 0% and 100%).


No comments:

Post a Comment