Embedded Systems and Power Electronics

Total Pageviews

About Me

My photo
I am currently a PhD student at UC Berkeley, following a 6-year journey working at Apple after my undergrad years at Cornell University. I grew up in Dhaka, Bangladesh where my interest in electronics was cultivated, resulting in the creation of this blog.

BTemplates.com

Powered by Blogger.

Dec 16, 2010

Single microcontroller based 12v to 230v inverter with intelligent battery charging


 Single microcontroller based 12v to 230v inverter with intelligent battery charging (Made by me)


Here I describe the circuit as:

*single microcontroller/controller (ATMEGA16/32)
*no op-amps, only chips are the micro, opto-couplers and regulator (7805)
*low-battery/overload/short-circuit protection
*thyristor controlled battery charger, using the MOSFET body diode as the AC-DC rectifier
*charger maintains the battery voltage (top) between 13.2-13.5v (adjustable) to maximize the battery life
*6-LED display
*Only 93 parts in entire control circuit
*Delay between switchover to prevent inrush current

The method used here, described for those who may benefit from it:
-Initialize all ports and peripherals[ADC, Timers, Compare Modules]
-Initialize interrupts for Timer0 and compare module for
-For PWM, use Timer1 and 16-bit Phase and Frequency Correct PWM mode so the PWM runs completely on the hardware level without need for interaction to keep it running
-The AVR senses whether mains is present or not using a standard opto (4N35).
-If mains present, check battery level
-If battery level < 13.5v (this voltage is set using a pot, so can be easily adjusted), charge at the set current(set with a pot)
-If battery level > 13.5v, stop charging
-While battery > 13.2v, stop charging
-If battery voltage drops instantly start charging again
-Triac based, uses Timer0 and compare module with interrupt for phase angle control for fast charge, never overcharges battery, battery hasn't ever heated up till now and 2 year old battery still gives good backup, so charging algorithm is good for battery life
-Check mains
-If mains absent, initialize Timer and start PWM
-Check battery voltage, stop PWM and indicate on LED when battery falls below 10.8v (this is also set with a pot), response time is fast so a short circuit that produces an instant voltage drop is detected
-Check load level, check against preset level (set with pot) and if too high, shut down and indicate
-Check output voltage, adjust as required
-Check mains

*Coding is done with mikroBASIC PRO for AVR

*All voltages mentioned, eg 13.2v, 13.5v, 10.8v, Overload voltage, etc are all adjustable and set with variable resistors































This is a quasi-sine wave inverter that I made since it was more demanding than the sine at the time. I have a project with sine as well with a PIC but it's not very organized.

IPS stands for "Intelligent Power Supply", in short the inverter. IPS on means inverter on.
No, they're power MOSFETs. The design here uses IRFZ44N x 5 on each leg for 800W. You can use other MOSFETs as well. I haven't tried though. There are 4 transistors for driving the MOSFETs, on the control board - 2xPN2222, 2xPN2907. There are 2 more transistors on the MOSFET board.
It's 12-30v with changing resistors. For upto 48v, you need to change the 7805 with an auxilary supply, that's the only change.
If battery increases while charging, then there is battery full charged indicator.
Output volt is adjusted to achieve 230V or 220V as required, that is for feedback voltage setting or output voltage setting when running in inverter mode. I set mine at 230V.
Battery max is for battery high cut voltage, to cut off charging when battery reaches a specific voltage. I set mine at around 13.5v.
Charging current is for setting the current at which battery is to be charged. I set mine for 12-15A for 70Ah battery for quick charge.
Overload is for setting the maximum load. A load (800W in this case) is applied while running in inverter mode, and the pot is adjusted slowly till at one point the inverter turns off and the LED shows overload.
Low battery is for setting battery low cut voltage. I set mine for 10.5v.
On the board, the pots are labeled "HI CUT, LO CUT, OVERLOAD, FEEDBACK, CHARGING CURRENT". The one for current is a pot that is adjustable in small units.

