A High(er) Power H-Bridge for Servo control - Design

by Ivan Hamilton 8/29/2011 7:26:00 PM

Alright... most of the thinking has been done. Here's what we'll need:

  • Input Opto-isolators
  • MOSFET Drivers
  • Current sensing
  • Adjustable "current" reference
  • "Current" comparator
  • Over-current latch
  • Logic/Gate/Motor supply voltages
  • Miscellaneous support circuitry

Our overall goal is to translate two 3.3V inputs (A & B) into two high voltage, high current outputs (M+ & M-).

Input Opto-isolation

Role: Protect the source of the inputs & convert 3.3V signal to 5V.

Input: 3.3V @ 12mA, Output: 5V

Although it shows the HCPL2530, I'm actually using a HCPL2531. The HCPL2531 has lower propagation times (roughly half) and a higher Current Transfer Ratio (50% more).

R1 & R2 are current limiting resistors to deliver the correct current the the emitter within the opto-isolator. The HCPL2531's emitters have a typical forward voltage of 1.45V, and we'll be looking to take a signal from a chip producing 3.3V @ 8mA (far below HCPL2531's maximum current of 25mA).

A current limiting resistor to suit is R=(VS - VF)/I=(3.3V - 1.45V)/8mA=231.25Ω, a close E6 series resistor is 220Ω, giving 8.4mA.  

The outputs of the HCPL2531 are an "Open Collector" arrangement. When the input is "on", the internal transistor will conduct to ground. By connecting this output "collector" to a current supply (a current limiting resistor to a voltage supply) a signal is produced.

Unfortunately, the signal is inverted. When the input is low, the transistor is off and the output goes high. When the input goes high, the transistor conducts and pull the output low. Further processing will to required to (un)invert the signal.

R3 & R4 are pull up resistors to place current on the output pins that the internal transistor will overcome. The HCPL2531's Current Transfer Ratio (output collector current to the forward LED input current) is 30%. So, with 8.4mA to the LED, only 2.52mA will be sunk to ground during the "on" condition. With a 5V supply, R=V/I=5V/2.52mA=1984Ω. A close E6 series resistor is 2.2KΩ, giving 2.3mA.

Input Conversion

Role: Take the output signals of the opto-isolator, and prepare signals suitable for other parts of the system.

As mentioned previously, our A & B inputs were inverted by the opto-isolators. We need to (un)invert them back to original high/low states as inputs to the H-Bridge driver chips. We also need combined A OR B signals to be fed to the reset mechanism of the current control section. So, two NOT (inverter) gates and an OR gate. This could be achieved with one 4069 hex inverter, and one 4071 quad 2-input OR gate chip. But there is another way. We have NOT A & NOT B signals, and want A OR B. De Morgan's laws state that P OR Q = (NOT P)NAND(NOT Q). Therefore we can use a NAND gate to produce A OR B from NOT A & NOT B. NAND gates can also function as inverters, by appying the signal to both inputs (or one input, and the other fixed high). By using the same gate type for both operations, a single 4011 Quad 2-Input NAND gate chip can be used for all logic conversion. A pin-compatible 4093 Schmitt Triggered Quad 2-Input NAND could also be used, with it's inputs being less suceptible to noise (our opto's output shouldn't be too noisy).


Role: Take A, B & /SD (enable) signals and produce V+ or V- at M+ & M- pads, and current sense signal (CSENSE).

This is the heavy lifting part of the circuit. 5V logic signals come in, and high voltage, high current signals go out.

The heart of the system are two IR21844 Half-Bridge Drivers (one for each side). They provide: output source/sink current capability 1.4A/1.8A, under voltage protection (gates won't drive with less than ~8V), adjustable dead-time (turn off one MOSFET vs turn on the other), floating high-side (up to 600V).

Let's look at a single side (A's, which is at the top of the diagram).

C1 & C3 are bypass capacitors to keep the voltage supply stable.

R6 is the adjustable dead-time resistor, and 39K provides ~1µS.

R5 & R7 are current limiting resistors for the IR21844. Giving that we have 12V to drive the gates, 22Ω will give 545mA - quite conversative given the IR21884 is rated to source 1.4A.

C2 & D2 provide the "bootstrap" mechanism. This is used to provide a gate voltage above the motor supply. It relies upon the lower gate Q1 conducting (the standard low state), then current flows from the gate supply (12V) thru D2 and charges C2 to 12V. When the output goes high, Q1 shuts off and the charge in C2 is connected to HO, driving (thru R5) Q3 on. The charge in C2 must be enough to supply gate voltage for the duration off the high state, since it's only recharged during the low state.

Sizing of this capacitor needs to account for: turn on required gate charge, gate-source leakage current, floating section quiescent current, floating section leakage current, bootstrap diode leakage current, desat diode bias when on, charge required by the internal level shifters, bootstrap capacitor leakage current & high side on time. International Rectifier's Design Tip DR04-4 proviodes details and examples of bootstrap sizing. In my calculations, I found it was dominated by the gate charge (70nC for the IRF540), and that 3 times the gate charge (3 x 70nC = 0.210uF) was a good guide.

D2 must switch fast enough to allow C2 to charge during the low period (~1uS), and high enough reverse breakdown to fend off the high motor supply voltages. My selected 1N4004 @ 400V may be too slow and high-speed UF4004s may be required instead.

Finally, current thru the motor must flow via U$1 & U$2 current sensing resistors. It's important that these are low value (to reduce power and voltage drop), accurate, non-inductive (giving the high-speed PWM) and capable of disapating the required power. Open air current sense resistors are suitable for this purpose. If we want to sense 30A as 0.3V, we need 10mΩ resistance @ 9W. This is achieved with 2 x 20mΩ %1 5W resistors in parallel (or a single one for <15A).

The /SD (enable) signal is supplied from the current limiting system and shutsdown the outputs.

Adjustable Current Reference

Role: Provide a user adjustable reference voltage

We need a user adjustable reference to compare the voltage from the current sense resistors against to determine an "over-current" situation.

I'm looking for a 25A limit, so adjustment across the 0-0.25V range. A voltage divider from a 39K resistor & 2K pot give a 5V/(39KΩ+2KΩ)*2KΩ=0.24V range (changing this resistor to 33KΩ would give 0-0.29V for a 29A limit).

C8 provides some filtering to avoid ambient & adjustment noise.


Current Compare & Cutout 

Role: When the sensed current rises above the reference level, disable the MOSFET drivers until A or B goes high again.

A 4013 D-type flip-flop provides the /SD (enable) line for the H-Bridge driver chips, which must be high for the drivers to operate. When A OR B goes high, the flip-flop samples it's data value (always high, since we tied D to 5V) and placed it on the output Q, thereby switching the drivers on. This happens at the start of every A OR B pulse.

The H-Bridge driver goes to ground via current sense resistors providing a voltage @ CSENSE. To keep out noise, we pass this thru a low pass filter made by R13 & C7 with a cut-off frequency of 1/(2πRC)=1/(2π 100Ω x 0.001uF)=1.5MHz.

D3 protects the comparator from the filtered CSENSE signal going negative. It is a BAT85 schottky diode providing a lower forward voltage and fast switching.

The filtered current sense voltage is compared with the user reference voltage by a LM393 comparator. When the voltage (sensed current) exceeds the user preference, the comparator will go "high". Like the opto-isolators, this is also an "open collector" device - when the comparator's output is "high", the output pin will conduct to ground (overwhelming the R14 pullup resistor) and go "low". This low signal on the flip-flop's Reset input will switch Q off, disabling the H-Bridge driver chips until the current drops below the threshold and the next A OR B pulse starts. 



And that's it for the first revision. You can get a PDF of the full schematic here: 110829_MediumPowerPwmHBridge.v0.1.pdf (19.19 kb)

A few things to remember:

  • I have no idea what I'm doing. I'm neither trained nor experienced in electronics design. I'm making this up as I go.
  • So far, this is just a theoretical design. In the "real-world", there are no theoretical components, only "real-world" ones that often need more care.
  • This has not been "designed for production", so there's probably numerous optimisations that could be make.

Next? The physical layout.

Currently rated 1.6 by 59 people

  • Currently 1.61017/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CNC | Electronics

A High(er) Power H-Bridge for Servo control - Ideas

by Ivan Hamilton 8/25/2011 8:15:00 PM


Off the shelf servo controllers are quite expensive, that's why I decided to hack together my own. But if you want to apply some muscle - lower voltages (12V) just won't cut it.

To get high power (>1hp/735W) from 12V you'll need to draw high current ~61 Amps. Put simply, that's a 0.2Ω load. This presents some challenges:

  • A 61Amp 12V power supply. They're rare.
  • A power supply, connectors, wiring, controller & motor with a total resistance of <0.2Ω.
  • A 1hp 12V motor. Those that exist are rare, expensive and heavy.

These are some of the reasons why higher power commercial servo motors start at 24V and progress to 36, 48, 60, 70, 90 & 180V.

My plan calls upon a modular H-bridge unit to take care of turning logic level signals into high power motor drive.

The design of choice is a MOSFET H-bridge. MOSFETs are simple enough, by inducing a voltage between the Gate and the Source, current can flow between Drain and Source. There's two types of MOSFETs: N & P channel, which are basically mirror images of each other (in terms of positive and negative voltages).

Simple N & P Channel MOSFET H-bridge


To turn a MOSFET on, apply more than the threshold voltage "VGS(th)" to the gate. But MOSFETs aren't perfect devices, they have limits, including a limit on the gate voltage. For quick switch-on/off the gate voltage should be towards the maximum allowable without going outside MOSFET limits. A stroll thru International Rectifier's MOSFET list shows 71% of their devices have a maximum gate voltage "VGS(MAX)" of 20V, 20% are 16V or less, and the remaining 9% are 30V. This means, once you go beyond a 30V supply, you can't simply use the supply voltage on the MOSFET gates.

For a motor supply of VMOTOR and gate drive of VGS (minus for p-channel, plus for n-channel), you'll need to switch:

  • High side MOSFET gate between VSUPPLY and VSUPPLY±VGS
  • Low side MOSFET gate between GND and ±VGS

That's two extra supply voltages, ±VGS & VSUPPLY±VGS (which could be the same for VSUPPLY< 2 x VGS(MAX)). Oh yeah, an extra thing - P channel MOSFETs simply aren't as "good" as N channel MOSFETS. (Since P-Channel majority carrier holes have lower mobility than N-Channel electron carriers, the on-resistance of P-Channel devices is two or three times higher than that of an N-Channel of the same area). International Rectifier's lowest RDS(ON) for a p-channel device is 4.7mΩ, whereas n-channel is 0.7mΩ. Current? 74A vs 429A.

You can't turn on both the high & low side MOSFETs, that's a short circuit and will destroy devices. That's straight foward enough... but they don't turn on & off instantly, so you need a delay between switching off one, and switching on the other.

Don't supply a gate voltage below the threshold voltage "VGS(th)", that'll partly turn on the device, and it will turn the power it's throttling into heat. We want it on or off, not in the middle.

Extra supply voltages (above the main supply for N-channel), level shifting circuitry, drop-out protection, dead-time... it's starting to get complicated.

Enter the MOSFET drivers

The complexity of this isn't lost upon semiconducter manufacturers and numerous components are available to assist. But unfortunately, they didn't get together to come up with a standard name for this device.

It's roughly called a "(Half|Full)-Bridge [N-Channel] ([Power] MOSFET|Gate|High and Low Side) (Driver|Controller)", and has part numbers like IR2104, IR2184, A3941, L6393, HIP4081A, TC4427 & LT1162.

One of the great things about them, is they often include the ability to help generate a voltage above the motor supply voltage allowing use of N channel devices all around (typically at the expense of 100% drive - ongoing switching is needed to generate that higher voltage).

What to choose? I browsed to the International Rectifier Product Line & Parametric Search for General Purpose ICs → High Voltage Gate Driver ICs. Criteria?

  • Switch our FETs on and off quickly - high current >1A
  • Amatuer friendly package - PDIP
  • Higher voltages >50V

That focuses us on three packages:

  • IR2181 - Separate high & low drivers, ignored because it doesn't block cross conduction.
  • IR2183 - 400ns deadtime, 180ns ton, 220ns toff
  • IR2184 - 400ns deadtime, 680ns ton, 270ns toff

The difference between these (IR2183 & IR2184) seems to just be the turn on delay. I think this could be handy for overcoming the gate capacitances of larger MOSFETs which could take longer to turn off (got to avoid that shoot-thru!).

I've seen many designs filled with resistors & diodes parralleled along the gate drive line. This appears to be to avoid shoot-thru by allowing the MOSFET to turn off quickly (via the diode) but on slowly (via the resistor). Both the IR2183 & IR2184 also have a variant (IR21834 & IR21844) where the deadtime is programmable via an external resistor (up to 5000ns vs 400ns). To me, that sounds like a much better alternative (especially since it appears I can source the more featured IRS21844PBF at half the price the lesser IRS2184PBF would cost).

Add a quartet of IRF540N (44mOhm 100v 33A) or IRFP260N (55mOhm 200v 46A), and we're getting close to a solution.

Limiting Current

Delivering 30A with the possibility of stalling the motor means that we should have current limitting. A standard current limiting method for inductive loads is to measure current and switch off when the limit is exceeded, and back on when it falls below. The inductive load smooths the current change so this is a reasonable method (it won't race too fast). Unfortunately when dealing with boot-strapped high-side drivers each "on" transition consumes charge in the bootstrap capacitor. If we switch off & back on 10 times in a cycle before the capacitor is refilled, we'll drain it to a point where it won't supply enough voltage to switch the MOSFET on "hard" enough (risking the MOSFET).

What we'll need to do is recognise exceeding the current limit and switch drive off until the next rising edge input. This might stop us delivering maximum levels of continous power - but this is current limiting for safety, not current control for performance.

Detecting over current

Probably the easiest way is to use a current shunt and measure the voltage drop against a reference. Let's check what we can achieve with a pair of 0.02Ω 5W current sense resistors in parrallel.

  • P = 10W = I²R = I² 0.01Ω = 31.6A
  • V = IR = 31.6A x 0.01Ω = 0.316V

Maybe use a LM393 to compare against an adjustable reference voltage, and indicate when it's exceeded.

Staying off

By using a D flip-flop (CMOS 4013) we can switch the output off on over-current (reset), and have it reset by the next rising edge for a leg (clk).

Isolating inputs

It's a good idea to electrically isolate incoming signals to this high current, high voltage board.

Let's look at an example: 50kHz PWM, 1% duty cycle: 20μS cycle with a 200nS pulse. But your standard off the self 4N25-28 has typical 2μS rise and fall times. That's just not fast enough to accurately pass the inbound waveform.

Higher up are the 6N136/HCPL-2531 1mBit/S & 6N137/HCPL-2631 10mBit/S dual optoisolators ($2/$4). With 500nS & 50nS total propagation delay they're the speed of equipment we'll need.

It's worth noting, the 6N136 is 20V, whilst the 6N137 is a 5V device. I think, treated right, we can probably get the required performance from a 6N136, and run all components from a 5V/12V supply (the IR21844 has a maximum 10V logic input voltage, and we want more that 10V to drive the gate voltage).

Design Time

All that's left is to design and build it. How hard could it be?

Currently rated 2.9 by 15 people

  • Currently 2.933334/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CNC | Electronics

PWM & High Speed Optocouplers

by Ivan Hamilton 8/25/2011 7:53:00 PM

One of the signals needed in my servo controller is a PWM signal to control the motor driver. From the Papilio FPGA board I plan to use, comes a 3.3V signal and there's two things that it will need.

  1. Isolate it from the "nasty" high voltage/current sections
  2. Translate it from 3.3V to 5V+

I had an 8 channel PC817 based Futurlec Opto-Isolator Mini Board ($5) lying around (it uses 560Ω series input & 1kΩ output pull ups), and wondered how it would perform. I rigged it up and was initially pleased.

PC817 based opto @ 1Khz

The bottom trace is the 3.3V input, and the top trace is the 5V output  (both 2V/div).

Then I moved the frequency from 1Khz up to 25Khz... 

PC817 based opto @ 25Khz 

At 20Khz the output is barely exceeding 3V and certainly couldn't be called a square wave. At 20% duty cycle, it's basically off, and at 80% - completely on. If we produce a 25kHz signal, and want ~1% accuracy on the duty cycle, we'll need an opto capable of switching in around 1% x 25Khz Cycle = 1% x 40μS = 0.4μS. The PC817 has a quoted 4µS rise & fall time.

It was time to find a higher performance opto, and "common" DIP optos include the 6N13n family (manufactured by Fairchild, Vishay, Avago, etc):

  • 6N138 & 6N139 - 0.1Mbs  10/35μS (High-Low/Low-High) switching
  • 6N135 & 6N136 - 1.0Mbs 1.5 & 0.8μS switching
  • 6N137 - 10Mbs - 0.1μS switching

It looks like the 6N136 should perform as required. A dual channel version, the HCPL2531 is available as well (and so I ordered a couple).

The HCPL2531 has a stated Input Forward Voltage of 1.45V and maximum average mitter current of 25mA. Passing 3.3V thru 220Ω will give IF=(3.3-1.45)/220=8.4mA. Maxium Average Output Current is a paltry 8mA (vs slower 6N138/9's 60mA), so the output side required a 2.2KΩ pull up to 5V (2.2mA). HCPL2531's propagation delay charts show the best "standard" results for IF=16mA & RL=1.9KΩ (close enough to my 8.4Ma/2.2KΩ setup).

HCPL2531 based opto @ 25Khz

The HCPL2531 was much better, and much more suitable to the PWM signals. Top is 3.3V input and the bottom is 5V output (the upper & lower traces are swapped from previous photos before).

The PC817 would still be suitable for slower signals (errors,home switches, etc), and will probably get used for exactly that.

Currently rated 3.3 by 12 people

  • Currently 3.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


CNC | Electronics

Powered by BlogEngine.NET
Original theme by Mads Kristensen

About the author

Name of author Ivan Hamilton
"My inner nerd can beat up your inner nerd."

E-mail me Send mail



<<  October 2021  >>

View posts in large calendar

Recent comments





    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2021

    Sign in