CustomMotorDriver

From Simreal

Jump to: navigation, search

robots.gif


This is a chapter that was cut from Applied Robotics 2 because of space issues. It discusses motor control issues in general and then moves on to build a 5-amp motor driver. The principles involved can be applied to much larger motor controllers.

This is a very long page that should probably be broken up into smaller pages.


Though it is probably cheaper and easier to use the readily available Electronic Speed Control (ESC) systems on the market, a home-built ESC gives us (in theory) more control over the specifications. We can control the power rating (within reason), the PWM frequency, braking and regeneration features, acceleration curves, and other fine details. Also, many microcontrollers provide a nice PWM signal generated by hardware timers while the R/C control signal typically has to be created in software, using precious MCU cycles.

Before we dive into circuits, it is important to know what we are doing - and answer a few important design questions.

Control Quadrants

Motor Control Quadrants


There are two variables in the motor control state space - the actual motion of the motor, and the direction of the applied torque (from power applied to the motor).

When the motor is stopped or moving forward and the power across the motor is in the forward direction (forward torque), then the control is said to be in Quadrant 1 (Q1), forward acceleration. A motor controller that only supports Q1 may consist of a single switch (transistor, IGBT, or MOSFET) and a clamp diode to protect it.

When the motor is stopped or moving in reverse and the torque is in reverse, it is being driven in Quadrant 3 (Q3), reverse acceleration. A simple two-quadrant motor controller will operate in Q1 and Q3 and will consist of four switches in an H-Bridge configuration. This will be explored in more detail later.

The motor moving forward with a reverse applied torque puts the control into Quadrant 2, reverse braking. Reverse motor motion with forward torque is Quadrant 4, forward braking. Motor controllers that support the active braking of Q2 and Q4 need to handle much higher current loads since they are fighting the back EMF of the motor.

IGBT versus MOSFET

Although you can drive small motors directly from digital buffers, op-amps, or transistors, larger motors are more efficiently driven by IGBT (Insulated Gate Bipolar Transistor) or MOSFET (Metal Oxide Semiconductor, Field Effect Transistor) technology.

Until the MOSFET reached the market in the '1970s, the bipolar transistor was the only real choice for power applications. Unfortunately, the transistor requires a relatively large base current (relative to the switched current), has a fairly slow turn-off time, and is prone to thermal runaway (due to its negative temperature coefficient).

MOSFETs are based on the field-effect transistor. They are voltage controlled instead of current controlled and look like a capacitor to their controlling circuit. MOSFETs have a faster turn-off time, low on-resistance, and a positive temperature coefficient eliminating thermal runaway (and making them easier to wire in parallel).

The IGBT has most of the characteristics of the bipolar transistor. With their negative thermal coefficient IGBTs are harder to wire in parallel than MOSFETs, but they are capable of handling larger currents and voltages than MOSFETs.

Though IGBTs and MOSFETs are very similar in operation, IGBTs are the preferred choice for use above 1,000 volts, above 5kW output power, or for low-frequency operation. MOSFETs are generally preferred for high-frequency operation, voltages below 250 volts, or output power below 500 watts. Then there is the grey area where either device may work. Of course, MOSFETs continue to improve as a technology, reaching into the higher power areas and infringing into more IGBT territory.

This discussion uses MOSFET technology. I've found MOSFETs to be reliable and easy to use.

MOSFET Characteristics

N-channel vs. P-Channel

MOSFETs come in two flavors: P-Channel and N-Channel. Within these flavors you can select the ìstandardî MOSFET with a 10-volt turn-on gate voltage, or the "digital" MOSFETs with a 5-volt on voltage.

MOSFETS

Like NPN and PNP transistors, the N-channel and P-channel MOSFETs are similar in internal structure but with opposite turn-on characteristics.

An N-channel MOSFET begins to turn on when the gate voltage is raised above the source voltage (with current flow from positive drain to source). As this voltage, VGS, approaches the full-on level defined by VGS(on), the resistance between the drain and source drops to the minimum on-resistance defined by RDS(on).

A P-channel MOSFET turns on as the gate voltage is pulled below the source voltage (with current flow from positive source to drain, backwards from the N-channel device). The same changing control signal, when applied to both a P-channel and N-channel MOSFET, will have the effect of transferring conductance from one device to the other.

Due to the construction method of power MOSFETs they will typically have a "body" diode between the source and drain. This provides a convenient reverse diode, but before you rely on it in your circuits be sure it is featured in your particular MOSFET. These body diodes can also be fairly slow.

