switch mode mains inverter questions

Avalanche, Fri Aug 18 2006, 03:17PM

I'm going to be building a mains inverter in the not too distant future, to convert 12VDC to 230VAC 50Hz.

I'm looking at maybe 300 watts to start with, or whatever my ferrite core (from a 17" monitor smps) will handle.

It's going to just be a basic PWM controller switching the primary at 20Khz ish, rectified and smoothed output to give 325VDC, some kind of feedback to the PWM controller to keep it at 325V, and then a 555, inverter stage and a fullbridge to chop the 325V into 50Hz AC, and finally some filtering on the output. I'm also adding a low battery alarm and shutdown, maybe thermal/overload shutdown as well, but those will be finishing touches that will only happen if I get the time.

Now onto the questions...

1.Firstly does the TL494 sound like a good chip to use, or should I go for a more specialised SMPS controller? Any suggestions...?

2.Transformer turns ratio - this has me confused. I've dismantled a few smps transformers, and all of the windings appear to be roughly the same length, with only the thickness being the variant. How do I calculate the turns ratio, and number of turns required? All searches so far just tell me that the output is proportional to the input turns, ie ordinary transformer behaviour. I know the output is regulated with feedback, but how do you achieve any voltage increase if the turns ratio is equal?

3.For the switching topology on the primary, I'm not sure whether to go for a single MOSFET or IGBT swithching the 12volts into the primary, a push-pull with a center tapped primary, or a halfbridge. Which would be best? I'm thinking halfbridge.

4. Is there any advantage of running the transformer at resonance? I'm thinking not, so what would be a good way to determine the optimum operating frequency, or doesn't it matter as long as it's inaudible?

The biggest challenge will probably be getting the regulation/feedback working properly, but I just wanted to make sure I was doing the first bit properly before I start throwing things together.

Thanks!


Re: switch mode mains inverter questions
Marko, Fri Aug 18 2006, 03:43PM

1. TL494 is OK. I only prefer SG3525 sometimes because of better output stage. I suggest you to go for some 50kHz frequency since it seems to be a compromise between losses and power.

For output stage, you should also use a PWM controller in order to make deadtime between output squarewaves (otherwise you will end with 325V RMS instead of 230!).
Reactive filter in series with output could polish that to nice sinewave.

2.transformer ratio can be calculated like a normal transformer.

If I remember ATX transformer uses pretty varied number of turns, I recall 6 for 12V secondary, and since primary is 160V I remember some 30-40 turns for primary (at full duty cycle transformer can output 25V+)

You could probably use ATX transformer as-is, switching the primary at 12V, and then doubling the output with 2 diodes and caps (those from ATX supply will be good).

Diodes will need to be some fast recovery HV diodes.

3. I would use halfbridge, as flyback techniques (single transistor and push pull) produce high voltage spikes, troubling your output voltage and your mosfets wich would now need to withstand voltage much higher than supply voltage.

4. I don't get this one too clearly. Things like mazzili driver could work like a lowcost, high power and efficient solution, but with cost of no regulation. Resonant drive usually doesn't make a big difference to the transformer itself.








Re: switch mode mains inverter questions
Sulaiman, Fri Aug 18 2006, 05:40PM

Since a brand new 600W invertor (1200W surge) is 30 quid including p&p on eBay
it's not really worth the effort!
Re: switch mode mains inverter questions
Avalanche, Fri Aug 18 2006, 11:09PM

Thanks for the comments firkragg, I will start the building soon!

wrote ...
it's not really worth the effort!
It is to me though... I'm not really doing it because I want an inverter, but I want the satisfaction and knowledge I'll gain from building and debugging it myself. Plus I thought all these igbts I have deserved a chance to a decent life tongue
Re: switch mode mains inverter questions
Steve Conner, Sat Aug 19 2006, 06:17PM

One inverter that I dismantled a while back used two SG3525s: one to drive the DC-DC front end, and another to generate a 50Hz "square wave with bites out" for the fullbridge DC-AC back end.

