Adaptable 12vDC/220vAC Pure Sinewave Inverter

Picture of Adaptable 12vDC/220vAC Pure Sinewave Inverter
Here is a very simple pure sinewave inverter based on the microntoller "PIC 16F628A", "don't freak out !", NO it is not difficult to use microntollers, actually it could not be any easier than this.

For those wondering, Yes I myself designed the circuit concept, schematic and components but had to hire a programmer to write the code since I have no idea how to write software programming, I even paid him money to do this job since no one works for free these days, probably if he see this instructable he would be laughing at me on how I gave everything for free here :-/

The principal used for creating the sinewave:
Most hard work in this circuit is done by the 16F628A chip itself, where it divides the half wave into small segments generating PWM train of pulses to create each half wave as shown in the pic, generated oscillation then go to get amplified by the 4 transistors Q1,Q2,Q3 and Q4 where they feed the power stage to drive the power transistors. Can't be much simpler than that !

There are 2 options to program the 16F628A:
1- Most of the electronic parts selling shops do this service for you for an additional 3$ cost, where you take the program which is a "Inverter.HEX" file in our case, written on a disk to the shop and they will hand you an already programed 16F628A.

2- If you're an electronic hobbiest I suggest you buy your own programing device (I bought mine for 22$) and experiment with it because the microcontroller applications that can be built are endless. I bought the cheapest / smallest USB one which is a DIY K128 it came along with a CD containing the MicroBurn software "older versions known as MicroPro" and a driver for your computer, after setting up the driver and operating the thing, it programed the 16F628A IC in 10 seconds !
Here is a link to see how the programmer looks like.

Note: Both 16F628 and 16F628A will work, the difference is that the 'A' has more memory capacity, but both work the same.

The filter:
The 2.2 uF capacitor which is the filter is a very very important part of this design, without it you'll never get a pure sine wave.
I have included 2 screen shots of the oscilloscope (with-filter and without-filter) so you can see the difference and importance of this capacitor.

Other notes:
- Included is the movie file "IMG_0690.MOV" in case you encounter any problem and need to see the wave form on pins 11 and 12 of the 16F628A how it looks like.

- The PIC16F628A is so sesitive to static, if you're sitting on a plastic chair never touch the IC's pins with your hand.

- You can build bigger versions of this inverter up to 5000w, to see what needs to be done on the power stage please see details on my other instructable here

- Heat sinks are required to cool the power transistors they should be big enough to cool the transistors, they are separate and should NOT touch each other.

- Wiring connections marked in dark black on the power stage section should be thick enough to handle the big amps drain from the batteries.

- A cooling fan will be needed to reduce heat off the heat sinks and transformer.

- Be cautious when building this circuit it involves high voltage which is lethal, any part you touch when the circuit is ON could give you a nasty painful jolt, specially the heat-sinks, never touch them when the circuit is on to see if the transistors are hot.

Do not forget to rate this instructbale with 5 stars "of course if you like it and appreciate the effort done" and also click the "follow me" button to keep updated of future instructables and updates that I do.

We need to get this inverter to perfection by adding some more options to it like:
- Low DC Battery voltage detection to trigger a buzzer and a to auto-stop oscillation at some point.
- Heat detection to trigger a fan ON
- Battery level indicator 3 LEDs (High-Medium-Low) and to trigger charger ON
We'll need some help to code the above..
so any suggestions, help in coding or design on this project to make it better are very welcomed so send your thoughts.
1-40 of 407Next »
EdoNork9 days ago


Nice project. I'm willing to test it. Thank you very much for sharing.

Is there any link to a proper PCB artwork? The one posted in the article is blurrer by JPG artifacts.

Thanks in advance.

Hi Nick

This is Amir Dimitry

I have built the circuit of power 2000VA, using 16 mosfets of type IRFP264 and 2000 VA transformer of 22-0-22 v primary /240v secondary.

I have connected pins 11&12 of the microcontroller pic16F628A directly to the gates of mosfets through a 1K Ohm resistor. When the circuit is working on no load, the output voltage is 230V, 50 HZ, with 2.2 microfarad capacitor on the output . When I apply load of 800 wattes to the transformer, the output voltage goes to 80 volts.

please advise


UmairH19 days ago

Amazing Project bro, i made it using tip35c, just one problem. A transformer is of 50 60 hz normally, you are working on 3 khz, so one i connect the transformer it makes alot of noise which is no doubt because of high switching speed, if my frequency is high then i think the size of the transformer will be smaller. Is there any way i can stop this cuz i cant find a ferrite core transformer. suggestion anyone?

sir??? wat will happen in the circuit if the our battery is 48v? do we have to change the voltage regulator???

sanmlight1 year ago
Hi chuksthewoundy,

i don't have a oscilloscope to test the wave form of this circuit.

DMM testing...
12-0-12 12amp transformer , IRFz44N 4pcs
with capacitor 2.2uF:
without load = 218Vac
with load 40W = 199Vac

without capacitor:
withoutload = 238Vac
withload 40W = 214Vac

i'm using 60Hz without on/off hex file.
the on/off functionality is still not working with me even i change the push button switch.

From what i can see its working properly.
1.check if the battery voltage drops when you add a load. measure the Amperage drawn with and without load. and reply!
2.Also test it using an ac fan. The fan should run smoothly at full speed without any noise, this confirms you have a clean sine wave.
nickk (author)  chuksthewoundy1 year ago
I made many many tests yesterday, here are the results:
-Transformer used 12-0-12  80VA
-1 pair of IRFz44N 
-DC supply : 12.5VDC