On paper, P-channel MOSFETs appear to be perfect for part of an H-bridge controller. There are difficulties in driving an N-channel MOSFET on the high-side of the load that the P-channel MOSFET eliminates. Unfortunately, P-channel MOSFETs tend to have lower efficiencies (a higher RDS(on)), a larger gate capacitance, and lower power levels, and can generally cost more than their N-channel brethren. So, generally, N-channel MOSFETs are preferable when possible.

Ratings

The MOSFET is a complex device, with many interactions between its elements. A few of the more salient ratings are discussed here, as well as what they mean to the circuit designer. These are all discussed relative to N-channel MOSFETs.

ID Drain Current
Specified at different voltages and temperatures, this is the maximum

continuous current flow the MOSFET can handle. There will also be a rating for the maximum pulsed drain current IDM for brief transients, that can be significantly higher (e.g. ten times ID), but limited to very short durations.

VGS Gate to Source Voltage
The maximum rating for the gate voltage, relative to the source. More useful

are VGS(th) and VGS(on), the operating range for the gate voltage.

VGS(th) Gate to Source Threshold Voltage
The minimum gate voltage relative to the source needed to start a drain to

source current flow IDS of about 250μA. Common values are 2 to 4 volts for high-voltage devices, and 1 to 2 volts for digital MOSFETs, though the trend is towards a lower VGS(th).

VGS(on) Gate to Source Fully-On Voltage
The gate voltage that puts the MOSFET into its maximally conductive state.

This is typically 10 volts for high-voltage MOSFETs, and 4 volts for digital devices.

dv/dt Peak Diode Recovery
This is the maximum rate of change of the drain-source voltage. If this rate

is exceeded, the capacitive link between the drain and gate can cause the voltage at the gate to exceed VGS(th) and cause the MOSFET to conduct. This coupling is also known as the "Miller Effect."
The gate to drain coupling can be a cause of concern in a system with multiple MOSFETs (such as in an H-bridge controller). When one MOSFET in the bridge turns on, the drain of the opposing MOSFET is rapidly pulled to the opposite voltage rail. If that change is too rapid it can turn on that MOSFET, causing a short circuit through the two MOSFETs and possibly destroying the circuit. A small resistor (typically 10Ω) on the MOSFET gates can slow the switching time, minimizing the possibility of dv/dt shoot-through.

VBR Breakdown Voltage
Also tagged "BV." The voltage level above which the MOSFET shorts out and

self-destructs. A hidden source of breakdown problems comes from static electricity, which can perforate the gate oxides during handling, permanently damaging the MOSFET.

RDS(on) Drain to Source Resistance at VG = VGS(on)
The minimum resistance of the MOSFET. This also determines the minimum power

wasted by the MOSFET, and hence the level of waste heat it will generate. Of course, higher resistances are seen at VGS(th) < VGS < VGS(on), so the actual inefficiency of the MOSFET also depends on the switching speed and frequency.

gfs Forward Transconductance
This is the ratio of output current to input voltage,

gfs = Iout / Vin. gfs is typically defined in siemens (S), which is a unit of conductance; S = 1/Ω, sometimes referred to as a ìmhoî (the inverse of an ohm). For the MOSFET, roughly, it is the measure of its gate to drain gain.

QG Total Gate Charge
The total gate charge for the device. Gate Charge is a convenient alternative

to specifying the variety of capacitances in the device, and provides a simple parameter for the designer to work with (see below).

QGS Gate to Source Charge
Gate to Source component of the total gate charge.
QGD Gate to Drain Charge
Gate to Drain component of the total gate charge. This is also known as the

"Miller charge," for historical reasons. John M. Miller studied the capacitive coupling between the output and input of amplifiers in the context of vacuum tube triodes. This feedback creates a virtual capacitance that is a non-linear function of the voltage gain.

IS (Body Diode) Source Current
Continuous current sustainable by the body diode. ISM is the

intermittent current capability of the body diode.

VSD (Body Diode) Source to Drain Forward Voltage Drop
The voltage drop across the diode.
trr Reverse Recovery Time
The time it takes the body diode to stop conducting. This is an important

factor when calculating delays between legs of an H-Bridge, to avoid shoot-through (e.g. a short circuit between two legs of the bridge).

More on Gate Charge

International Rectifier is a big proponent of the Gate Charge parameter, Q (in C or "Charge" units). Q is an aggregate value that is defined as the charge that must be supplied to switch the MOSFET (or at least, swing the gate to a given voltage).

Given its Q value it is an easy task to calculate the drive circuit for the MOSEFET. Q is a factor of time and current. A device with a gate charge of 1 Q will be switched in 1 second by 1 amp of current. More typically, Q is in the nC range.