Another used a similar front end (can't remember the exact controller chip) and for the back end it used a quartz crystal (for a precise 50Hz) and 4060 divider chip, followed by a ring counter and diode logic to generate the square wave with bites out. This drove a MOSFET fullbridge through discrete bootstrap drivers made with HV transistors. (You can't use an ordinary gate drive transformer for the output fullbridge, as they can't handle the 50Hz component of the gate drive waveform you need. You'd need either a solid-state high-side driver like the IR2181, or optoisolated drivers like the TLP250, or an iron cored GDT...)

Both DC-DC front ends used the push-pull converter with centre tapped primary. It seems to be preferred over the halfbridge for lower voltages (each MOSFET sees twice the voltage and half the current compared to the halfbridge) I guess you could use the transformer from an ATX PC power supply for this without any modification.

Personally if I was building an inverter I'd go the extra mile to make it a true sine wave output. True sine wave units are a lot more expensive to buy, so you save more by building it. And the cheap "square wave with bites out" units hate capacitive loads because the fast edges of the waveform force huge currents through the capacitance. Getting true sine wave output just means driving the fullbridge back end with the PWM waveform that makes a sine wave, and bunging a L-C filter on the output.
Re: switch mode mains inverter questions
Avalanche, Sun Aug 20 2006, 11:21AM

I totally forgot about how I was going to drive the fullbridge at 50Hz, thanks for the tips! Depending on how long it takes me to get the regulation working at 325VDC, I might be tempted to go for true sine also. I'm going to rewind the transformer now with a new center tapped multi filar primary, and drive the thing with 2 large IGBTs!

As for the controller chip, it looks like the SG3525 is quite popular for inverters, as I found one in my 150W as well. If I can find that chip in one of my old ATX PSUs I'll use that, but it looks like I might have to use TL494 at first.
Re: switch mode mains inverter questions
Marko, Sun Aug 20 2006, 05:20PM

Both DC-DC front ends used the push-pull converter with centre tapped primary. It seems to be preferred over the halfbridge for lower voltages (each MOSFET sees twice the voltage and half the current compared to the halfbridge) I guess you could use the transformer from an ATX PC power supply for this without any modification.

