PIC controlled 500w ‘Modified Sine Wave’ Inverter

Click for larger view

Here is a simple but powerful, stable and efficient schematic diagram for a 500w modified sine wave inverter circuit. Originally I used a 555 timer and a CD4017 decade counter to produce the modified sine wave, but then I thought a simple PIC micro controller with its internal clock would produce a stable 50Hz frequency without the need for two IC’s. As you can see its a very simple circuit. The CD4017 and 555 Timer circuit can be seen here should anyone want to try that.

Some information on this circuit. The PIC16F628A is programmed to produce a logic 5v signal for 5ms at pin 17 then 15ms off. Then the same at pin 18, 5ms on then 15ms off (4.17ms for 60Hz). That is one cycle which is then looped. This results in the signals below on the oscilloscope. (2 channel view) You can see the two 5v pulses from pins 17 & 18.

The two separate 5v pulses 180° apart

These two pins are then sent to the gates of the STP55NF06L (or STP36NF06L) logic MOSFET’s. These are special power MOSFET’s that require just 5v to switch on fully. They also have a very low 0.014Ω Source to Drain resistance when on which means they can switch high currents without wasting power as heat. This keeps the whole system efficient. They do run cool although a heat sink is required. The main losses in power will be within the transformer itself. They are capable of switching loads up to 55A (or 30A for the STP36NF06L) which makes this a powerful inverter if used with a large (~800VA) transformer. Of course you could use a smaller transformer for small loads. The MOSFET’s could be in parallel pairs for even more power. Just give each its own 470Ω gate resistor and a 22kΩ from each gate to source. I get around 240v AC from the 10-0-10 with a 12v battery but as this circuit is so efficient a 12-0-12 should give you no less than 220v AC at 12v. Of course if you live in a country with 120v, you can just use a 10-0-10v to 120v transformer. If you need 50Hz or 60Hz the PIC files ready to be programmed are at the bottom of this page. The transformer is wired up in reverse. We are using the low voltage side as the primary, and the high voltage side as the secondary. The low voltage side must be centre tapped. I might add I have not tried this circuit at 500w as I don’t have a large enough transformer at the moment, but the 55A MOSFET’s should be fine. I am going to rewind the secondary of a microwave oven transformer with about 11-0-11v and see how that goes, although I don’t think they are the most efficient transformer cores around. Still, it could be an easy and cheap way to make a 500w centre tapped transformer for this project. Will need some chunky primary wire! Its certainly not worth buying a large transformer for this project. For the price of that you could buy a commercial inverter or three. That’s no fun though is it! Also don’t forget that even to run a 100w load you will need 12v at almost 10A (calculator). Small sealed lead acid batteries are not going to be much help apart from to light your Christmas tree or charge your mobile phone.

The image below is the modified sine wave output you will get from this circuit. It is the same as most of the commercial inverters that are out there that aren’t pure sine wave. The advantage for the inverter with using a modified sine-wave is that the MOSFET’s are either fully on or fully off, never operating in their linear region which would cause heating and poor efficiency.

The modified ‘sine wave’, seen on the oscilloscope.

The prototype driver board.

Note the large 1000µF capacitor and 47Ω resistor. These clean up the voltage spikes coming from the transformer centre tap into the positive rail and protect the PIC from them. I learnt the hard way and burnt out 2 PIC’s before looking into the problem with the scope. Don’t think that the 5v regulator will fix the spikes! It and the PIC got hot and then the PIC died. Twice! The image below shows what the power supply looks like at each end of the 47Ωresistor Left is power supply end and right is regulator end. This is with no load on the transformer. The spikes and waveform of them changes with load. The simple resistor and cap cleans it up. This works because the 1000µF capacitor will be seen as a low impedance to a voltage spike. The 47Ω resistor limits the current, so the spikes are dissipated in it as can be seen below.

If you wish to build this circuit you will need a PIC programmer to program the microchip with the HEX file below. I would be interested to hear from anyone who has built this circuit and what results you have had so please let me know!

50Hz HEX file for programming the PIC16F628A 16F628A_50Hz_Inverter.zip
60Hz HEX file for programming the PIC16F628A 16F628A_60Hz_Inverter.zip
Disclaimer: This circuit provides high voltage so great care should be taken not to become a part of the circuit when operating! Also this inverter produces a modified sine wave that is unregulated. If you put 15v in (or more) you will get much more than the 240v out just as with 10v you would get under 200v output. Output voltage differs with input voltage so as your battery discharges, so will your handy mains supply. While its fine running some light bulbs or simple mains equipment, I wouldn't use it for that new plasma TV or anything expensive if you are unsure! Most things will be happy with a modified sine wave and its certainly much better than the basic square wave inverters that are about. Bottom line is I accept no responsibility for damage to equipment or yourself as a result of the information on this page.
Share this...Tweet about this on TwitterShare on Facebook328Share on Google+0Email this to someone