For example, a MOSFET with a Q = 20nC can be turned on in 20μS by a 1mA current (or in 20nS by 1A).

Resistors in series with the gate can serve to limit the current flow and artificially reduce the switching time, as mentioned under dv/dv, Peak Diode Recovery, above.

Current Sensing and Current Limiting

A stalled motor can be a huge current pig - so much so, sometimes, that it can melt its internal components and die. The very low RDS(on) of modern MOSFETs does little to protect either themselves or the motor from high-current overloads.

It can be valuable for the control circuit to watch the current draw of its motors as they operate. Under no-load steady-state (running) conditions, motors draw very little current. However, the more force the motor opposes, the more current it will try to draw to counter-act it. Watching the current draw gives a rough sense of what the motor is seeing in its environment.

Current Sensing

Based on Kirchoff's current law, we know that the current flow through a series circuit is the same everywhere in that circuit. Ohm's law tells us that the current that flows through a device is proportional to both the voltage across the device and its resistance:

I = V / R

So if we put a resistor with a known value R in series with a circuit and measure the voltage drop V across it, we know the current that is flowing through the resistor, and hence, the load that is in series with the resistor.

Current Sensing Resistor

This schematic shows the current sensing resistor in action. ìLoadî is the variable-current circuit or device we are trying to sneek a peek into. "Sense" is a small resistor of a stable and known value, such as a 1% .01Ω resistor. Such a small resistance will not affect the load device significantly; .01Ω at 5-volts will limit current flow to 500 amps. At 10 amps load, it will only dissipate:

P = VI

V = IR

P = I2R

P=100*0.01

P = 1

1 watt of power. The problem isn't in power dissipation through the resistor, but what will happen to its 18 gauge leads when you try to run 10 amps through them.

The op-amp is then attached to both sides of the resistor and the values of R1=R2 and R3=R4 are chosen to give a decent amplification. The output will be an analog voltage that is proportional to the current drawn by the load.

As an example, say we want to watch the current draw of a 5-volt motor that could draw up to 5 amps of current. At 5 amps, the voltage drop across the sense resistor will be 5 * 0.01 = 0.05 volts. Tiny.

To bring this low voltage into the useful range of an A/D converter, we need to amplify it by a factor of, say, 100.

Resistors R1 and R2 are chosen arbitrarily to be 10K. Then, to get 100x a mplification R3 = R4 = 1M.

This level of amplification is possible with a single input amplifier, but you may also want to consider a three op-amp instrumentation amplifier circuit for enhanced stability and range.

You may also want to provide a bit of a margin for error by reducing the amplification a bit.

Another example: Given a 12-volt circuit with a 20-amp expected maximum draw. The voltage across the sense resistor may rise to 0.2 volts. To convert to full-range will require a 25-times amplification, or R3 = R4 = 250K. A 20x amplifier may also work with R3 = R4 = 200K, giving some margin.

Current Limiting

The output of a current sensor could be fed to one side of a comparator, with the other side being set by a fixed (or variable) voltage reference. When the current draw rises above acceptable limits, the comparator's output can be used to turn off the circuit.

PWM Current Limiter

On a motor controller, this current limit can be applied on a pulse-by-pulse basis by a circuit like the one shown above.

Instead of a linear amplifier, a comparator is used, with a fixed voltage giving the overload set-point. The set-point could be set by a potentiometer, a fixed voltage divider, or a voltage reference. It may be necessary, depending on your situation, to keep the sense amplifier in the loop before the comparator, depending on the size of your sense resistor, the current you are measuring, and other factors.

Current Limiter in Operation

The load (e.g. the motor driver) is controlled by a PWM signal from whatever control logic. Instead of going directly to the controller, it is combined with the overload signal from the comparator.

If the current draw of the motor goes too high, the comparator gives a low output (since the current signal is fed to the subtracting side of the comparator). This turns off the PWM pulse until the current draw subsides to a safe level.

The overload signal could also be tapped and fed to a supervisory circuit, to let it know that something has gone wrong. If the current sensing op-amp was included, its signal could be fed to the supervisory circuit as well, so the current could be monitored in addition to the reflexive turn-off circuit downstream.

Switching an Inductive Load

Sidebar: Impedence

An aside. Ohm's Law generalizes across resistors, capacitors, and inductors if these are defined in terms of Impedence "Z".

I = V/Z

V = IZ

Of course, we need to define Z in terms of R, C, and L:

ZR = R

ZC = -j / ωC = 1 / jωC
ZL = jωL

Where:

ω = 2πf

j = √-1

And f is the frequency of the circuit. Inductors and Capacitors are frequency-dependent resistors, with their current and voltage out of phase by 90 degrees.