'push pull' drive are basically two flyback converters in antiparalell. WIthout some kind of resonant drive each switch is going to see large voltage spikes (very large, you can get 100's of volts frem 12V supply). Produced voltage depends simply on leakage inductance and dI/Dt of primary. Those need to be consumed by some kind of snubber network, and in order not to dissipate large amounts of power on it good regulation must be established beforerunning the thing at full power.

Ofcourse it can be made to work (and very well, + no GDT and just 2 switches) altough just a H bridge seems easier in some cases.


Getting true sine wave output just means driving the fullbridge back end with the PWM waveform that makes a sine wave, and bunging a L-C filter on the output.

In lack of bootstrapped drive you could try using P-channel mosfet's, altough it seems hard to find ones capable for 500V.

If you like to isolate low-frequency drive you can rectify a free winding on the HF transformer.



Re: switch mode mains inverter questions
Marko, Sun Aug 20 2006, 05:22PM

[quote]
Both DC-DC front ends used the push-pull converter with centre tapped primary. It seems to be preferred over the halfbridge for lower voltages (each MOSFET sees twice the voltage and half the current compared to the halfbridge) I guess you could use the transformer from an ATX PC power supply for this without any modification.

'push pull' drive are basically two flyback converters in antiparalell. WIthout some kind of resonant drive each switch is going to see large voltage spikes (very large, you can get 100's of volts frem 12V supply). Produced voltage depends simply on leakage inductance and dI/Dt of primary. Those need to be consumed by some kind of snubber network, and in order not to dissipate large amounts of power on it good regulation must be established beforerunning the thing at full power.

Ofcourse it can be made to work (and very well, + no GDT and just 2 switches) altough just a H bridge seems easier in some cases.


Getting true sine wave output just means driving the fullbridge back end with the PWM waveform that makes a sine wave, and bunging a L-C filter on the output.

In lack of bootstrapped drive you could try using P-channel mosfet's, altough it seems hard to find ones capable for 500V.

If you like to isolate low-frequency drive you can rectify a free winding on the HF transformer.



As for the controller chip, it looks like the SG3525 is quite popular for inverters, as I found one in my 150W as well. If I can find that chip in one of my old ATX PSUs I'll use that, but it looks like I might have to use TL494 at first.


I somehow prefer SG3525. It has nicer output stage adn can drive most MOSFET's and GDT's directly at lower frequencies.
Re: switch mode mains inverter questions
Sulaiman, Sun Aug 20 2006, 06:09PM

Don't worry,
Push/pull transistors only 'see' just over twice the supply voltage,
the positive voltage on one side of the windings is clamped
by the diode on the other side via to 0v.

There is some leakage inductance 'spike'
but if you wind bi-filar this will be small.
Re: switch mode mains inverter questions
Marko, Sun Aug 20 2006, 06:45PM

As you say yourself, you don't have an ideal transformer there so spike will appear anyway; energy must go somewhere, and since it needs time to rectify trough another-winding diode or drain trough secondary you can see some pretty high voltage appearing there in reality (L*dI/dt as maximum)


Snubber network can help it but it usually ends wasting large amounts of power unless coupling is made best possible.

Running at low duty cycles when it isn't needed also helps saving power for somewhat.
Re: switch mode mains inverter questions
Avalanche, Mon Aug 21 2006, 09:54PM

wrote ...
If you like to isolate low-frequency drive you can rectify a free winding on the HF transformer.

That's a good idea amazed

I was thinking though, if I'm pwm'ing the output for true sine, I should be able to use a couple of GDTs perhaps, because of the higher frequency carrier? The only problem is that two of the opposing MOSFETs would need to be held off during each 'half-cycle' of the mains... would the shorting of the gate to source through the unused GDT windings be sufficient?

Hope this makes sense, sponsored by JD+coke amazed
Re: switch mode mains inverter questions
Marko, Mon Aug 21 2006, 10:09PM

Output PWM is done at low frequency, in the way that you add deadtime between output cycles.

If you just chop 320VDC rms you will get square wave wich is also 320V rms, and to get that to 230V you need duty cycle percentage that is (230/320)*100% = about 70%.

When you feed that to LC filter you will get nice sinewave 230Vrms output.

Simplest way to do that is just another SG3525 or etc. with common bootstrapped driver like IR2112.
Maybe you could even desing your own bootstrap circuit out of discrete components for fun, since frequency is low and switching times aren't paramount.



Re: switch mode mains inverter questions
Steve Conner, Mon Aug 21 2006, 11:53PM

Avalanche: If the PWM waveform is going to reconstruct into a 50Hz sine wave, it has to have a big 50Hz component that will saturate an ordinary GDT. In other words, the duty cycle has to vary between 0 and 100% at a 50Hz rate, and GDTs struggle with duty cycles far from 50%. (The bipolar gate drive used in PC power supplies doesn't count because they turn every other cycle upside down. It's not what you want for an inverter.)

That's what I believe anyway. You can pull fancy tricks with diodes and reset networks to let a GDT pass wide ranges of duty cycles, or you can wuss out and use something like the IR2181 or TLP250.
Re: switch mode mains inverter questions
Avalanche, Tue Aug 22 2006, 12:33AM

wrote ...
...and GDTs struggle with duty cycles far from 50%.

You probably saved me a few days of my life there, I was thinking I had everything ready to go cheesey

Hmm onto plan B... I'll grab an isolated 12v supply from the transformer, to provide drive to the 2 upper MOSFETs, and opto-isolate the drive signals as well. I have the sine generation sorted anyway, I'll be using a PIC to generate the sine wave using 1 6 bit port, and the other port can host a bit of trickery maybe. I'll post a full (so far) schematic soon, to see what you guys think.
Re: switch mode mains inverter questions
Steve Conner, Tue Aug 22 2006, 09:34AM

Sounds good! smile If you want a copy of the PIC code I used for my original inverter, just let me know. It was designed to phase lock to the mains and sell power back to the grid, but you should be able to wedge it easily so that it runs standalone. It was an open-source academic project so you guys can blag any bits you like tongue
Re: switch mode mains inverter questions
Avalanche, Tue Aug 22 2006, 04:47PM

sure, if I could have a copy of the code that would be awesome, thanks smile

What PIC did you use? I'll probably have to modify it to work on a 16F684, but it's mainly the sine generation i'm interested in, ie how you get the right shape.

schematic (incomplete and full of bugs) will be posted soon cheesey
Re: switch mode mains inverter questions
Marko, Tue Aug 22 2006, 05:02PM


May be a bit more complex but sounds interesting anyway..

If I get it right pic again uses high-frequency PWM that models sinewave using a H bridge?

I wonder if you could then simply eliminate low-voltage HF oscillator and use pic to generate 50-HZ envelope on transformer output (ala bridge rectifier envelope) and then just put it into sinewave by asquarewave-driven H bridge?

Altough I don't know wich is harder from that.

If you ask me I would just use another SG3525, set correct rms voltage and stick a big LC filter on output.. :p
Re: switch mode mains inverter questions
Avalanche, Tue Aug 22 2006, 06:45PM

I think I know what you mean, but anything that interfered with the DC-DC stage like that would make it impossible to achieve regulation... if i'm on the right tracks.

I'm just using the PIC to synthesise a nice sine wave at 50Hz, this is then used to modulate the duty cycle of a higher frequency carrier (triangle) through a comparator. The result is that the duty cycle of the high frequency goes from high to low in time with the 50Hz sine wave, and this drives your fullbridge. hope that makes sense cheesey

The problem with just driving the output with another PWM chip and using a filter is that the power factor can be all wrong depending on what your powering from the inverter, ie there could be an impedence mismatch to the load which would waste power, so that's the reason to use true sine. It should also be quieter...

I think this is all mostly correct, but I am trying to learn as I build this thing smile
Re: switch mode mains inverter questions
Marko, Tue Aug 22 2006, 07:04PM

DRSSTC seems to work fine similar way, just on higher frequency.

Afer thinking again deadtiming of output probably isn't even needed when you can regulate your DC voltage - simply set the DC-DC converter for 230VDC, chop it at 50Hz and filter it.

Low frequency bridge would be fully soft switching that way and actually less power lost (?)

Re: switch mode mains inverter questions
Steve Conner, Wed Aug 23 2006, 10:20AM

The way Avalanche described the sine wave generation is the way my inverter worked. The PIC generated the 50Hz sine wave that modulated an ordinary PWM generator. It used a PIC16F84 and the sine wave was stored in a lookup table. I described it all in the appendix of my thesis Link2

Firkragg just mentioned another method of true sine wave generation that I have seen used. You modulate the DC-DC converter stage to produce a full rectified sine wave at 320V peak instead of a steady DC voltage, and then you use a MOSFET H-bridge switched at 50Hz as an "Unrectifier" smile (it's called an unwrapper in the literature)

The advantage of this method is lower drive and switching losses, since the high frequency PWM is applied to the DC-DC converter that was switching at high frequency anyway. The four output MOSFETs just plod along at 50Hz.

The disadvantage is that you can't drive reactive loads without the feedback losing control and the waveshape going crazy. (Unless you make your DC-DC converter bidirectional so that it can feed current either in or out of the batteries under control of the feedback loop.) PWMing the four output devices gives full four quadrant operation that can drive any reactive load.

I'll dig out the code later this week :P I'd love to see this project get a new lease of life. Eventually I'd like to see it grow into an all-purpose bidirectional inverter that can be a standalone power source with batteries, or recharge the batteries from the mains, or sell extra power back to the mains if you have solar panels charging your batteries.

Re: switch mode mains inverter questions
Avalanche, Thu Aug 24 2006, 07:55PM

I've been reading your thesis Steve, that's some interesting stuff! That's the kind of thing I hope to do one day for my final project, when I eventually go to Loughborough to study EE (future plans).

I suppose when the mains lock is lost, you could switch the 'software pll' onto using an internally generated 50Hz reference... I dunno, you'd still need to keep an eye out for the mains coming back on. This is the kind of stuff that needs to get noticed if distributed / local power generation is ever going to get the go ahead. I think grid-tying my inverter will be a bit beyond me, plus I have no real way of testing it. I'll probably use a cut down version of your code in my inverter, or just bodge a 50Hz 555 in to make it work cheesey

After the 29th August I'll have all the time I want to work on this inverter...

Re: switch mode mains inverter questions
Marko, Thu Aug 24 2006, 09:02PM

I think you can get pretty nice sinewave output with just chopping the output with NE555, sg3525 or whatever you like and filtering it.

For filter I would use some large value caps (470uF caps with diodes) and 21 milihenri choke to get it resoannt at 50.65Hz :p

I would wind the coil on a stem core (like ignition coil) to be able pushing more power trough less weighty inductor (while keeping smaller number of turns). If you want sinewave.

If you want to sinchronyze with mains I would do it rather directly, by turning output of a small transformer into squarewave and driving the bridge with it (you need to watch phasing).

It would be practically same circuit that is used for synchronous rectifying at mains frequency:

Link2

Re: switch mode mains inverter questions
Avalanche, Fri Aug 25 2006, 03:30AM

I guess you could do something like that, but the only problem I can see is that it would be too in phase with the grid. I think you would need to be slightly out of phase, so that there would be a load for the inverter... not sure which way it should be though. I guess if it lags behind the grid, it'd be easy to stick a delay in. Must resist making it grid tied for now though, anything I connect directly to the mains seems to result in powercut and angry parents cheesey

Anyway trawling through Steve's code at 4.30am is probably not a good idea amazed

Re: switch mode mains inverter questions
Marko, Fri Aug 25 2006, 11:37AM

You can always put a your own fuse in there (wich is a very good idea) to prevent powercuts..
Re: switch mode mains inverter questions
Avalanche, Wed Aug 30 2006, 10:56AM

Ok, time for a schematic

First plan is to get the DC-DC stage working, and most of all the control loop. I haven't quite cracked that part yet, I can't decide whether or not I should tie the grounds together on the low voltage and high voltage side, then do the feedback bit with a simple potential divider on the output of the 325VDC, or use an opto-iso. I'm considering just tying the grounds together, to save myself hassle rolleyes

The schematic also shows the isolated gate drive sections (2 of the same circuit, I think it should work) and the PWM circuit. I'm running the TL494 in common emitter config, and using one of the error amplifiers for the feedback. I think efficiency might suffer if I don't optimise things like excessive gate drives, but I want to get something that works first...
1156935390 103 FT14832 Inverter1
Re: switch mode mains inverter questions
Marko, Wed Aug 30 2006, 11:09AM

I'm a bit confused though: I never seen those MC35151 drivers before, do you have a datasheet confused

Also, if you are planing to isolate the gate drives thgat way, you are going to need 4 of them for fullbridge.

Steve Conner wrote ...

..you need at least 3 separate power supplies. Sure, the collectors of the top two IGBTs are connected together, but the gate drive has to be referenced to the emitters, which are connected to the RF outputs.

You can use a common power supply for the two bottom gate drivers, but like most people, I used 4 completely isolated supplies and drive signals. It's not really that much more hassle and you don't have to worry about the L*di/dt voltages that tend to appear between things that are supposed to be "connected together" in power electronics.



Exscept that it looks very good smile
Re: switch mode mains inverter questions
Conundrum, Wed Aug 30 2006, 08:58PM

I recently discovered a way to generate stable PWM sinewaves using PIC as a shift register preprogrammed with the correct sequence,

Might help.
-A
Re: switch mode mains inverter questions
Avalanche, Fri Sept 01 2006, 11:22AM

Sounds interesting smile Is this a similar way to what Steve has done, ie store the shape of a half cycle in eeprom, then on every timer interrupt increment the pointer and read the contents of the eeprom onto the port...

wrote ...
I'm a bit confused though: I never seen those MC35151 drivers before, do you have a datasheet

here's a datasheet. I have loads of those drivers, nice fast little dual inverting drivers. That schematic is out of date now though, I've switched to UCCs on the DC-DC stage now, because they have the enable pin that I need for the remote control. I figured the easiest and most efficient way to but the thing into standby was to disable the gate drive on the DC-DC converter.

It's just a good job this thing isn't going to be mass produced!!