Results with NO filter:
-Output voltage: 210VAC not stable (playing rapidly between 180 to 210)
-Waveform: -Witdistorted, has no shape and can't get a reading on the frequency.
-With Load: A 18w compact fluorescent lamp (CFL) was connected, voltage dropped to 190vac, DC still 12.5v

Results with filter:
-Output voltage: 166VAC stable
-Waveform: Sinewave, 61Hz
-With Load: A 18w compact fluorescent lamp (CFL) was connected, voltage dropped to 153vac, DC still 12.5v stable.
-amperes consumption up to 1amp
-Gate driving voltage: 11.5vdc or 3.28vac
-Primary voltage on the transformer: 12.40-0-12.30

In short, this is exactly what happened with my original design and that's why I have in my schematic a 6-0-6 primary transformer.

Hi Nick, as I mentioned in my previous post; I asked transformer manufacturer to provide me a 500watts 12-0-12 transformer -- will it work with this pure sine driver? I'm really interested about finishing this, your help will be greatly appreciated :) Thanks

electric fan wont run fast and the voltage dropped from 218vac to 157vac
Hi samlight .....i also experienced the same thing the output voltage drops when the inverter is loaded and i discovered that the drive voltage from the oscillator was not enough, so i used an op amp amplifier to boost the voltage. now the output only drops a few volts when loaded.
nickk (author)  sanmlight1 year ago
The waveform is a pretty clean sinewave and the freq. is exactly 61Hz. Please increase the load by an additional 20W or 40W to see if the "with load 40W = 199Vac" will decrease further or it stablised on 199Vac. Be careful not to reach the limit of your transformer. If it decreases further it means that the problem is with the transformer.
every additional load the voltage will dropped 20vac. the dc supply is stable.

for a 60 watts electric fan it wont run fast. the voltage dropped from 218Vac to 157Vac
i will post the schematic for the op amp amplifier that i used.... when i am done testing...
kindly test also the on/off functionality.

I've a quick question Nick; I was able to purchase a 16F628A -- however, I'd like to know if there's a need for me to "program" it using the .HEX file you attached herein?

obagi2 months ago

hi can i buy the IC programmed from you ?

my email

thank you

Lubous2 months ago

Hi Nickk!

Can I use IGBT? (Euptec IGBT BSM200GA 120DN2SE3256)

What are the possible adjustment of the excitation transistors.

Thank you for your response.

slimp2 months ago
alfathia3 months ago

hello nikky

hw can i get this pure sinewave circuit diagram with the code please


maclee4real3 months ago

hello Nickk, thanks for the wonderful topic, please is there a way you can upload the the code in .c language?

please i know it will make us understand this more and to modify the project and add more function to it. For educational purpose.

Is there a way you can ask the
programmer for the source code, i think we can use it to modify this
design, like adding an LCD, and charger to the microcontroller.



creativeasad11 months ago
Hi nick!, good day.
want to ask the logic that you used in the PIC uC.
means its creating a pulse with different width each time but for how much milliseconds.
nickk (author)  creativeasad11 months ago
Hello creativeasad,
As I mentioned before, I'm not good at coding and had to get help from a coder to do the programing part. I really don't have much details on this part.
maclee4real nickk3 months ago

Is there a way you can ask the programmer for the source code, i think we can use it to modify this design, like adding an LCD, and charger to the microcontroller.


maclee4real3 months ago

hello Nickk, thanks for the wonderful topic, please is there a way you can upload the the code in .c language?

please i know it will make us understand this more and to modify the project and add more function to it. For educational purpose.


abuhafss3 months ago

Hi Nickk

Pleased to see your simple design, and really amazed & appreciate your sharing.

I just need your confirmation, for a 1000W & 1500W do we need 2 x 12V batteries and 12-0-12 transformer?

nickk (author)  abuhafss3 months ago

I suggest you build my other inverter, it is 100% heavy duty & reliable, better than this one.

abuhafss nickk3 months ago

Actually, my requirement is 1000W and I want use it at my farm where there is no power. I plan to set-up a charging system in my car for an extra battery, which I will use with this inverter.

henry_oshomah4 months ago
henry_oshomah4 months ago
acky24 months ago

Hi every one!

First special thanks to nickk for his all wonderful articles specially on power electronics, I want to use the same nickk's circuit for my inverter, but am using pic 16F877A & 20Mhz crystal can any one help me with source codes.

My email is, hope to here from you soon.


What is the rating of transformer is it 12-0-12 or 6-0-6 .? Thanks in advannce

mpavlovič45 months ago

hello nickk and others!
Can anybody please tell me what kind of transformer should I use?
I tried with toroidal transformer, but it does not work.
Thank you for your answers!

ggadogbe6 months ago
Hi nikk thank for helping some of us for opening our eyes in power electronic. I want to ask if can i use IR2110 gates driver with a mosfets and drive in H-BRIDGE with PIC16f628A have a pure sine wave if am wrong let me know pls is my email:
ggadogbe6 months ago
Yes this what i want. Hmmmm the circuit look simple and let me ask why did pic did not have mosfets as it out put. I hope it works hmmm.
twyeth6 months ago

hi nick

ive built the circuit but the only piece thats got me stuck is x1 on your diagrams, i cant work out what values or anything is, novice electronics builder:)

bisudw6 months ago

can i do this to get 110v ac from 6v 4.5ah battery???

FATEHROMIA6 months ago

very good

dnc400856 months ago

Great Instructable, very informative. I would also like to take a look at the source code if possible as I would like to port it to an AVR

arunvtkl6 months ago

hi nickk plese give 50 hz sinwave Program in ASM COD

i using MPLAB IDE

scinova7 months ago

Hi Nickk,

Could you post the source code?

1-40 of 407Next »