pcbway




Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverter

Hello guys, in the last post I have explained the Basics of Inverters along with its types and also the inverters topology in other words working of inverters, then we discussed the Major Components of Inverters. Now in this post I am gonna explain the pure sine wave inverter and how to create it. I have used AVR microcontroller int his project. The reason I am using random microcontrollers is that so you guys get a taste of each one. Before starting on sine wave inverter read this article again and again as I have also mentioned the problem i got while making it. You should also read the Modified Sine Wave Design with Code.

I have divided this tutorial into four parts which are shown below. This is a step by step guide to design and build an inverter and I hope at the end of this tutorial you guys will be able to design your own inverter. I tried my best to keep it simple but still if you guys got stuck at any point ask in comments and I will remove your query. This project is designed by our team and they put real effort in getting this done so that’s why we have placed a small fee on its complete description. You can buy the detailed description of this project along with the complete code and circuit diagram, by clicking on the below button:

Note:

Pure Sine-Wave Inverter

  • Pure Sine wave inverter consist of a microcontroller unit which generates a switching signal of 15 KHz, an H-bridge circuit to convert the signal into AC, a low pass LC filter circuit to block the high frequency components and the transformer unit to step-up the voltages.
  • Block diagram of sine wave circuit is given below:
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverterFIGURE 1 : Block diagram of pure sine wave inverter

AVR Micro-Controller Unit

  • Microcontroller unit is a multi-purpose control unit which can handle multiple tasks simultaneously.
  • We have used it just to generate a switching signal of 15 KHz.
  • I am using AVR micro-controller unit for this pure sine wave inverter.