This is why I normally stick to digital electronics.

When you pulse current through a resistive load, like a light-bulb, it essentially just blinks on and off, (or gets dimmer, depending on the switching frequency).

When you pulse current through an inductive load, like a motor, the behavior is a little more complex, as was discussed in the Chapter 1 section Robot Motors. Inductors are a lot like capacitors - and inductors and capacitors are both rather a lot unlike resistors.

In a resistor, the current is proportional to the voltage and resistance:

I = V/R

In a capacitor, the current is proportional to the rate of change of the voltage:

I = C * dV/dt

If you change the voltage across a 1-farad capacitor by 1 volt per second, the current flow is 1 amp. Conversely, supplying one 1 amp of constant current to a capacitor will raise its voltage by 1 volt per second.

Unlike the resistor, capacitors (in their pure, theoretical form) do not dissipate power. The power associated with a capacitor (V*I) is not turned into heat, but is stored as energy in the capacitor's internal electric field. This power is reclaimed during the discharge of the capacitor.

An inductor is the inverse of a capacitor. The voltage across an inductor is proportional to the rate of change of current:

V = L * dI/dt

If you change the current flow through a 1 henry inductor by 1 amp per second, the voltage across the inductor will be 1 volt. Conversely, supplying a constant 1 volt across a 1 henry inductor will cause an increase of 1 amp per second current flow.

Like the capacitor, inductors do not dissipate their power as heat (in theory). The inductor stores the energy in its magnetic field. The energy is returned when you interrupt the current flow to the inductor.

Switched Inductor

Returning again to the topic of switching current through an inductor, look at the simple schematic to the right. On the rising edge of the control signal, the MOSFET turns on and suddenly a voltage difference appears across the inductor and current starts to flow. The current will increase at a rate determined by the inductance of L1 and any additional resistance R1 in the load:

L dIR/dt + RIR = VCC

Eventually, the voltage across the inductor and the current flow through it will stabilize.

When the switch turns off, the current through the inductor will continue to try and flow as the magnetic field collapses back through the inductor, acting like a generator. With nowhere for the current to flow to, the voltage instead rises rapidly until the current can flowÖ and this usually means burning out your MOSFET. The faster the switch turns off, the larger this voltage spike can be.

Inductor with Freewheeling Diode

This schematic shows the inductor with a ìfreewheelingî protection diode in the circuit. When the MOSFET is turned off, the voltage will rise until the diode becomes forward biased and the current flow is commutated, or (diverted), away from the MOSFET and through the diode. The current through the inductor will then decay:

L dIR/dt = -RIR

The diode must be large enough to carry the entire current flow normally running through the inductor, but only for a brief period of time. Depending on the frequency of the PWM signal controlling the switch, the current across the inductor may never actually drop to zero.

For AC circuits, where the current may flow through the inductor in either direction, the diode protection won't work. Instead, an RC snubber is used to suppress the inductive spike.

Inductor with RC Snubber

To say you need an RC snubber on your circuit, and to determine the actual R and C values, are very different tasks. Snubber design is complex and involves the capacitance and inductance of everything in the power loop, the switching frequency, the frequency of any ringing in the circuit, and probably the phase of the moon as well.

A simple-minded approach is to put a 0.1μf capacitor with a 100Ω resistor across the inductor, and tune it from there. Of course, the larger the current you are trying to switch, the more important your snubber design becomes.

The RC snubber may also be placed across the MOSFET, to conduct the spike across it to ground. Another switch-centric snubber design puts a zener diode across the MOSFET, with a voltage above the operating level of the load but below the breakdown voltage of the MOSFET. As the inductor builds up voltage, it eventually goes into reverse conduction through the zener diode.

H-Bridge

In order to turn a motor both directions, it is necessary to be able to run current through it in both directions. The most common way to do this is with an H-bridge controller, which basically consists of four switches arrayed around the motor. The name comes from the circuit's shape - the four switches bridged by the motor look like an 'H'.

Control of the motor comes from different combinations of switches being turned on. Note that the MOSFET transistor prefix ìQî is not to be confused with the motor control quadrant ìQî (or the Star Trek character Q, for that matter).

H-Bridge Structure
Switches ON Action
Q1 + Q4 Forward current
Q3 + Q2 Reverse current
Q1 + Q2 Battery shorts, MOSFETs explode
Q3 + Q4 MOSFETs explode
Q1 + Q3 Braking (at supply)
Q2 + Q4 Braking (at ground)

Note that the body diodes in the MOSFETs are an integral part of the H-Bridge system. If your MOSFET does not have body diodes, or they are insufficient to the task, add external diodes. The circuit must be protected.

