Magic Sine Wave-based Inverter

Thread Starter

spacewrench

Joined Oct 5, 2009
58
I found Don Lancaster's Magic Sine Wave info a few years ago, and I'm finally getting around to thinking about building something with them. I'd like to do a low-power 120V inverter (say 10~200W). I started out with a Spice model, which gives me reasonable but ugly results (certainly nothing like what I expect from Don's "all low-order harmonics are zero!")

Am I doing something completely stupid or wrong, or is it just a matter of the somewhat simplified Spice model? Any other suggestions?

In the following picture, the top Magic Sine PWM controls M2 and M3, while the bottom PWM controls M1 and M4.


 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
Wow, 80mH? Big inductors! :eek:

Your gate inputs basically need to be complementary to one another. What I mean by that is - if a high side MOSFET is on, the lower must be OFF, and vice-versa. This is basically how Class-D amplifiers work.

You must allow for an appropriate amount of "dead time" so that it is impossible to have both the high and low side MOSFETs on at any point in time, or you will see smoke. :eek:

You can use Don Lancaster's ideas, but right now your averaging switching frequency is pretty low. This will result in a pretty jagged output sine wave, like you're seeing.

You only have a pair of inductors; not a transformer. I don't know what version of Spice you're using; I use Linear Technology's LTSpice for just about everything - it's a free download. I find the black background of your schematic with dark blue wires hard to look at.
 

Thread Starter

spacewrench

Joined Oct 5, 2009
58
Wow, 80mH? Big inductors! :eek:
I kept making them bigger, hoping they'd smooth out the wavefore. No luck, though.
Your gate inputs basically need to be complementary to one another.
It is sorta like that: on the top/green PWM waveform, M2 (high-side) and M3 (low-side) are on, so current flows left-to-right through the load resistor. On the bottom/orange PWM, M4 (top) and M1 (bottom) are on, so current flows right-to-left.

I also tried signals that are closer to what you probably mean: M2/M3 signals (and M1/M4 signals) that are complementary, with dead time between pulses. The problem I got is that the Magic Sine calculator only gives 0-90° worth of pulses. I reflect them to get 0-180°, but I don't have any example circuits that show how to drive a half- or full-bridge from them.

And obviously, I'm not doing it right!

You can use Don Lancaster's ideas, but right now your averaging switching frequency is pretty low. This will result in a pretty jagged output sine wave, like you're seeing.
I thought that was the idea: instead of a fixed, high switching frequency, where you vary the pulse width gradually to get the inter-switch node to pull up or pull down at 60Hz, you just use a small number of pulses (say up to about 20 or 30) during each 90° of the waveform.

Actually, that could be the problem: I'm only using 3 or 4-pulse signals. Maybe if I switch to a 20-pulse version, it'll look better. (The PSpice PWL line is gonna get ungodly long, though!)

Thanks for looking, Sgt. I'll post followups as I find stuff out.
 

Thread Starter

spacewrench

Joined Oct 5, 2009
58
(21 pulses per quadrant, 30mH filter inductors, 144Ω load. Looks much better, I'm going to try to improve the filtering by soaking up some of the excess current during a pulse into a cap, then feeding it to the load during the pulse off time.)
 

Thread Starter

spacewrench

Joined Oct 5, 2009
58
I wish I had paid more attention in Circuits! I fooled around with various filter topologies and component values, and eventually came up with this:

(oops, Cf value is cut off -- it's 33μF) which gives this nice output:

The red trace is current through the load, the blue is a reference sine wave. Obviously, the phase is off, but the shape looks good, and I can fix the phase because I'll be using a microcontroller to produce the driving pulses.

I don't understand how to characterize the filter part, though, so I don't know how it'll respond to changes in load, or if I use "thinner" magic sine pulses to reduce the power level.
 

SgtWookie

Joined Jul 17, 2007
22,230
You're going to need feedback to control the output voltage and limit the output current. Consider using high-speed optocouplers to maintain isolation between the primary and secondary sides.

Also consider downloading Elsie, a filter design tool. It works in freeware mode for up to 7 orders. You'll need to eliminate the HF harmonics.
Link: http://www.tonnesoftware.com/elsie.html

Matching your output impedance is critical for the filter design. Getting the right transformer design will be a good bit of work.
 

robackrman

Joined Oct 29, 2012
1
This thread is old, however, it ranks high in search engine results, so I thought I would collaborate with others that might also search on "Magic," "Sinewave," and "inverter" keywords. Referencing spacewrench's time-series plot and associated schematic: the bottom legs of the H-bridge (M1 and M3) should be conducting when the top legs (M2 and M4) are not (i.e., between the pulses) to enforce the "middle" state of the three-level, single-phase Magic Sinewave pulse sequence. In addition to Don Lancaster's documentation (http://www.tinaja.com/magsn01.shtml) please see (http://ackrman.net/ms/blog/2012-10-27) for an example of an inverter simulated in SPICE driven by Magic Sinewave pulse sequences.
 

THE_RB

Joined Feb 11, 2008
5,438
Thanks for showing this thread I had not seen it. :)

Agreed, you need to drive both sides of the waveform to allow sine currents in the transformer. Here's one I did with a cheap 8pin PIC driving the sine PWMs using push-pull mosfets (scope shows PWM waveform and filtered "sine" output);



It can be seen about 2/3 the way down this page,
http://www.romanblack.com/one_sec.htm
with some other 50/60Hz sine inverter stuff. Most of the projects use xtal locked freq generation so will make very accurate mains frequency (people often use them for small inverters to drive old 50/60 Hz clocks).

Also keep in mind if making an actual inverter using push-pull FETs into a mains transformer a "sine" is not always the best waveshape. I did one to make 110vAC from 12v and needed to change the PWM "sine" shape a lot to get a good actual sine at the 110v output of the transformer, even into a resistive load. It can also vary a bit with the size of the transformer and the load current.
 
Top