3
\$\begingroup\$

I'm attempting to design an inverter that will be driven mainly by an AVR uC. The H-Bridge will consist of 4 IR840 N-Channel MOSFETs. The left and right hand side of the H-bridge will be driven by two IRF2113 MOSFET drivers.

I will of course be feeding a pulse width modulated waveform to the mosfet drivers. However, my question is, will the input to one of the mosfet drivers need to be inverted? Suppose the left hand side MOSFET driver is fed directly from the AVR. Will the right hand side driver need an inverted version of the PWM waveform? If so, is it best to use the the inverted output on the AVR Mega 168? Or would a separate NOT gate be a better choice?

The actual signal is a 50Hz sinusoidal. In order to reduce harmonics, I've also seen some designs where "Trilevel" PWM was used. If I understand correctly, in Trilevel PWM the duty-cycle goes to 0 when the sine wave is at zero. At negative peak, the duty cycle is max. but the PWM is also negative (hence 3 levels).

Now, in order to generate the sine-wave my LUT has 625 values that go from 128 to 255 and then down all the way to 0. 128 is half-way in terms of amplitude. Now, in order to have a PWM that resembles like the figure below Taken by PICREF-1

I am thinking that my LUT should go from 128 to 255 and then when it reaches 128, it should rise back up to 255 instead of going down to 0. This should vary the duty cycle in such a way that it resembles the PWM waveform in the above figure. However, at 128 the duty cycle would still be 50% - should I just go from 0 to 255, back to 0 and then back to 255 in one-cycle?

Now, in order to actually have the trilevel PWM, one side of the H-bridge is driven via a 50Hz square wave while the other half is driven by the PWM waveform in the above figure. I am reluctant regarding this design - won't this cause the supply to be shorted when two MOSFETS on the same side are turned on at the same side?

\$\endgroup\$
  • 2
    \$\begingroup\$ yes, whatever else you do to deliver power to your load, you want to avoid turning on both the high and low drivers on the same side at the same time - you will essentially short the rails doing this, and much unwanted excitement will follow. \$\endgroup\$ – JustJeff Aug 17 '11 at 10:13
  • \$\begingroup\$ Yes - that is what I fear. However, considering that the following app note uses a 60Hz and a PWM to drive the halves of the H-Bridge (hificat.com/elediy_data/more/302ups.pdf - page 4), I'm thinking that I'm missing something. Perhaps someone here can shed some light on this - am I wrong in thinking that the transistors turn on at the same time? \$\endgroup\$ – Saad Aug 17 '11 at 10:19
  • \$\begingroup\$ I would guess that trilevel has more distortion. Does that matter to you? \$\endgroup\$ – endolith Aug 18 '11 at 1:29
  • 1
    \$\begingroup\$ Yes. I would like the harmonic content to be low. I would also thought that trilevel PWM would have more distortion. But this page seems to suggest otherwise: ece.wpi.edu/analog/meetings/fall_2006/fall_2006_posters/… It has FFTs of both bipolar and trilevel PWM. \$\endgroup\$ – Saad Aug 18 '11 at 6:36
  • \$\begingroup\$ Consider using an H-Bridge driver IC. It's been long since I've looked at those but I'm sure there are still around. \$\endgroup\$ – Guy Sirton May 20 '12 at 7:04
3
\$\begingroup\$

I'm guessing you're trying to drive some AC motor that was originally designed to run on 50 Hz AC.

I'm assuming you're using two IRS2113 chips, the "left" chip controlling the two FETs connected to the "left" wire going to the motor, and the "right" chip controlling the two FETs connected to the other wire going to the motor. You probably want to check out the IRS2113 datasheet and the FET datasheet(s).

It is your responsibility to never, ever drive both HIN and LIN of the left IRS2113 chip HI at the same time -- the "self-destruct" state. As JustJeff points out, if both HIN and LIN of the left FET driver chip are ever high at the same time, the FETs connected to it will, in effect, short the rails ("shoot through", "fuse test", etc.), and much unwanted excitement will follow. (Never, ever drive both HIN and LIN of the right IRS2113 chip HI at the same time, either).

A few people don't use a translation circuit at all; they directly connect the left HIN and LIN and the right HIN and LIN directly to 4 independent output pins of the microcontroller, and hope that the software doesn't have any bugs that would set the FETs to the self-destruct state.

