The only electronic website that replies to every comment, and addresses all circuit related issues.

Arduino Pure Sine Wave Inverter Circuit

This article explains a simple pure sine wave inverter circuit using Arduino, which could be upgraded to achieve any desired power output as per the user's preference


In the last article we learned how to generate sine wave pulse width modulation or SPWM though Arduino, we are going to use the same Arduino board to make the proposed simple pure sine wave inverter circuit.

The design is actually extremely straightforward, as shown in the following figure.

You just have to program the arduino board with the SPWM code as explained in the previous article, and hook it up with some of the external devices.



Pin#8 and pin#9 generate the SPWMs alternately and switch the relevant mosfets with the same SPWM pattern.

The mosfst in turn induce the transformer with high current SPWM waveform using the battery power, causing the secondary of the trafo to generate an identical waveform but at the mains AC level.

The proposed Arduino SPWM inverter circuit could be upgraded to any preferred higher wattage level, simply by upgrading the mosfets and the trafo rating accordingly.

In the diagram the Arduino board could be seen supplied from a 7812 IC circuit, this could be built by wiring a standard 7812 IC in the following manner. The IC will ensure that the input to the Arduino never exceeds the 12V mark, although this might not be absolutely critical, unless the battery is rated over 18V.


If you have any questions regarding the above SPWM inverter circuit using a programmed Arduino, please feel free to ask them through your valuable comments.

Image of SPWM waveform as obtained from the above Arduino inverter design (Tested and Submitted By Mr. Ainsworth Lynch) 



Arduino Pure Sine Wave Inverter Circuit SPWM waveform


For the Program Code please visit the following link:

Arduino SPWM Generator Circuit

UPDATE:

Since an Arduino board will produce a 5V output, it may be not be an ideal value for driving mosfets directly, therefore an intermediate BJT stage may be required for raising the gate level to 12V so that the mosfets are able to operate correctly without causing unnecessary heating up of the devices,. The updated diagram can be witnessed below:






Please Share this Post:
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble



  • 85 comments:

    1. Sir, what of feedback, isn't that and essential part in inverter operation?

      ReplyDelete
      Replies
      1. Oluwole, feedback is not an essential part for an inverter, it's just an added feature.

        If you have your transformer correctly matched with the battery then feedback won't be necessary

        Delete
      2. Then how would you regulate voltage at different load??

        Delete
      3. Do you have a voltage regulator with your home AC mains input?? how does it regulate different loads

        Delete
    2. Hi Swagatam,
      I have tried PWM charge controller using arduino and it is successful. Iam using it in my home generating 80 watts of power from 200 watts panel. I know its very poor.
      BTW, I admire your works and I keep looking at your blogs very often.
      I came across this very interesting circuit and I want to try this inverter.
      Just to be sure, I have few 4905 PNP mosfets lying around from previous project, Can i use the same in your circuit? Source of mosfet connecting to Battery -ve and Drain of mosfet to transformer?
      2. Transformer rating: secondary 12v-0-12v/15A, primary 220V. What will be my output power? is it 12x15=180 Watts? So if i increase the transformer rating to 30A can i get 360 watts of power? ofcourse with some 10-15% losses...

      ReplyDelete
      Replies
      1. Hi Sham, if you are using an Arduino based controller and getting 80 watts from 200watts, then it's not worth using...or may be you haven't built it correctly, a linear IC circuit would give much better results than this.

        as for the above Arduino sinewave inverter, yes it's indeed an interesting and handy little inverter which will give you pure sinewave just by hooking up a couple of fets and a trafo.

        Pchannel mosftes might not work correctly here since the design is meant for N channel mosfets, so you will have to replace your p channels with N channels and then test the results.

        Delete
      2. your watt calculation is quite correct, but for a 12V battery you may have to employ a 9-0-9V trafo

        Delete
      3. Hi Swagatam, Appreciate your quick response. I am using Arduino for doing multiple tasks, like auto change over to AC/Battery, solar energy monitoring etc... as u said it looks like something is wrong.. My 100w x2 panels are generating appx 7-9 amps peak. But inside ckt it's getting down to 6.8 amps max. ��. I need your help in solving this. After reading ur article, am thinking of some issue in calculating the duty cycle fed to P channel MOSFET. Let me check that and update you.
        I will purchase 9-0-9v trafo, N channel MOSFET and try the ckt. Here I need to control the amount of power used and alert me when solar power generated is less than power consumed. I hope I will succeed in this.

        Delete
      4. Hi Sham, what kind of circuit are you using for the controller, is it a buck converter? also specify the V and I of the panel.

        duty cycle for the above circuit is 50% for the positive negative halves, and the individual phases are SPWMs with varying duty cycle.

        Delete
      5. Sham, I checked the link you sent, but I could not go through the diagrams since it everything quite elaborate....

        one thing i can say, if PWM is used without a buck or boost converter then it's meaningless...it will simply block the excess power from the panel and indirectly waste power. In that case its' better to use a LM338 based circuit, or simply use a panel having a nearby specs to that of battery.

        When you are using Arduino based design the outcome should be highly advanced and efficient, otherwise it's pointless.

        if you need an MPPT circuit you can check out the first two articles from this website

        http://makingcircuits.com/?s=mppt

        Delete
      6. Wow Swagatam.. xlent link. Thank you. I will to go through them one by one.
        Yes.. now I am realizing the necessity of Buck converter. In one of your article you had mentioned about both Buck and boost.. I had not understood at that time.. I will go thru again.
        Btw, to my understanding, I should use Buck converter with 10 amps rating for my work right? Bcos panel amp rating is 10 amps.

        Delete
      7. You are welcome Sham,

        if you wish to use a buck converter with a 10amp pnel, then it should be rated higher than 10amps, because when the panel voltage is reduced by the buck converter it is supposed to convert the unused voltage into current...therefore current would go above 10 amps.

        you can find it dividing the solar panel wattage by the battery voltage.



        Delete
    3. Hi Swagatam,
      I want to make an inverter to drive some gauges that require approximately 2 amps at 115v AC @400Hz, using a 28v DC imput. The Arduino seems like the right tool. Would you be kind enough to make up a circuit diagram?
      Regards,

      Mark

      ReplyDelete
      Replies
      1. Hi Mark,

        you can try the same design which is published in the above article....just assemble it, and start using it for your specific need.

        the transformer will need to be a 24-0-24V 10amps/120V for your mentioned application

        Delete
    4. you are wonderful Mr. Swagatam Majumdar, please how many can i make 500Watt inverter of arduino

      ReplyDelete
      Replies
      1. thanks alex, you can achieve that by using 600 watt mosfets and a 600watt trafo....and a 24V 150AH battery

        Delete
    5. Using a 12v battery I can use a 12v transformer for this circuit?

      ReplyDelete
    6. I tried a 12v transformer, I was getting 57v, I used irfz44n and they burnt up 2 times, while running they weren't hot, I think they burnt up because of of constantly adjust alegator clips on battery terminals to get a better connection.

      But since the voltage was that low and the frequency is so high I was wondering if you tested this circuit.

      ReplyDelete
      Replies
      1. mosfets can burn due to many reasons, and definitely not due to frequency issues because mosfets are designed to handle very high frequencies.

        it's a Pwm circuit and the transformer cannot be 12V for a 12V supply, it has to be 6-0-6V or some other value as pert the calculations, I think this issue has been discussed countless number of times in this website...

        the above design is a an obvious circuit and will work without fail.

        I have tested it with LEDs with a slow delay effect and it behaved perfectly as per my brain simulation.

        once this was confirmed, I simply reduced the delays so that the sequence corresponded a 50 Hz frequency across the two channels with 7 varying SPWM pillars for each cycle,

        anybody can easily interpret this.

        you can verify the pattern on an oscilloscope if you have doubts.

        Delete
    7. Also how could I stop diodes from getting damaged?

      ReplyDelete
      Replies
      1. which diodes are you referring to??

        Delete
      2. Sorry I should have said Fet instead of Diodes.

        But since my transformation is a 12v transformer then that explains why I was getting 57v.

        Delete
    8. I asked that question time after time but never actually got a reply. So let me get it straight just this once.

      If my battery source on an inverter is 12v that means the transformer should be 6-0-6v and if it's a 24v battery source then the transformer will have to be 12-0-12v ect.

      And that's the case for all your inverters? If any exception could you send me the link to the exception and im not refering to something like your cascade design.

      ReplyDelete
      Replies
      1. Please show me where you have asked this question, and did not get the reply?

        when you use PWM it cuts off a portion of the actual waveform and this results in a reduced average voltage or the RMS value of the waveform, to compensate this the transformer needs to be lower with its primary V specs, so that the reduced PWM waveform matches the reduced value of the trafo.

        for example if the PWM waveform average value is 7V for a 12V peak, then the trafo should be 6V/220V which will yield approximately 230V.

        instead if we applied 7V PWM waveform to a 12V trafo that would proportionately reduce the output to:

        7/12 = x/220

        12x = 7 x 220

        x = 128V at the output

        Delete
      2. it applicable only for PWM chopped sinewave inverters, NOT for all inverters....

        Delete
      3. In this case it's a spwm so it's applicable here. So my battery is 12v so I need to use a 6-0-6v transformer then

        Delete
      4. I checked the video which you sent, I am afraid the results are not correct.

        the code of the Arduino cannot be wrong because it contains simple delays in the form of ON/OFF periods...and these ON/OFF periods must produce PWM kind of waveform in the oscilloscope, your scope waveform looks weird.

        secondly, if you add all the delay periods in the code, it comes to 10000 microseconds that's equal to 10ms...so 10ms on each cycle gives 20ms on the two channels...dividing 1 second with 20ms, gives 50 Hz, and that should eb the frequency...how can it be 600Hz??

        Delete
    9. Hi sir i am planing to make an inverter of 48v to 240v pure sine wave. I try to search here and i didnt find a pure sine wave 48 v circuit.. My inv transformer is 48v - 0v 12amps & secondary is 240v.. Sir please help me.. My mail id is vineethhari@ymail.com

      ReplyDelete
      Replies
      1. Hi Vineeth,

        you can convert any of my 12V sine wave inverter cirucits into 48V, simply by applying 48V to the center tap of the transformer, and then step down the 48V to 12V for the DC circuit stages, because the involved DC circuits cannot work with 48V.....you can drop the 48V into 12V by using the principle as shown the following design. see the BC546 section

        http://www.homemade-circuits.com/2014/11/48-v-inverter-circuit.html

        Delete
    10. What do you think would be causing me to get high frequency?

      ReplyDelete
      Replies
      1. it's the 6 pillars on each cycle which might be confusing the scope...you can add a capacitor at the trafo output and see the difference...

        Delete
    11. This is the waveform coming from public 8 and 9.

      https://goo.gl/photos/8HG4xR4dtD5dZTxe7

      ReplyDelete
      Replies
      1. that looks perfect, and quite similar should appear at the trafo output, which should get transformed into a perfect sinusoidal waveform with the addition of a capacitor (0.33uF/400V) and possibly an inductor, as shown in this example circuit

        http://4.bp.blogspot.com/-khKat0UA8Jw/UITpCnNd7yI/AAAAAAAAA_A/8x-KAD2aHLE/s1600/simplest60+Hz+Inverter+circuit+diagram.jpg

        Delete
    12. Thanks, swagatam,
      Can we use F3415s Mosfet in this ckt.

      ReplyDelete
      Replies
      1. thanks, the mosfet rating will depend on your power requirement, and it must be N channel type...

        Delete
    13. Can we used dc booster to step up voltage to avoid transformer

      ReplyDelete
      Replies
      1. a booster will also involve a transformer...

        Delete
    14. But it will be less weight. what is your opinion if we used dc booster in Pure sine wave inverter. we will be thank full if you have any Diagram.
      Secondly in pure sine wave 3K Inverter which one will be very effective to give us pure sine wave Arduino or IC 4047 with 555.

      ReplyDelete
    15. Hello sir niceone... Can one use an l293d motor driver IC instead of the MOSFETs, with a 12-0-12 transformer and a 12v battery?

      ReplyDelete
      Replies
      1. thanks...yes that's possible, you can use it..

        Delete
    16. Hello sir , can one achieve a pure sine wave if it he uses pins 8 and 9 of the arduino but this time with an l293d IC instead of MOSFET, 12-0-12 transformer, 12v battery?

      ReplyDelete
      Replies
      1. Hello obenobe, yes you can use the L293 with the above Arduino for controlling a motor, but I am not sure about a trafo operation....I think that may be possible too.

        Delete
    17. Hi Swagatam,

      I need to build 48vDC to 220vAC 5000KVA Pure Sine wave Inverter. Can you please share schematic and number of power transistors or mosfets and transformer specifications. I also need to know battaries specifications. thanks

      ReplyDelete
      Replies
      1. Hi Saqib,

        you can first try building the following design successfully, then I'll tell you how to proceed and make the sine wave integration

        http://www.homemade-circuits.com/2014/11/48-v-inverter-circuit.html

        Delete
    18. adding to my previous question. do you have any kind of pure sine wave inverter schematic that can power on a 1 to 1.5 ton Air Conditioner. Actually I bought a land for fish farming and wanting to power up things in my sitting area there with inverter because of lack of electricity there.

      ReplyDelete
      Replies
      1. Saqib, you can try the following design

        http://www.homemade-circuits.com/2016/04/solar-inverter-circuit-for-15-ton-ac.html

        Delete
      2. Great. one more thing Can this be used with batteries? because I wanted to run this in night as well. Also solar panel isn't possible for me due to low space around sitting area and placing panels to any other area isn't affordable for me. what is the idea behind is that I will use two sets of battery banks one online and one offline on charging stat. inverter should be smart enough to detect low battery and switch input to secondary battery bank and start charging the first one while should run at least 1 ton Air Conditioner thats why I was thinking of 5kva inverter. if there any possibility then please write an article on this as soon as you can. I can buy this from market but you better know what we ask, we don't get. better to make it ourselves as per our requirements and have fun of electronics.

        Delete
      3. Solar panel is actually not compulsory, you can use any suitable DC source with the suggested circuits, just make sure the voltage and the current specifications are correctly matched with the inverter and the load.

        most of the ideas are already published in this website, you just have to search it using the search box.

        I have a 5KVA inverter circuit included in this website, I also have an automatic twin battery charger circuit which you can use for automatically detecting, and selecting the charged battery when one of them gets discharged.

        However all these circuits are strictly for the experts who know all the basics of electronics and have the required practical experience in the field, it's not for the newcomers, so please make sure you have an expert with you while you try the proposed designs.

        Delete
    19. Sounds Good. Can you please post the link here as I am unable to use search box in my android. may be some css issue.

      ReplyDelete
      Replies
      1. The search box is right at the top of the article.


        anyway here are the links:

        http://www.homemade-circuits.com/2014/07/5kva-ferrite-core-inverter-circuit.html

        http://www.homemade-circuits.com/2014/05/twin-or-split-battery-charger-circuit.html

        Delete
      2. Great Swagatam. You're my hero. Will contact you again if needed. thank you so much for your quick response and help. May God bless you.

        Delete
      3. you are most welcome Saqib!!

        Delete
    20. Q1.is there any way to start single phase 3hp induction motor on home 5kva inverter ? because starting current is very high may be more than 30 amp but running at full load max current is 15 amp . Q2. is running above mentioned motor, possible on pwm based pure sine wave inverters?

      ReplyDelete
      Replies
      1. It may be possible and tackled comfortably by adding an external battery bank with the existing battery. once the motor is initiated, the external battery bank can be removed, or disconnected with a help of a switch.

        Delete
      2. i have question. inverter is only 5kva ratings.
        than how adding a battery to it increases​ its output power ?

        Delete
      3. it should be able to produce the extra power for a few seconds.

        but if you are concerned about it, then the best option would be to change the inverter with a 1 kva rating

        Delete
      4. sir thanqew for ur valuable reply.
        can you please suggest components for above systematic to bulid 6kva inverter and approx prize estimation for it?

        Delete
      5. You are welcome,

        for making a 6kva inverter you can use the same Arduino board and its code.

        for increasing mosfet power you can add more of them them in parallel, each mosfet should have it's own gate resistor and diode.

        the transformer will also need to be rated as per the mentioned specification.

        the battery voltage should be selected as high as possible, may be at 84V would be great and this will allow the transformer to be relatively smaller and the associated wiring to be manageable.

        Delete
      6. I can't say about the prize, you will need to find it out from the market.

        Delete
      7. for rating of mosfet ...
        if i have two mosfet each one rating 50watt and one for possitive cycle and another for negetive cycle .does it means i have inverter of 100watt or only 50watt??

        Delete
      8. Gurmel, both the mosfets will need to be of the same polarity as shown in the diagram that N-channel.

        the mosfets do not decide the power output, it's the battery AH rating and the trafo wattage rating which determines the output delivery, the mosfets simply needs to be rated adequately so that it is able to handle the power pushed by these elements.
        the power power will depend on the trafo Voltage x current value and only if the battery has the capacity to deliver the amount of current which trafo is rated at

        Delete
    21. fro where i can find the arduino code

      ReplyDelete
    22. where is the arduino code swagatam

      ReplyDelete
      Replies
      1. Hi Ravi, please click on the link which is highlighted in the second paragraph of the article

        Delete
    23. Well as you have seen in my previous comments your code works well to produce the wave form however i was getting the wrong frequency and the voltage increased slowly to maximum.

      I was using a 6v .5amp transformer and the circuit was relatively ok.

      I used that transformer in another circuit because I decided to upgrade the size transformer but no matter what I keep blowing my fuses and fets just by applying dc across the transformer it doesn't short circuit when the center tap isn't connected and I doubled checked for short circuit and I tried 2 transformers and changed many Fets.

      I applied spwm across fets first to see if that was the prob but once battery power was applied transistors got damaged again or a 5amp resettable rocker switch I have in line keeps tripping.

      I am using a heavy transformer wrapped 6-0-6v it only stop blowing fuses when I changed the fuse to 15amps even 10amps blow out everytime.

      But it's the circuit suppose to pull so much current at start up with no load?

      I assumed it worked for me first time because the transformer was so small.

      I even tried to limit the inrush current by adding a 5w of 0.22ohm resistor at the center tap of the transformer when I switched power on nothing tripped but there was no oscillation.

      What do you think could be the problem.

      ReplyDelete
    24. I did further testing because I assumed it was just a case where the circuit is pulling maximum amperes from the transformer so I removed the 5amp switch and used a regular 15amp switch and I removed the fuse and I powered on and I was pulling 15amp, the wires got hot not to mention the fets, I'm using irfp150.

      What would be causing me to be pulling so much current is it because there is no load on the transformer or is it because the gate resistor is so low.

      ReplyDelete
      Replies
      1. you are saying your trafo is good, your fets are good, there's no chance of any short circuit, and yet your fuses are blowing, how can that be possible?

        from here I can say your FETs are bad for sure or may be there's something that's causing a a short circuit which you must diagnose and rectify. without a short circuit or overload a fuse can never even a new hobbyist will know that!

        if I would be in your place I would have first tried BJTs instead of mosfet for testing purpose, because BJTs are more manageable thn mosfets
        mosfets gate resistor should always be low, in fact higher resistance might cause heating up of a mosfet and damage.

        alternatively you can remove the Arduino and check with a 4047 IC, to see the difference, there are actually many methods through which you can check the fault.

        another method is to connect car bulbs in series with the mosfet drains, and remove the gate supply, if the bulbs keep glowing even without gate supply would quickly indicate a faulty fet.

        Delete
      2. ...you can also try a small good readymade trafo (1 amp) and test the response, that will give you clear idea regarding the proceedings.

        Delete
    25. Remember I just said in the past I did my test with a small .5amp transformer or 1/2amp and it worked fine but I am now trying bigger transformers and it seems to be pulling the transformers maximum current.

      I thought the fuses were blowing because of a fault I was using small fuses because I didn't expect the circuit to be pulling so much amps (over 10) and there is no load. Also I have a 5amp resettable switch on the circuit which normally just trips as I flip it to apply battery power so I assumed it was a short circuit but it wasn't it's just that the circuit is pulling a lot of current all at once.

      The fets I assumed they were bad because before applying battery power there is no connection between drain and source but once I attach battery power I get a dead short between drain and source I tried used a power supply I built and when there is no power the fets read good but once there is power applied then there is a dead short between source and drain. I tried a couple irfz44n and it's the samething and I tried some irf3205, same results.... The only issue I see is that it's pulling maximum amperes from the transformer

      ReplyDelete
      Replies
      1. Fuses cannot be a crucial thing in any circuit while testing, unless the circuit involves dangerous parameters and unpredictable results, here the inverter is supposed to work without any fuse...if you are forced to use a fuse that means your inverter has a serious fault which cannot be solved by replacing fuses rather it should be done by checking and rectifying the fault

        As I mentioned before you should check the response of the FEts without connecting the gate supply, and by keeping the gates grounded..if still the FETs conduct would indicate faulty fets.

        puling high current without load is a fault and as good as a short circuit.

        By the way there's no point in working with faulty, doubtful, devices...if you have slightest doubt regrading the parts either you must replace them or quit the project until correct parts are bought.

        Delete
    26. I used a 1amp transformer to do some tests again and I used some irf3205 and the fets still get hot I measured the transformer pulling 1. 4 amps.

      I made some random checks:

      Having the battery negative alone connected along with resistors from gate pin connected to the arduino there is a short circuit between drain and source, if I remove battery negative then there is no short.

      If I attack the battery negative and remove gate connection there is no short circuit between drain and source.

      While having the negative connected to the battery (positive stays disconnected)
      Testing between source and gate I get 4.3v

      So to me it seems as if the negative from the battery is making a circuit with the arduino and this happens with or without the transformer connected.

      Its like it needs a resistor across gate and source not sure if that's whats causing it to pull full load once powered up

      ReplyDelete
      Replies
      1. that clearly indicates your FETs are not good, because connecting the gate with source should keep the fets completely shut off, if still it is conducting then surely the fets have some fault

        You can try using BJTs like TIP122 or TIP142 instead of the mosfet and check the response.

        Delete
      2. Ainsworth, yes a resistor should be across gate to source to drain electrons from the metal oxide semiconductor gate to the source. 100K to 1 Meg ohm. An unconnected insulated gate voltage can float to a positive voltage and turn on the N channel mosfet make a short connection from drain to source. Ie proper operation of n channel mosfet. 2nd verify electrical ground connection from arduino circuits to your smps power circuit mosfets. If not connected. Then circuits Can float with low output 0.7V from arduino can be 4.3V measure on mosfet gate to source. Effectively turning on n channel mosfet. Battery ground, arduino ground, n channel mosfet ground all tied together. Good luck on debugging circuits. Thanks for arduino sine wave code and circut. Bless you and thanks for Sharing. Fred WB7ODY

        Delete
    27. If u have some parts I would want you to test the circuit with a transformer, I think it may require a optocopler.

      ReplyDelete
      Replies
      1. you have already tested the waveform which simply needs to applied to the gates of the mosfets, there's nothing complex in the design at all, since you have already started with the project it would be easier from your side to finish it,

        you should change the doubtful fets and replace them with BJTs, and confirm the results.

        I think it is just a matter a minutes to identify the exact location of the fault, by doing some basic tests as already suggested by me in the previous comments.

        Delete
    28. i require a driver circuit for
      mosfet which enhance the 5V output of arduino to 12V to feed mosfet,
      * suggest me a driver circuit.
      * i am making circiuit for 240V , 350 watts output,
      * which mosfet i should use ? irf3205???
      *can i use more mosfets parallel to overcome heat issue of mosfets,
      * what transformer should i use,,,,,, i am using 7ah 12V battery,
      required output 230V, 350watt, guide me rating of transformer?

      ReplyDelete
      Replies
      1. you can use a 4093 IC and use its gates like NOT gates by shorting its inputs and then it would effectively raise the 5V input to 12V.

        IRF3205 will do

        you can try as many mosfets as you want, in parallel

        12V 7ah battery will be too small, and not produce more than 60 watts, you will require a 100AH, 12V for getting anything near 300 watts

        Delete
    29. Sir can i use above circuit as a fish stunner/shocker ..i have 12volt and 85Ah battery ...

      ReplyDelete
      Replies
      1. Muhib, you can try an ordinary high voltage generator circuit, the above sophisticated Arduino based design is not required

        Delete

    Please Note: If you find any DEAD link starting with http//:homemadecircuitsandschematics.blogspot.com, please replace it with http://www.homemade-circuits.com/ for making it visible and alive again.