The 4 transistors are for MOSFET driving, the other 2 are for fan and relay.
There are 2 optocouplers, one for mains sense, the other for zero crossing detection. (If you are interested in zero-crossing detection, go through this: http://tahmidmc.blogspot.com/2012/10/zero-crossing-detection-with-pic16f877a.html
I forgot to mention, this circuit requires NO AUXILIARY 9-12V TRANSFORMER.

The transformer I have is 12-0-12 primary, doesn't need to be accurate, since you can adjust the output voltage using the pot. What I meant is, say you wanted a 12-0-12 transformer, but you got some error, then you can just adjust the preset/pot to set output at 230v. No separate winding, feedback is done on board using diode/cap/resistor and micro. Charging is done using the same MOSFET board, no special capacitor or inductor, just a snubber on the board. Transformer primary is not strict. The one I used has 12-0-12 primary, secondary 0-140-280. 140 is the charger tapping, 280 is the output voltage that is adjusted.

In my circuit, I've tested it numerous time and micro never misfired. Moreover, if you notice the board, you should say a hell lot of .1u ceramic caps, ie, 104pF caps. So since decoupling is so well done, I don't think there will be firing problems. A snubber may be added IF NECESSARY. I've found that the snubber isn't always necessary and gets very hot, so I omitted it, however it may be necessary in some situations so could be added there. This is also one reason I used BTA26, huge triac so that it isn't usually shorted by other factors as I know heat and firing are not issues. All in all, this seems reliable and has run over the last few months under numerous tests.
Yes, MOSFET can be added for a nice design, but I omitted it as it was more demanding to have the MOSFET board separate, in case the MOSFETs burnt. Haven't had a situation till now, but it can easily be made into one nice PCB.

The transformer is rated at 800W power and is a standard transformer used for 800W inverters over here. I don't know about the details as I got it wound by an acquaintance who is an expert in making such transformers. The primary voltage is 12-0-12, secondary voltage is 0-140-280.
This inverter has short circuit protection. It uses the fact that during a short circuit, DC bus voltage significantly decreases. The microcontroller senses that and indicates short circuit.
Reverse voltage protection isn't provided as it's connected to the battery 24/7.


Yes, the battery charging part. My one isn't as complicated. It's a simple charger that doesn't charge the battery to absolutely full charge, but maximum charge so that it can provide optimum backup and good battery life.
The battery is charged at around 16A when near full discharged and charge current slowly decreases to about 10A when battery is near 13.5v, when battery charging is completely terminated to prevent gassing or oxidizing of the plates.
The battery charging is phase angle control based and the charging is stopped every 13 seconds when battery voltage is checked. Then charging is resumed again. I initially implemented trickle charging but later discarded it as I found it unnecessary in this case, because whenever battery voltage falls charging is again resumed for a few minutes to make sure battery is fully charged, or at least apparently fully charged.
I've had the test unit running for 8 months, but the final version as shown in the pictures has been running for about 6 months. The battery has never become hot. Moreover, it was about a year old when I started using this inverter. The battery hasn't inflated yet and provides good backup. I don't even have to replace the water frequently, so that shows that the water isn't vaporizing.
I'm using a 12v 70Ah battery. As mentioned earlier, I can run a 40W fluorescent lamp, 80W ceiling fan and computer (around 250W when not at 100% load) for about 2 hours before the unit indicates low battery. From there it takes about 6-7 hours to fully charge the battery and the charging termination to become stable. Usually after running the inverter with 80W fan and 40W lamp, it takes an hour to get it to full charge.
The unit is designed for 150-250v.

The charging current changes with battery rating. The values mentioned are for 70A battery with initial charging current set manually.

I will upload schematic and PCB soon.

88 comments:

  1. plaese upload files. thanks

    ReplyDelete
  2. I have uploaded the schematic and PCB. But code will not be uploaded now.

    ReplyDelete
  3. Hi,

    Can't find the schematic and PCB...and if you can upload the code please do..

    Regards

    ReplyDelete
  4. hi tahmid good job but please can u reup the schematics again and also the link to pwm generator and sinewave software are dead can u put it up again. thanks

    ReplyDelete
  5. very good work.please upload code and schematics.

    ReplyDelete
  6. Please upload schematic only or send to me:ismailpp2008(at)gmail.com

    ReplyDelete
  7. can you give me asm or hex file??

    ReplyDelete
  8. Please upload schematic

    ReplyDelete
  9. Hi Tahmid,,,,can u kindly explain the working of the battery charging part ? How battery charging amps are adjusted by using a POT ? Moreover , how to sense that amount of current...
    Thanks

    ReplyDelete
    Replies
    1. Battery charging is done by primary side phase angle control with a triac as the power device. The microcontroller sets the firing time/angle depending on required output current and input line voltage. Adjusting the pot adjust the reference fire angle in the microcontroller. The current is regulated by keeping the voltage constant. This is done by adjusting the fire angle for feedback.

      Regards,
      Tahmid.

      Delete
    2. hello Sir

      i need this project full details .. like ckt . bom , Hex file . i want do this for own use ..

      can you help me
      hegde .

      Delete
  10. Thanks, Tahmid..... I am implementing this scheme, but confused about the value of shunt resistance. I have 12V/150AH battery, and i want to charge it at 15 Amps, but the problem is that in the inverter mode up to 50 to 60 Amps will also pass through this shunt for a 700 watt inverter at full load.
    Hope u ll help...
    Thanks Again......

    ReplyDelete
    Replies
    1. In most commercial inverters, a simple loop of very thick wire is used as the shunt. The wire can withstand the high current during inverter mode. The voltage across the shunt is amplified by an operational amplifier stage to a large enough useable level.

      Regards,
      Tahmid.

      Delete
  11. hi thamid .....i have made a inverter and every thing was working fine ,but instead of led indication i have used 16*2 lcd display ..it was working fine when the main power was on but when the inverter was working in inverter mode the display was getting blured ...the display was powered from 12v battery follwed by 7805.plz say me any solution

    ReplyDelete
  12. hi ,,tahmid thanks for sharing your knowledge,,i have successfully designing inverter for my final year project,,
    but the problem i overcome is when i connect 10mf capacitor or transformer in the output of h bridge of irf064 mosfet i got noisy sound come from ir2113 mosfet driver and my output distorted( i got less than reqired value );and after that ir2113 won't working any more

    i wonder if you can help me,,why ir2113 burn after connected capacitor as load at the output of h bridge,,

    i will appreciate a lot..
    regards
    hassan

    ReplyDelete
  13. hi,tahmid thanks for your good job. i am doing inverter project using pic 16f72 with 20Mhz and pwm frequency range is 20khz . in which can able to generated the pwm waveform on pwm pin by sine table. by using this pwm i generated 4 pwm waveforms to drive the MOSFET the drivers.but the generated waveform frequency is not matching with original pwm waveform .
    can u help me?

    ReplyDelete
  14. hello tahmid. great work u have here. really appreciate when pple come up and share things like this. im nt really a guru in electronics but i get my hands dirty too. However i have an observation i would like to share with a couple of inverters i built.
    1) the inverter gives me a continuous endurable shock except i attach a filter cap of 2.2UF/400V at d output. im however sure theres no ac leak in the whole setup cos i tested it with my multimeter and an impedance tester. i would really appreciate if u can decipher this for me.
    the spec of the inverter is
    24-220V square wave
    1000VA
    with feedback and necessary protection ckts

    ReplyDelete
  15. Hi Tahmid,
    It was nice to see your post as well as the reply, which give us the most idea for new development and enhancement.
    Recently, I have launched my High Frequency Inverters with MPPT charger in Indian market. We are getting quite good feedback from it. However, due to cost issue, we are not able to cover small Village. As good human, i want to launch little cheaper solution for these people which will be having capacity less than 200VA. But, along with we are thinking to give the MPPT charger which is far better than PWM and normal Solar charger. My MPPT design work well in rainy season too. I want your suggestion by considering following point for design the low cost inverter and low capacity inverter.
    Solar Inverter with MPPT charger capacity upto 200 or 300VA.
    1. Which one is best for less capacity i.e. transformer based or transformer less?
    2. Simple Push Pull or H bridge, need to think for cost too?

    Waiting for your reply soon.

    Thanks,
    Prashant


    ReplyDelete
  16. hi i want to buy your hex & pcb design. Please contact: ( a.i.nayem@hotmail.com )

    ReplyDelete
  17. well written blog with useful information about Inverter with Charger.
    Inverter with Charger

    ReplyDelete
  18. Nice blog Sir. you have some really insightful ideas...thanks for sharing. pls Mr. Tahmid, do take a look at this smps based inverter posted on this blog as well as its video being all over youtube now: http://9w2edu.blogspot.com/2013/02/9w2edu-9w2zsu-my-inverter-research.html

    This is the most efficient design i have ever come across. My question is regarding the toroidal core used; the calculation as well as winding. i really would wish you could take a look. cheers!!!

    ReplyDelete
  19. Sir I need circuit and hex file pls send to chinttu2122@gmail.com pls sir

    ReplyDelete
  20. tahmid plz w want to ask teo projects hex files and circuits of 1 is 12v to 230v inverter and other is solar charge controller we are four friends and we are reallyfound of ur project and want to make two of them new we made ur temp meters and they are working fine plz give us hex and schematic of both my friends are crazy about this but please don't let us suffer we really need those two circuits we are thankful to u that u r there who made those two projects and my friend she is so found of solar systems i m a bit found of programmer please help us with ur best project please send us on roll.15.miom@gmail.com thank u

    ReplyDelete
  21. Good day Tahmid, I have been reading a lot of your work and was wondering if you could aid me in designing a Sinewave Inverter powered from 12V DC Supply to give a 115-120 V AC supply at 50-60Hz. I was hoping to use Full Bridge configuration with four n-channel Power Mosfets, IRF540, driven by Mosfet Drivers, IRF2110. I hope to drive the signals, for the mosfet drivers, from one micro-controller, PIC16F877. Additionally I would like to implement a control scheme for the Sinewave Inverter so that the output voltage is regulated between 115-120V AC. i hope to also use the PIC16F877 to do this with whatever sensing circuit is necessary. I have done some simulation on driving part of the Full Bridge and are accounting some problems and was wondering if you would look at it and see what improvements can be made but I am not seeing an upload area in this blog. My email is johnnnnygshhh@hotmail.com, and was hoping that you would share your email so that we can further discuss this topic at regular. I hope to hear a reply as your knowledge and guidance would help me in accomplishing this task, it would be greatly appreciated for any assistance you can help me.

    ReplyDelete
  22. Hello to admire so much in this project Walk a lot thanks to this Alangaz great, but I want you to service and I want printed circuit firmware Almacairkntrulr and Albrocs of the Project Walk thanks very much and I hope that you follow Emily on E-mail
    JAZEERA-CO@HOTMAIL.COM

    ReplyDelete
  23. Hello to admire so much in this project Walk a lot thanks to this Alangaz great, but I want you to service and I want printed circuit firmware Almacairkntrulr and Albrocs of the Project Walk thanks very much and I hope that you follow Emily on E-mail
    JAZEERA-CO@HOTMAIL.COM

    ReplyDelete
  24. Sir' can u plz provide Mr the hex file and PCB layout for MOSFET. I need to make this. Hope that u may help me. I am from india.thank u for ur kind consideration.. "mail.moonlite@gmail.com"

    ReplyDelete
  25. Dear Tahmid,

    Will you plz upload the schematic diagram of the inverter??

    ReplyDelete
  26. i did not found any schematic and code please upload again,
    Thanks a lot.

    ReplyDelete
  27. i did not found any schematic and code please mail me
    anasmohana@gmail.com
    Thanks a lot.

    ReplyDelete
  28. Good day Tahmid, in this project Walk a lot thanks to this Alangaz great, but I want you to service and help me so can you send it to me really I want this project printed circuit firmware Almacairkntrulr and Albrocs of the Project Walk thanks very much and I hope that you follow my email
    engw34@yahoo.com
    or
    engw34@gmail.com

    My best regards...

    ReplyDelete
  29. can i have the schematic and the code please it is urgent and i really need them

    ReplyDelete
  30. hi sir,
    please help for making this .
    please send microcontroller circuite and mosfet circuite to my email address.
    pradeepbuss@gmail.com

    ReplyDelete
  31. Hello Sir
    i am new in inverter section
    I have two inverters with same problem one is microtec 600VA and another one is luminous 600VA using 16f72
    both are working with error battery continue charging, charging won,t stop, i have checked with other battery but same problem ,
    should i change micro controller if yes should i have to program it, both inverters are NOT sign wave, or there is other fault
    please help me thanks in advance

    ReplyDelete
  32. is this project for sale how I can contact you raafattannir@gmail.com

    ReplyDelete
  33. hello tahmid could you send me the all details of this inverter.My email id is ajazalam134@gmail.com.thanks alot

    ReplyDelete
  34. sir..
    can u provide me the hex file of this project.. so that i be thankful to u if u provided that to me...
    i can provide my DSP inverter project using pic 30f 2010 by exchange ...plz plz reply

    thanking u..

    josh
    india

    mail.moonlite@gmail.com

    ReplyDelete
  35. Good Job bro, Please I can't see the schematic diagram, I will be very grateful if you can mail it to me alongside the codes. My mail is engineerenny@gmail.com

    ReplyDelete
  36. Please send me the. HEX file of this Single microcontroller based 12v to 230v inverter with intelligent battery charging to my email jjumba.derrick@gmail.com

    ReplyDelete
  37. good inverter
    i am interesting to making this inverter can you send me schematic and hex file to my email sarvjeetsingh.561@rediffmail.com.Thanks a lot if so.

    ReplyDelete
  38. I am interested in making this inverter can u send me the circuit diagram to my email
    okpalamichael34.om@gmail.com. thanks waiting to hear from you

    ReplyDelete
  39. when are you going to upload the files??

    ReplyDelete
  40. please send files for
    fadi.haddad.234@gmail.com

    ReplyDelete
  41. Hey Tahmid,

    Could you please send me the whole working and schematic of your inverter project if possible. I would be really grateful to you.Thanks in advance. My mail id is shrutirawat19101991@gmail.com

    ReplyDelete
  42. Please Tahmid send me code and schematic my email is ppsilv@gmail.com.
    I have a transformer form a UPS that is not working and I want to use it with your project.

    thank you.

    ReplyDelete
  43. This comment has been removed by the author.

    ReplyDelete
  44. please send me the code and circuit diagram
    kolleyjaymec@gmail.com
    regards

    ReplyDelete
  45. please send me the code and circuit diagram
    coicoi3108c@gmail.com
    thanks

    ReplyDelete
  46. Can I get your circuit diagram at milenkovica@gmail.com Tnx.

    ReplyDelete
  47. Hi Tahmid,
    How are you. I am Tanvir From Bangladesh. Please Give me your Inverter schematic and hex code.
    I want to build the inverter

    Thank you

    ReplyDelete
  48. Hello Tahmid,
    I'm very much impressed to see you inverter project. This is simply brilliant. Presently I'm working in the engineering division of Bangladesh army. And we have a huge requirement of inverter specially in the hill camps of Chittagong Hill Tracts where our troops are operating. It would be a great benefit for us if we can use inverters using your circuit. So, may I request you to provide me with the complete circuit diagram along with schematic, PCB, hex code and detail component list.
    Expecting your kind cooperation in this regard.

    Maj Ferdous
    Cell: +8801769011945
    Chittagong Cantonment
    E-mail: rasselbd99@gmail.com

    schematic and hex code

    ReplyDelete
  49. I Tahmid, l need help, 48v DC to 12v DC conversion circuit or 48v to 24v DC, can youplease help me
    my email is asantefred8@gmail.com, thanks

    ReplyDelete
  50. plz send me the code and circuit diagram..... arsalansidd444@gmail.com

    ReplyDelete
  51. This comment has been removed by the author.

    ReplyDelete
  52. This comment has been removed by the author.

    ReplyDelete
  53. سلام
    your job is good...
    please send to me code and schematic...
    salamreza74@gmail.com

    ReplyDelete
  54. Hello tahmid,I am planing to make a microcontroller based inverter of 500w,and I am us pic16f877a as microcontroller. Will u help me with the procedurr

    ReplyDelete
  55. ভাই,আমি তোমার গুণমুগ্ধ। আমি ইনভারটারটি নিজের জন্য বানাতে চাই, কোড আর স্কীমেটিক পাওয়া যাবে?
    ভাল থেকো,
    সোমনাথ ভড়

    ReplyDelete
  56. intelligent work.Pls can i get the circuit and code?
    oluwadarasimip@yahoo.com

    ReplyDelete
  57. Nice work!
    But i have a question how Variable Output Voltage with pot works?

    and also about battery charging with 140v how?

    please can you send any information about it on my email "bilalamin1511@gmail.com"...

    ReplyDelete
  58. Sir please send me the code andschematics

    ReplyDelete
  59. hi Tahmid. i am having some doubts on my circuit topology . Could you please clarify that .

    ReplyDelete
  60. I need schematic diagram and PCB layout kindly send to afaiz5205@gmail.com

    ReplyDelete
  61. please I need the cct diagram and the source of this project. please send to electrocompliance@yahoo.com

    ReplyDelete
  62. GOOD MORNING,

    PLEASE I NEED SCHEMATIC DIAGRAM OF THE INVERTER.

    THANKS!

    ReplyDelete
  63. I am interested in making this inverter can u send me the circuit diagram to my email
    lean4wise@gmail.com. thanks waiting to hear from you

    ReplyDelete
  64. Pls can you upload the circuit diagram and the hex file sir..

    ReplyDelete
  65. Please Mr.Tahomid can you send me the hex file Schematic diagram for this single microcontroller based inverter.

    ReplyDelete
  66. Please Mr.Tahomid can you send me the hex file Schematic diagram for this single microcontroller based inverter.This is my email address: lean4wise@gmail.com

    ReplyDelete
  67. Mr. tahmid please can you forward the circuit diagram and hex file to my mailbox: lean4wise@yahoo.com

    ReplyDelete
  68. Please send me the schematic diagram,pcb design . HEX file of this Single microcontroller based 12v to 230v inverter with intelligent battery charging to my email lean4wise@yahoo.com

    ReplyDelete
  69. Plz send me circuit diagram. I want to implement this for my own.
    Email: ranarsalan5@gmail.com

    ReplyDelete
  70. Plz tahmid I really need the pcb design, circuit diagram and hex for my upcoming project plz..my email;oma omatama.victor@gmail.

    ReplyDelete
  71. Plz tahmid I really need the pcb design, circuit diagram and hex. This is my email: lean4wise@yahoo.com

    ReplyDelete
  72. Hello Tahmid, can you please send me the code and the schematic to my email: ifaluyiosaretininn@gmail.com

    ReplyDelete
  73. Helo Sir can you plz send schematic and hex code to sri00740@gmail.com

    ReplyDelete