DIY Pure Sine Wave Inverter - Page 1
Forum section: electronics / projects

author: 09d08
author_rank: Contributor
timestamp: August 20, 2018, 09:56:24 pm
content: Hello,I'm trying to design a pure sine wave inverter based on an AVR MCU but I'm not really sure what kind of design I should go with. So far I've managed to implement sPWM on an ATmega328 and verified that it was working as it should with the help of two low-pass filters. (Attached a picture of the waveforms.)I've tried experimenting with a 24v:220v center-tapped transformer (1uF film capacitor connected to primary for filtering and the center tap of the secondary connected to 12v) and I've had mixed results. I've tried connecting the remaining two connections of the secondary to GND via two mosfets and tried to drive them with a TC4427 but I got a waveform that looked like a deformed square wave so I replaced the mosfets and the TC4427 with two BC548s and two MJE13007s which resulted with a perfect sine wave at the primary but the voltage was around 140VRMSinstead of 220VRMS.Firstly, should I just ditch the idea of using a center-tapped transformer? I saw other designs which use a DC/DC converter to convert 12V into 310V and a H bridge to modulate 310V DC into 220V AC and honestly they just seem more suitable. If a center-tapped transformer is suitable for such an application, how can I get the transformer to output 220VRMSinstead of 140VRMS? I've attached the source code of my sPWM program. Honestly, it feels like I'm missing something obvious.This is my first post here so sorry if this is not the right thread for such questions.

author: Audioguru
author_rank: Super Contributor
timestamp: August 21, 2018, 12:15:37 am
content: Your schematic is too small for me to see.

author: Ian.M
author_rank: Super Contributor
timestamp: August 21, 2018, 12:57:50 am
content: Your output voltage is almost exactly what you'd expect. Darlington pairs will drop about 1V (possibly more), so assuming 11V peak, that's 7.8V RMS. Transforming up with a 12:220 turns ratio gives 143V RMS.You need a transformer with an 18V 9-0-9, or 20V 10-0-10 secondary to have enough drive to get nominal line voltage out with a 12V DC bus with headroom for regulation. With your transformer you'd need an 18V DC bus.

author: 09d08
author_rank: Contributor
timestamp: August 21, 2018, 10:13:07 am
content: Quote from: Ian.M on August 21, 2018, 12:57:50 amGiving the circuit 18V instead of 12V did the trick, thanks. Do you have an idea why the driver IC and two MOSFETs couldn't produce a clean sine wave? It would be nice to be able to replace the BJTs with power MOSFETs for increased efficiency.Quote from: Audioguru on August 21, 2018, 12:15:37 amI forgot to attach them yesterday, sorry.

author: station240
author_rank: Unknown
timestamp: August 21, 2018, 01:32:46 pm
content: I see one obvious problem with your mosfet circuit, lack of gate resistors.I don't know anything about AVR hardware to understand your code, are you sure it's using PWM switching, as mosfets only do on and off, unlike transistors.

author: 09d08
author_rank: Contributor
timestamp: August 21, 2018, 01:47:05 pm
content: I'll rebuild the circuit with two 15 ohm resistors when I get home. My code changes the duty cycle periodically by looking up values from an array. I've tested it by connecting the sPWM signals to a low-pass filter and got nice half sine waves I posted in my first post so I think there's an issue with the hardware and not the software but I may be missing something.

author: Ian.M
author_rank: Super Contributor
timestamp: August 21, 2018, 01:48:29 pm
content: A TC4427 MOSFET driver pulls up to 1.8A from the supply when switching and has a risetime under 40ns driving a 1000pF load. If you don't keep its output traces as short as possible, have very good local decoupling and either a ground plane or minimal loop area star grounding to a point as close to the MOSFET sources as possible, it *WILL* misbehave. You can tame it a bit by adding series gate resistors as close as possible to the MOSFETs - 47R would be a good value to start with, but it depends on the MOSFETs and the switching frequency.

author: mdszy
author_rank: Unknown
timestamp: August 21, 2018, 01:49:05 pm
content: Quote from: station240 on August 21, 2018, 01:32:46 pm1. MOSFETs can definitely be used as amplifiers, not just switches...2. MOSFETs are still a type of transistor.

author: 09d08
author_rank: Contributor
timestamp: August 21, 2018, 07:35:46 pm
content: I added 39gate resistors and actually got a sine wave at the primary, but it wasn't as good as the one I got with the BJTs. My scope started to show a weird deformed waveform after a couple of seconds and I realized that the driver IC was too hot to touch (attached the new schematic just in case). If I'm not mistaken, there's nothing in my circuit that can cause the TC4427 to fail in such a way. Nevertheless it looks like the driver IC and the missing gate resistors were the problem.

author: james_s
author_rank: Super Contributor
timestamp: August 22, 2018, 05:27:10 pm
content: The IC may have been damaged, or it may be oscillating. Back before I knew better I used to have a lot of troubles trying to get any of those mosfet driver ICs to work properly. It turns out that proper grounding and good decoupling is critical with this sort of part. It will not work on perfboard wired with bits of wire from CAT5 cable as I used to prototype with.