Let's look at the dynamics of this circuit and its interaction with the motor and the motor's back-EMF and inductance.

In the Beginning

All switches are off, the motor is stopped.

Note that the following discussion can be reversed (substituting Q3 for Q1, and Q2 for Q4) with no effect on meaning. The only difference is the direction of motor rotation.

Turn on Q1 and Q4

Forward Drive

Initially, the motor is stopped and the inductor is discharged. With the application of power, everything slowly winds up as the inductor's current ramps up and the motor begins spinning.

Initially, the power consumption is high since the motor is generating no back EMF. In a large motor, with low internal resistance, the inrush current could actually be large enough to damage the control circuitry if no additional current limiting is provided.

As the motor reaches the steady state speed for that voltage, the current draw reduces down to maintenance levels, where the back EMF nearly matches the applied power.

Pulse Q4

Forward PWM

Assuming this is a PWM driven motor, and that we are pulsing the low MOSFETs, eventually Q4 will be turned off (with Q1 left on). The inductance of the motor will keep the current flowing, even with Q4 off. The diode in Q3 (D3) provides an escape for this inductor-driven current flow.

The inductor will quickly run down, and the motor will eventually coast to a halt.

If Q4 is pulsed fast enough, so that the motor's inductor never fully discharges, the motor will run at a speed proportional to the amount of time Q4 spends on versus off.

Coasting

Turning off both Q1 and Q4 is essentially the same as just turning off Q4 -- the body diodes will allow the inductor to discharge and then the motor will coast to a stop. The back EMF generated by the motor's mechanical inertia should not normally be enough to forward bias the freewheeling diodes.

If the motor is being driven by outside forces (for instance, if the robot is getting towed or pushed) the motor's voltage may rise above the battery voltage and the protection diodes will let the generated current flow into the battery.

Q2 + Q4 Dynamic Braking

Dynamic Braking

Turning off Q1 and turning on Q2 and Q4 provides a short-circuit path for the generated EMF. This EMF is used as a braking force against the motor's rotation -- the faster the motor, the more EMF is generated, and the more it tries to slow the motor.

As an experiment, find a small motor without a gearbox. Spin the shaft and notice how long it takes to coast to a stop in an open circuit. If necessary, put a wheel or sprocket on the shaft so it has more momentum.

Next, tie the two motor leads together. Spin it again and watch how quickly it stops now.

If the motor started in the Q1/Q4 direction, when you turn on Q2 and Q4 to brake the motor, Q4 acts like a high-side switch and Q2 a low side switch. You can control the braking force by pulsing Q2 - switching between coasting and braking.

You can also short Q1 and Q3 for braking, if desired. However, most current sensors or limiters are tied to the low-side. Braking through the high-side switches bypasses these sensors.

Q3 + Q2 Power Braking

Power Braking

Also known as "plugging" in some circles, though I have no idea why. Once the inductor discharges, the motor's EMF becomes the dominant force in this situation. The motor is still spinning in the original direction, (carried onward by internal and external momentum), but applied power has suddenly reversed across it. The power through the system has doubled - the back EMF is now added to the applied power.

Until reverse power flow is able to turn the motor around and reverse the back EMF, the body diodes in Q1 and Q4 will be conducting.

The simplest way to avoid damaging your switches is to avoid this quadrant-four control issue. Simply apply dynamic braking to the motor until it stops and then switch into reverse. Your motor mechanics (gears, chains, and so forth) will thank you.

If you expect to operate in all four control quadrants, additional current sensing circuitry should be added to the high-side of the MOSFETs, so the control system can manage it. Your switches, diodes, and other circuitry must all be robust enough to handle this over-current situation.

Shoot-Through

Another hazard of motor reversing is shoot-through. The MOSFETs take a certain amount of time to turn off, and additional time for the body diodes to recover. If the Q3/Q2 pair is turned on before the Q1/Q4 pair has fully turned off it creates a direct short circuit across the battery. This condition can severely shorten the lifespan of your electronics.

PWM Speed Control

As mentioned earlier, the speed of the motor can be adjusted by switching the power through it on and off. The inductance of the motor will act to smooth out the pulses into a continuous current if the pulses are fast enough.

Typical PWM systems will hold the high-side MOSFET (Q1 or Q3) on and pulse the low-side MOSFET (Q2 or Q4).

There needs to be at least two input lines for PWM control: direction and pulse. A third line can be used to turn on braking.

Locked Anti-Phase Speed Control