Explanation for PWM in AVR
  • AVR is acting as the brain of Pure Sine Wave Inverter.
  • Below is the program for atmega16 microcontroller with a clock frequency of 8 MHz (Fcpu = 8MHz). We have worked on a compiler named AVR GCC.
  • Initially we included AVR libraries,then we initialized sine table in which the values of a complete sine wave are stored (we generated a sin table in range 0-359 degrees whereas, zero of sine wave is set at decimal 128(0x80 in Hex).
  • Then in the next chunk of the code, we used timer0 (8-bit) which starts from 0 and peaks to 255 (it gives a saw tooth output).
  • The constant float step = (2*180)/256 = 1.40625 For i=0; s = sin (0*1.40625) = 0 For i = 255 s = sin (255*1.40625) = 358.5937 = 359deg approx.
  • This is how the sine wave is generated from 0-359deg.
  • When timer reaches 255 then interrupt over flow is generated (Refer the sine wave code, at the end).
  • The next part of the code shows that we have used the clock select bits as pre-scalar.
  • TIMSK| = (1<<TOIE0) means we are enabling timer overflow interrupt enable 0.
  • The last part of the code is the most important part of pure sine wave generator.
  • OCR0 is output compare register for timer 0 and it continuously compares timer0 values i.e. 0, 1, 2…….255, and for each value of timer the value from sine wave table is computed then sample++increases the pointer of sine wave table to the next i.e. the value at the second index of sine table and that is computed for the output until samples equals to 255.
  • Then we used the command sample = 0 the cycle is repeated again and again.
  • Here’s the programming code for Pure Sine Wave Inverter:

 

H-Bridge Circuit

  • H-Bridge Circuit is acting as the main core of Pure sine Wave Inverter.
  • H-bridge circuit is basically enables a voltage to be applied across a load in either direction.
  • In inverters, it is used to amplify the input square wave coming from the micro-controller.
  • We are giving modulated square wave at the input of the H-bridge because if we give sine wave to the MOSFET or any other switching device like the BJT or IGBT, very high switching losses occur. This is because when we give sinusoidal waveform to any of these devices, they start operating in the linear region, and power loss occurs in devices operating in linear region.
  • When we give a square waveform to them, they operate on either saturation or cut-off regions thus having minimum power loss.
  • We used IRF5305 and IRFP150 MOSFETs. These are high power MOSFETs with maximum current rating of 31 Amp and 42 Amp respectively.
  • IFR5305 is a Pchannel MOSFET whereas IRFP150 is an N-channel MOSFET.
  • The circuit configuration of H-bridge is given below:
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverterFIGURE 2 : H-Bridge Circuit




Working
  • Working of an H-bridge for pure sine wave inverter can be divided into two modes.
  • In Mode1, the input signal at the gate of M1 is high and at the gate of M4 it is low.This causes conduction from M1-M4 and we achieve a +12V signal at the output.
  • In Mode2, the input signal at the gate of M3 is high and at the gate of M2 it is low.This causes conduction from M3-M2 and we achieve a -12V signal at the output.
  • And thus we obtain a 24Vpeak-peak signal at the output.
  • The working of H-Bridge in both conduction modes can be easily understood by the following figure:
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverterFIGURE 3 : H-Bridge Conduction Modes (A)
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverterFIGURE 3 : H-Bridge Conduction Modes (B)

 

  • Due to the conduction of half part of the bridge at +ve half cycle and the other half part of the bridge at –ve half cycle, we obtain a square waveform of 24 Vpeak-peak at the output.
  • In figure below is the Proteus simulation showing the waveform output of bridge circuit during each conduction cycle.
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverterFIGURE 4 : Wave-forms of H-bridge conduction cycle
Observations
  • In the H-bridge circuit we have observed that input signal‟s frequency does not change at the output that means the frequency remains un-altered.
  • Only the power of the signal increase in terms of current.
Problems
  • Initially we used all the MOSFETs of same type (i-e. n-channel MOSFETs). This caused the shorting of the MOSFETs during the conduction mode. This phenomenon is known as shooting over of the MOSFET.
  • Despite the duration of this shooting over was quite small, it caused loading on the MOSFETs.
  • The MOSFETs started heating up due to this, and eventually they burned out.
  • Another problem occurred while using the MOSFETs of same channel was that the upper MOSFETs (M1 and M3) did not turn on properly.
  • After studying, we learned that they required 18V to turn on thus; we needed a MOSFET driver that was IR2110.
  • We worked on it but it did not working properly too, because according to the formula for bootstrap capacitor given in datasheet, the driver must have given 18V output but it was not working so we had to search for an alternate.
  • Then after extended study we came to know that replacing the upper two n channel MOSFETs with p channel MOSFET is the solution. We applied this technique and it worked.
  • Using this technique also solved the problem of MOSFET shooting over by inducing a dead time/delay in the MOSFET switching.



LC Filter

  • We have determined inductance of the inductor using LC resonant band stop filter as LC meters were not available in the lab.
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverter
FIGURE 5 : LC filter
Working
  • Understanding the working of H-Bridge is very essential, if you want to work on Pure sine Wave Inverter.
  • The method to determine L or C is simple. Suppose we are required to determine the inductance, then by above circuit,
Pure Sine wave inverter design, pure sine wave inverter with code, PIC based pure sine wave inverter
  • V1 signal from function generator is set to 1Vrms using multi-meter.
  • At resonance frequency the LC combination will have very low impedance so it will short out the signal and will drop across resistor R1 and prevents the signal to reach the load.
  • Using this principle we have varied signal frequency from function generator and we are detecting output voltage at load using multi-meter.
  • At resonance frequency multi-meter will show ideally zero volts.
  • So by using formula we have :
Problems
  • First we designed an RC circuit but we observed that the Resistance R in the circuit acts as a load and dissipates power.
  • After studying, we decided to use an LC filter.
  • The main problem with the LC filter was the designing of the inductor as the inductor of desired value was not available in the market, thus we had to make it by hand.
  • LC meter was not available also thus we had to repeatedly calculate the inductance value mathematically.

Working of Pure Sine Wave Inverter

  • Let’s have a look at the working of Pure Sine Wave Inverter.
  • A 50Hz sin wave is generated with the help of a lookup table within the AVR microcontroller and is modulated over a switching frequency signal of 15KHz.
  • As this signal has very weak current, so it is amplified by a BC 547 transistor.
  • The amplified signal is given at the gates of M1 and M2 MOSFETs.
  • The output of the microcontroller is given to another BC 547 which is working as an inverting amplifier.
  • By this, the signal from the microcontroller gets inverted as well as amplified.
  • This signal is given at the gates of M3 and M4 MOSFETs.
  • Now what happens is that, when the input signal at the gate of M1 of the H-bridge is high and at the gate of M4 of the H-bridge is low, conduction from M1-M4 occurs and we achieve a +12V signal.
  • When the input signal at the gate of M3 goes high and at the gate of M2 goes low, conduction from M3-M2 occurs and we achieve a -12V signal.
  • Thus at the output we receive a waveform of 12Vpeak or 24Vpeak-peak.
  • The output of the H-bridge is then fed into a low pass LC filter which filters the high frequency components of 15 KHz and gives the 50 Hz sine output.
  • This output is then fed into a transformer which steps up this 12 Volts AC waveform into 220Volts AC.

So, that’s all for today. I hope you guys have enjoyed this Pure Sine Wave Inverter Project. You should also look at Proteus simulation of Pure sine wave and Introduction to Multilevel Inverters, because simulations help a lot in designing hardware projects. So, take care and have fun !!! 🙂

75 Comments

  1. @ Above Sorry friends, I have worked on it a long time ago as you can see its a very old post …. so I kind of lost the proteus files … I will search my documents …. If I find it I will surely send it to you guys …. Thanks.

    • ya sure bro, if i find them i will surely email them to you … btw i was thinking of designing it again as i am getting a lot of queries related to this project ….. as soon as i got free i will work on it ….

  2. AOA, I’m subscribed to your mailing list, still i didn’t receive any details. I wanted complete details of Sine Wave inverter (schematic, programming). Kindly do the needful.

    Regards,
    Restricted

    • Hi bro,

      I have mentioned in above comments …. i kind of lost the files … so i cant send them to you … I will start working on this project again as soon as i got free ….

      Rite now its just what is posted here ….

      Thanks.

  3. hello, syed zain nasir, could u please me relaize the working of the circuit of a sine wave control block diagram for an air conditioner. Since i dont have ur mail id pls leave a message at the following mail id madan.k.naidu20@gmail.com, so that i can mail the circuit to you.Or pls mail me any sine wave inverter circuits for air conditioners that u are aware of. thank you

  4. DEAR MR. SYED ZAIN NASIR,

    I have an inverter with built in charger change over circuit and AVR microcontroller having PIC16F72, CD4049UBE, CD4093BE, LM324N and LM393P

    It features Two wire 0-12v/600w Transformer connected to H-Bridge Using all N-channel type 16 Mosfets IRF3205 in 4 groups.

    The oscillator and driver circuit fried (Burned) as per technician in Saddar Karachi.

    A ready made circuit from market having PIC16F72 with charger changeover option is available but its designed for center tapped transformer topoly having two output.

    Is it possible to drive the H-Bridge by this readymade circuit if I change the N channel type with two N channel and two P channel by using eight IRFP150 as given in your circuit. Will it work?

    OR any other suggestions

    My objective is to restore my old inverter

    If you give your email I can send the pics.

    Would be so very grateful for your help

    Regards
    Rizwan

    • Search a tutorial on COM Port using Visual Basic on this very website and you will find the solution. :))

      Thanks.

  5. Hi my name is ALICK I would like to learn more about micro controllers
    To see how it works your code is so
    Confusing could you please send me the the control schematic
    So that I could see and compare
    With the code thank you for this project
    Alick

  6. Dear Syed Zain Nasir, Please would you be so kind as to send me the full circuit for your latest Pure Sinewave Inverter, about 30 years ago I bought this massive Inverter transformer XG29E from Maplin, I planned to make my own Inverter but never seemed to get around to it, I have the biggest part already, now with my Solar Power Project I would really like to complete my free energy project by having a decent pure sine Inverter I like yours very much but their does not appear to be much regarding the circuit on here ! Could you email it to me Thanks.

    Michelle

  7. Oh I forgot to mention I am rather old school, mostly know and understand Analogue not really any good with digital stuff or programming chips, so could you advise me do you by any chance sell per-programmed chips for the Programming Code stuff ?

    Michelle

    • Hi bro, I have posted everything here related to pure sine wave inverter, I don’t have anything else than that. So, I can’t provide you any more material. Moreover, if you want to hire us then send us a message on help@theengineeringproject.com , and our representative will come back to you and will guide you in detail. Thanks.

  8. Dear Nasir,

    Well explained and useful project especially with the emerging importance of inverters vis-à-vis PV systems. I think upgrading the project as you have are doing now is in order. Please retain the elementary explanations for the benefit of newbees. May I suggest reporting on efficiency of the conversion?

    Additionally, readers will find it quite useful if the mechanism of grid-tie inverters, zero-crossing switching, etc. is mentioned even if your inverter is not a grid tied one.

    Great work!

    Best wishes

    Hassan

  9. Hello!

    Could send me the complete code and schematics, please? (vilo.alternativ@gmail.com)
    I tried the posted by you , but the sin table missing some syntactic pieces, I guess :S:P
    Anyways this blog is still so helpfull!
    Thanks all!

  10. some buddy send me a complete circuit of 12v dc to 220v ac inverter , and also send a chopper of 12v dc to 313v dc converter circuit with complete tested circuit with simulation. i am working on it. its my fyp . please reply me as soon as possible. love u all my electronic lover friends . its urgent tomorrow is our project proposal presentation .. ;).

    thank you
    regards : Malick Muhammad

  11. i am working on pure sine wave inverter using avr micro controller . (atmega 16 ) using for generate a pwm of 32khz . .any one want any info about it , feel free to contact me mubshir_88@hotmail

  12. Am just starting and have grown fond of inverters though i have not done electronics course. You explain it in a way which i as a layman understand … Thamks

  13. Dear Syed Nasir,
    You have explained really very welI and it helped me. I m working on a pure sine wave inverter using AVR microcontroller . It’s my FYP and i have selected a method of DC/DC conversion i.e 12v Dc to 325v Dc(Booast converter). I don’t have any confusion in PWM code i will prepare it but i have alot of confusion in DC/DC conversion and LC filter would you please help me . Remember i m not using transformer.I want 600 watts,220v ac and 50Hz at the output of my inverter.
    Please guide me in preparing Booast coonverter and LC filter for my required output. I would be very thankful for your help.MY email id is Irfan_haider011@yahoo.com
    Regards
    Syed Irfan

  14. Hey Zain

    Tha’s a pretty awesome job you did here, this post is a huge help. I am unsure about one point, the way you selected values for the filter, how did you calculate the capacitor’s value? And I have seen in many designs that people have used a filter after the transformer, is there any particular reason why you used it before?

  15. Please Zain Bhai send me Project files all. Specially filter cz i m stuck at Filter Part only. Icannot understand how to Make Filter……….their ratings…….. please….

  16. Mr. Syed Zain Nasir,

    Please help me for my project, i need inverter project 12 VDC to 20 VAC 500 watt and 1000 Watt, if you have this project please send your offer to this email sagahaditama48@gmail.com , im from Indonesia, please help me. Thankyou

      • hey Zain did you manage to find your files? can you please send me the details and the whole circuit diagrams of pure sine wave inverter 12Vdc to 220Vaci am buillding it as my project please help. my email address: 201332180@student.uj.ac.za..

        thank you in advance Sir.

        • Hi,

          Yeah I got the files, you can buy them from shop just for $10. Moreover, I have also posted a complete Proteus simulation of Pure sine wane inverter which will help you a lot. You can check it in blog.

          Thanks.

          Thanks.

  17. Hello,

    I am thinking about buying this project, what programs will i need to buy to use files? and if possible; Where can they be bought and/or downloaded?

    Also would this work with arduino?

  18. please,i want to know if your inverter design and code include feedback control(e.g PID, PI or Fuzzy logic algorithm) mechanism

  19. Hi sir. i am going to design sine wave UPS. for which i need sine wave inverter project detail. i can’t find the link of your shop as you mentioned that buy from shop. please humbly requested reply on email.. “adreeskhan1995@gmail.com”

  20. Nice tutorial. I have one concern though. In your Mode 1, you said a HIGH signal reaches M1 and a LOW reaches M4 gates. Now M1 is a P channel MOSFET which should ideally be turned ON by a LOW signal, and M4 an N channel, which should be turned ON by a HIGH signal. It seems to me like you reversed something somewhere. Please put me through if I am getting it all wrong. Thanks.

Leave a Reply

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

Post comment