I prefer using a digital logic gate, such as the external NOT gate you mention, to enforce this "avoid the self-destruct state" condition in the motor driver hardware, rather than software.

It looks to me that the IRS2113 (like many other "high-side drivers") uses a boost circuit that can't really produce a 100% "ON" in the high-side transistor; it assumes that software will periodically turn that transistor OFF, so your software might need to limit the maximum PWM duty cycle to a maximum of something like 255 ticks HI + 1 tick LO.

bipolar

The simplest (in hardware) approach is to drive the entire H bridge/motor system in one of two basic states of the H bridge: either

State 0: The microcontroller PWM output is LOW. This drives the left LIN and the right HIN, turning the corresponding FETs off. That output also drives a NOT gate which drives HI the left HIN and the right LIN, turning those corresponding FETs ON. This in effect connects the motor's left wire to HI and the motor's right wire to LO. If things stay in this state long enough, the motor turns in the direction I call "forward".

State 1: The microcontroller PWM output is HI. This drives the left LIN and the right HIN, turning the corresponding FETs ON. ... This in effect connects the motor's left wire to LO and the motor's right wire to HI. If things stay in this state long enough, the motor turns in the direction I call "reverse".

With a PWM running at reasonable speeds, setting the duty cycle to 50% HI, 50% LO, you end up with the motor stationary (possibly humming a little).

This 2-state (bipolar) system is sometimes called "Locked-Antiphase". a b

trilevel

Trilevel, aka "Sign-Magnitude Drive"

Adding a third state makes things a little more complicated and difficult to debug, but it typically improves (reduces) harmonics and makes the system more power efficient.

State 3: Some people use a third state turns off all the FETs, letting the motor freewheel. (If you manage to turn off any 3 of the 4 transistors and leave the other one ON, that also works just as well as a freewheel state). If things stay in this state long enough, the motor "stops". (In some cases, external forces spin the motor in one direction; the direction is not under the control of the electronics).

Alternate State 3: Some people use a third state that turns on both the lower FETs, turning off both upper FETs, which slows down the motor ("brake"). (Others turn on both the upper FETs, turning off both lower FETs; that also works just as well as a "brake" state). If things stay in this state long enough, the motor stops. (Even when external forces push the motor in one direction, this "brake" generally causes the motor to stop).

There are a variety of ways to implement digital logic between the microcontroller and the FET driver that supports trilevel drive, but also avoids the self-destructive states. (Some motor driver chips such as the IXYS IXDN404 include this anti-shoot-through direction/PWM translation circuit, but the IRS2113 does not).

Such translation circuits generally require a "direction" and a "PWM" line from the microcontroller. The software sets the "direction" to "forward", and then adjusts the duty cycle of the PWM to control the speed from "idle" to "full speed forward". (The two states of the PWM, in effect, are translated to the two states "State 0 forward" and "State 3 idle"). Much later, the software sets the "direction" to "reverse", and then adjusts the duty cycle of the PWM to control the speed from "idle" to "full speed reverse". (The two states of the PWM, in effect, are translated to the two states "State 0 forward" and "State 3 idle").

Translation circuits that support tristate motor control: a b c d e

You might think that these circuits would have 100% LO, 0% HI PWM duty cycle give "idle" (in either direction), and 0% LO, 100% HI give "full speed" (in whatever direction the "direction" line indicates). But lots of people use a direction/PWM translation circuit that does something more confusing, and then fix it up in software.

Perhaps the simplest such circuit translation uses the PWM to drive the left LIN and a NOT gate that in turn drives the left HIN. Another general-purpose output on the microcontroller drives the "direction" signal, which drives right LIN and a NOT gate that in turn drives the right HIN.

\$\endgroup\$
2
\$\begingroup\$

"Will the right hand side driver need an inverted version of the PWM waveform? If so, is it best to use the the inverted output on the AVR Mega 168? Or would a separate NOT gate be a better choice?"

Your design basically uses 7 bit PWM and 1 bit for bipolar which is the same as a 8 bit PWM where 50% duty = 0 V. You can synthesize it with a DAC R-2R from parallel output, use PWM or simply use a Johnson counter running at 500 Hz and use 10 sine weighted resistor values to generate the 50Hz sine wave for a MOSFET H bridge AC inverter.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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