A different method for controlling motor speed never turns off the current. Instead, it reverses its direction with the pulse signal. A 50% duty cycle will be smoothed by the motor's inductor to zero current flow, even though it may appear to be switching wildly back and forth to the controller. Changes in duty cycle from 50% will turn the motor one direction or the other.

This isn't the technique we use here.

High-Power PWM H-Bridge Controller

In principle, building an H-Bridge motor controller looks like a simple job. Just drop a few MOSFETs, transistors, IGBTs, or other silicon switch of your choice into a tidy H structure and turn them on in different patterns to make the motor go.

For little tiny motors with low current, this works fine.

As the discussions above illustrate, though, larger motors with larger currents generate a variety of potentially destructive current flows.

With an N-Channel MOSFET motor controller, you have the added complication of driving the gate on the high-side switches.

In a MOSFET, you raise the gate voltage to a specified value (10 volts for "regular" MOSFETs, 5 volts for "logic level") above the source. On the high side of the motor, however, in some situations the source voltage will float to very near the positive power rail. If the gate is being powered from this rail, its voltage relative to the source drops and the MOSFET goes into its partially-switched resistive operating area and begins to heat up.

The need to supply more voltage to the gate than is available on the power rail requires a voltage pump to drive the gate, or yet another battery in series with the motor supply.

Of course, you can also go to P-channel MOSFETs; except they are not as efficient as N-channel devices and will generate more heat.

Fortunately, several companies make H-bridge MOSFET drivers to help us out. In this section, we look at a circuit using the Intersil (formerly Harris) HIP4081A driver. Click on the schematic to load a readable version.

High Power Motor Controller
High Power Motor Controller
QtyReferencePart
2 R1, R2 Gate Delay 220K
2 R3, R4 Motor Snubber 33Ω
8 RG* Gate 10Ω
2 RSH, RSL Sense Resistors 0.005Ω, 5W, low-inductance
1 C1 Power 1000μf, 100V
2 C2, C3 Bootstrap 0.27μf
1 C4 U1 Bypass 0.1μf
2 C5, C6 Motor Snubber 0.1μf
2 CSH, CSL Sense smoothing 0.01μf
2 D1, D2 Bootstrap UF1002 Ultra-fast, 100V, 1A
8 Q*, Power MOSFETs IRF1310N, 100V, 42A, 0.036Ω
1 U1, H-Bridge Driver1 HIP4081A