Add a Comment
  1. Could a sine wave generator chip be used, such as an Intersil 8038, to control the mosfets to get a pure sine wave?

    1. You could, but the MOSFET’s would no longer be acting as a switch and would have to dissipate lots of power making it highly inefficient.

  2. Thanks for answering my question. I was thinking that a high power amplifier could be modified to run on 12VDC and driving it with an 8038 sine wave generator. Alternatively, could more steps be incorporated into the pseudo sine wave so that it is closer in shape to a sine wave?

    1. I am not going to try and create a pure sine wave inverter. Its beyond my scope of electronics to attempt an efficient design anyway! Good luck though.. 😉

  3. thank you very interesting project the best ever
    best 73
    de mohammed basha su3mb

  4. Is there any circuit you can reccomend me to use so that I can program this ic

    1. Hi Ainsworth.

      You could use something simple like a PICAXE for this circuit, instead of what I used. It would make programming simpler.

  5. when I searched that I saw like it has a editor to edit or create programming for a chip, but I dont want to edit your file I am looking to build a hardware to program the Pic Ic itself to use.

    1. Ahh, ok. I used a USB PIC programmer…

  6. John – would this work at a higher switching frequency (=simple software adjustment), beyond 60 Hz? For my intended application, I’ll just rectify/filter the output (getting back to DC), so I’m curious if a higher frequency would be compatible with the circuit and transformer, possibly allowing greater power and/or reduced transformer size? Thank you!

    1. Hi Dave.
      I’m sure you could build a much better design using a higher frequency and smaller cored transformers, like a switch mode power supply would. A standard iron core mains transformer is built for 50/60Hz though.
      Good luck! John.

  7. i had tried your circuit using pic controller. circuit is working but i got 4v ac as mosfet output, how to increase output.

    1. Hi Parthi.

      If you are testing the output of just one mosfet, you will only be seeing half of the waveform and even then its not the peak value. To test it properly, I would add a pair of 1k resistors from each drain to positive on both mosfets, then put your meter across both drains. This should give you the RMS value. Multiply that by 1.41 to give you the peak value. This should be about double of the input voltage.

      Hope that makes sense and good luck!


  8. Hi everyone!

    I made the circuit with the 555 and the 4017 , but I realized that the frequency that comes out of the 555 too high ( it is in the range of kHz ), while the duty cycle is good .

    The problem is precisely the value of the capacitor 1 nF (the one that is connected to PIN 2 and 6) which is too low . To resolve this problem use a 10 nF capacitor.

    it is also wise to replace the other capacitor with a 1 nF 10.

    1. is this circuit gonna work perfectly with 555 and 4017??

      1. It works, it’s just a fun circuit.

    2. Yes you are correct. I used this 555 calculator and it really helped me get the Values down to a nat’s ass R1>10k – R2>355 – C>.01uf = 200hz….See Calculator:


      For R2 I used a 300K metal film + a 100k Trimmer
      I was able tune in 200hz at pin 3 on the 555 easily and then (in my case)60hz on pins 2&7 on the CD4017

      1. I found a way to use a IRF3205 instead of the logic MOSFETS.
        Add Driver circuits between each pin 2 and pin 7 of the CD4017 and the IRF3205
        by adding a 2N2222 with a 1k to the Base and 1k to the Collector>>


        The transistor must connected to the 12v supply before the regulator

  9. I built the one with the 555 and 4017, I am getting 50% duty abut frequency on 12v transformer is 282hz 80v and I tried a 9v and I got 282hz and 172v sams duty cycle, seems i have to use a 10v transformer but why is the frequency so high?

    1. Sorry, I am not sure why! Check the 555 output and/or component values.

  10. I found the problem. I would like to try the version with the micro controller but I cannot program it I built 2 circuits to program it but none of them picked up on my laptop, I tried to use ic programmer and micro programmer. could you give me a way to program it.

  11. This is a Modified Square Wave>>>>>>>>>>Right????

    1. Yes, you could call it either!

  12. I found a way to use a IRF3205 instead of the logic MOSFETS.
    Add Driver circuits between each pin 2 and pin 7 of the CD4017 and the IRF3205
    by adding a 2N2222 with a 1k to the Base and 1k to the Collector>>


    The transistor must connected to the 12v supply before the regulator

  13. I finally programmed the pic and I got the circuit working, at 12.27 volts from the battery I got 95v from my 12v transformer so I decided to plug my fan in to test it before I could even turn the fan on one of the fets blew out what caused that? I am wondering if its because the resistors at the gate of the fet are 1/4 watts.

    1. There is virtually no current at the gate, so the resistors won’t be a problem. If its a large transformer, the inrush current might be a problem.

  14. So what would I have to do in order to use a large transformer?

    1. Perhaps make sure the MOSFET’s are being switched on fully. Maybe limit the inrush current somehow. I have not had this problem, but the project was built for fun!
      Good luck, john.

  15. hi John M0UKD.
    i just notice that their is no crystal oscillator in the diagram between pin 15 and 16.
    do i need the pic to program first before connecting all components?
    does it need to connect and crystal oscillator? can i use other MOSFET’s and parallel it for high power output??

    1. Hi.
      The circuit uses the PIC’s own internal clock. I would program the PIC externally before fitting into the circuit.
      This is an old project that was made for fun.
      Good luck, John M0UKD.

  16. love the top header circuit boards and homebrew great site

  17. do i need optoisolator to protect pic?

    1. I never used one, its up to you!

  18. How much would be the output voltage if the battery voltage 13.8? Or may be 14.7?

  19. how to generate sinewave through hardware only

    1. A signal generator.

  20. again I’m here,

    as i read all the details. that you say it efficient and produce less heat and run at cool.
    can you design an h bridge? of this mosfet STP55NF06L?

    1. Yes, you could certainly adapt this into a H bridge with 4 MOSFET’s.

Leave a Reply

Your email address will not be published. Required fields are marked *

sixteen + = twenty four

M0UKD Amateur Radio Station Information Page © 2007-2017.