The HIP4081 features a bootstrap power supply (notice the lack of external connections to VDD and VCC on pins 15 and 16; the chip p owers itself by tapping the motor's drive power), with a battery supply voltage up to 80 volts. It allows full control over all four switches while protecting the bridge from short-circuit conditions. It also has an adjustable dead-time (delay between forward and reverse modes) to protect it from shoot-through.

The circuit shown above is the subject of this discussion. It is only an example, for sake of illustration. It is an 80 amp controller, with a variety of interesting features that are discussed below.

Note that this motor driver circuit is for discussion purposes only. Since we are using a commercial ESC for the drive motors (in the book, where this chapter was to appear), there is no pressing need to make this circuit actually work.

Though the HIP4081A can generate its own operating power, it is also possible (and may improve performance) to supply a regulated 12 volts to it.

Dead Time

The dead time is set by R1 and R2. They provide a turn-on delay for the high-side and low-side switches (turn-off times are not delayed). R2 sets the delay between the time that the low-side MOSFET turns off and the high-side turns on. R1 sets the delay between high-side off and low-side on. This delay should be longer than the turn-off time of the MOSFETs.

Recommended resistor values range from 10K to 200K, giving a linear delay range from about 10nS to about 100nS.

Looking ahead, we see the MOSFETs switch fairly slowly, so the delay should be set to the maximum. A value for both resistors of 220K provides about 110nS of switching delay.

Gate Bias

The key component of the HIP4081A is the level-shifter that provides the gate voltage for the high sides. The bootstrap components D1, D2, C2, and C3 support this system. To provide steady power to the MOSFET gates the bootstrap capacitors need to be tuned to the MOSFETs gate charge. The diodes are not as critical -- they should be fast and capable of handling the necessary current. The HIP4081A application note references the UF4002, a 100 volt, fast recovery, 1 amp rectifier. The UF1002 is similar, and easier to find.

Each channel is driving a pair of IRF1310N N-Channel MOSFETs. At 42A each, these are formidable MOSFETs. Their gate charge Qg=110nC, and their input capacitance Ciss=1,900pf. In parallel, this gives a driven charge of 220nC and a total capacitance of 3,800pF.

Just after the output driver switches on, the charge lost from the bootstrap capacitor is nearly equal to the gate charge being driven. Incorporating effects from the bootstrap diode, we get this bootstrap charge model (and here I apologize for the ugly text equation):

CBS = ( QG + QRR + ((IQBS + IDR) / fPWM) ) / (VBS1 - VBS2)

Where:

QG = Total gate charge transferred = 220nC

QRR = Bootstrap diode reverse recovered charge
IQBS = Upper supply quiescent current = 30μA
IDR = Bootstrap diode reverse current leakage = 5μA
fPWM = PWM operating frequency
VBS1 = Bootstrap capacitor voltage, prior to turn on
VBS2 = Bootstrap capacitor voltage, after turn on (specifies the allowed voltage drop)

We know from the MOSFETs that QG is about 220nC. Looking at the datasheet for the UF1002, we see a 50nS recovery time. Assuming an average of 1 amp current and a roughly linear recovery curve, we can estimate the recovery charge to be one half of the peak current (1A) times the recovery time (50nS). This gives an estimated diode charge of 25nC.

Assuming that the internal charge pump negates any effects of reverse diode leakage and other sources of current leaks, the bootstrap capacitance can be calculated from the simplified formula:

CBS = (QG + QRR) / (VBS1 - VBS2)

Assuming we want a maximum 1-volt drop during gate charging (VBS1 = 12 and VBS2 = 11), we get a bootstrap capacitance of:

CBS = (250nC + 25nC) / (12 - 11)

A standard capacitor of 270nF (.27μF) would meet the 245nC with less than a one volt droop.

Gate Resistors

A gate resistor of 10Ω will limit a 10 volt gate current to 1 amp. Since there are two MOSFETs in parallel, they will sum to 2 amps current (which is within the stated 2.5A rating of the HIP4081A). 1 amp will swing the 110nC gate charge in 110nS.

The dv/dt rating of the IRF1310N is 5V/nS. With an 80 volt supply switching in 110nS, that is 0.7V/nS, well within the MOSFETs range.

Current, Voltage, and Power

An aside: each channel of this circuit has two 42A MOSFETs. It can, in theory, pump over 80 amps of current through the motor without blowing smoke (a technical condition that is understood to be bad; one should never let the magic smoke out).

However, this assumes that the wires to the devices...and the connectors...and the circuit board traces... can each carry 80 amps.

80 amps will push the devices to their limits, leaving little room for error. And for what? An 80 amp motor at 12 volts gives almost a kilowatt of power (960W). While that's a sizeable push, what happens if you put five batteries in series instead of parallel?

You can get the same power with 60 volts at 16 amps. Power dissipation is the square of the current flow; the familiar P=I2R. 16 amps will dissipate 14 times less power through the resistive elements than 60 amps. You can use smaller wire. You can afford to drop in those sense resistors.

Given a choice, choose higher voltage and lower current.

Current Sensors

The current-sense resistors (with smoothing capacitors) provide a porthole through which the controlling circuit can watch the current flow through the circuit.

RSL provides the current flow in normal operation. RSH would provide current flow information for exceptional cases.

With RSL = 0.005Ω, an 80 amp current will generate 32 watts of power -- enough heat to cook any but the most robust, industrial strength resistor. These low-inductance sense resistors come in 5-watt flavors. At 0.005Ω and 5W, that gives it:

P = I2R

5 = I20.005
I2 = 1,000
I = 31.6
Current Sense in One Leg

You have a safe operating current of 31 amps.

Adding the current sense resistor to a single leg of the parallel MOSFETs almost works. The full 42A current through one leg may overheat the resistor, so a safe current rating for the system would be 60A instead of 80A.

The drawback to this is that you need to place a current sensor in each of the two lower (and possibly the two upper) legs of the H-Bridge. In the previous schematic, the sensors catch the full sum of current flow at a common point. In this schematic, they are picking it up piecemeal.

Another trick to note is that the MOSFET has a defined RDS(on) full-on resistance. Depending on the reliability (and temperature stability) of RDS(on), the MOSFET could be used as its own sense resistor. Temperature variations could be compensated for by attaching a temperature sensor to the MOSFET body.

Motor Snubber

R3, R4, C5, and C6 make a pair of snubbers around the motor leads. These smooth out spikes and transitions to the motor. The design (and even necessity) of these snubbers depends on many factors. An initial design could put R3=R4=33Ω and C5-C6=0.1μf and go from there.

Battery Bypass

Capacitor C1 is a monster - one or more capacitors with a total capacitance of 1,000μf to 2,000μf. The purpose of this bypass isn't to filter noise, but to act as a local reservoir of power near the board.

When the MOSFETs turn on the motor, they may be drawing 50 to 80 amps across a 100nS timeframe. That is a lot of current flowing from wires from the battery to a device that is not necessarily very close to the power source. These wires have inductance, and resist the current pulse.

The bypass capacitor supplements the battery during the subsequent power sag.

Heat Dissipation

42A through 36mΩ gives 63 watts power dissipation, at best. While the MOSFET is in the middle of the turn-on time, the average resistance is significantly higher, with subsequently greater heat generation. Run the motor at full current (e.g. stall conditions) for too long, and all the magic smoke may escape your components.

This is the fundamental reason why current sensing is necessary on a motor driver.

Each MOSFET puts drain on its tab. The best way to dissipate the heat is to bolt all of the MOSFETs for each leg onto a common, large, aluminum heat sink. But take care that the drains on the various legs they don't short together. Blow a fan across them and don't let the control circuitry let the motors stall too long.

Another fairly easy sensor to add is a temperature sensor for each leg, fastened on or near the MOSFETs. This can monitor the actual temperature and the controller can shut it all down when it grows too hot.

Finally, the best way to avoid overheating is to avoid high currents -- and design for high voltages instead.

Further Questions

In bootstrap mode, the motor control chip's power comes from the motor power. What happens when the circuit is not cycling? When full on? Full off?

The circuit was illustrated with the fairly easy to get IRF1310 MOSFET. Look up the somewhat harder to find Intersil MOSFET HUF75637. See how its more efficient qualities affect the design.

Project: Low-Power PWM H-Bridge Controller

After wading through that last section you should have a better understanding of why, at the very beginning of this paper, I encouraged you to purchase your motor drivers.

But the suffering is not over yet. Let's defy simplicity and build a simple motor driver. I don't, ultimately, use this circuit anywhere, so build it only if you want the education.

The design for this controller calls for 5A current draw at 5V. The 5V power supply used for these motors is conveniently current limited to 5A externally.

5A Motor Driver
5A Motor Driver
QtyReferencePart
4 R1-R4 Gate 200Ω
2 R5, R6 Sense 0.01Ω 2W 1%
2 R7, R8 Snubber 100Ω
2 C1, C2 Snubber 0.1μf
2 C3, C4 Sense Filter 0.01μf
1 C5 Power 560μf
2 Q1, Q3 P-channel MOSFET RFD10P03L
2 Q2, Q4 N-channel MOSFET RFD16N03L

The first thing that should leap out at you from the schematic is the use of P-channel MOSFETs. Sure, I just got through saying how bad they are (and they are; check the specifications!). For this current level they have a huge RDS(on), almost ten times that of the N-channel devices. But at 5 amps, that is still only 5 watts; manageable with enough heat sinking and a reasonable duty cycle.

The gate resistors are 200Ω to limit the gate current draw to 25mA at 5V -- the rated source/sink current of the logic drivers. At a 25nC gate charge (beyond worst case, at 10A draw), that is a switching time of 1μS, which could be worse.

The sense resistors have no problem with current in this design, dissipating a maximum of 25mW at 5A.

The motor snubber is mostly token; the MOSFETs are rated at twice (at least) the rated current draw - even in full second or fourth-quadrant operation, they should be able to manage the abuse.

Building this circuit it is still important to isolate the power ground plane from the logic ground plane by a small resistor, and some space. It is important to isolate noise in the power drivers so it remains in the power drivers.

Logic Circuit
Logic Circuit

Controlling the power stage is the logic circuit shown in the schematic to the right. This circuit provides basic short-circuit protection and a simple control structure.

The input resistors provide a semblance of protection for the driver if the inputs are unconnected (floating).

When the brake line is brought high, both low MOSFETs are activated and the high MOSFETs are turned off. Note that a logic level of 1 turns off the high MOSFETs.

Reverse controls which high/low pair is active. PWM then toggles the low MOSFET in the active pair.

There are no delays or other timing protection to prevent switching shoot-through. It is up to the controlling application to behave itself and work to keep the MOSFETs from going up in smoke.

Current Sense
Current Sense
QtyReferencePart
4 R9-R12 Input 10KΩ
4 R13-R16 Feedback 820KΩ
2 IC1 LMC6032 Op Amp

The raw current sense output is processed by a pair of op-amps, bringing the 0.0 to 0.05 volt signal up to a nearly full-scale range of 0 to 4 volts (giving some margin for error, and the dropout inherent in amplifiers). A practical feedback resistor of 820KΩ gives an 82x amplification. A 5-amp draw will generate a signal of 4.1 volts. In practice, you will probably need to fiddle with the filters on this signal; it gets a huge amount of noise from the motor, too.

Views
Personal tools