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.

Oct 9, 2012

600W 50Hz sine wave inverter test circuit





Here I tested a 600W 50Hz sine wave inverter circuit using push-pull topology instead of full-bridge topology. 2 PIC16F684's were used - one for SPWM and one for charging. 2 microcontrollers were used intentionally as the purpose was to test if I could use the microcontrollers together and use each of them for multitasking. 2 auxiliary transformers are used - one for powering the circuitry when running off mains and one for current sensing. Charging is done with 4 relays that are turned on/off according to input voltage and accordingly connect the input voltage to an appropriate transformer winding/tapping to keep output voltage relatively constant. Switching frequency is 16kHz. The sine table has 32 values.

Here is the complete sine table:

0, 16, 32, 47, 62, 77, 91, 103, 115, 126, 136, 144, 151, 156, 160, 162, 163, 162, 160, 156, 151, 144, 136, 126, 115, 103, 91, 77, 62, 47, 32, 16, //65%

0, 17, 33, 49, 65, 80, 94, 107, 120, 131, 141, 149, 156, 162, 166, 168, 169, 168, 166, 162, 156, 149, 141, 131, 120, 107, 94, 80, 65, 49, 33, 17, //67.5%

0, 17, 34, 51, 67, 82, 97, 111, 124, 135, 146, 154, 162, 167, 172, 174, 175, 174, 172, 167, 162, 154, 146, 135, 124, 111, 97, 82, 67, 51, 34, 17, //70%

0, 18, 35, 53, 69, 85, 101, 115, 128, 140, 150, 160, 167, 173, 178, 180, 181, 180, 178, 173, 167, 160, 150, 140, 128, 115, 101, 85, 69, 53, 35, 18, //72.5%

0, 18, 37, 55, 72, 89, 104, 119, 133, 145, 156, 166, 174, 180, 184, 187, 188, 187, 184, 180, 174, 166, 156, 145, 133, 119, 104, 89, 72, 55, 37, 18, //75%

0, 19, 38, 56, 74, 91, 108, 123, 137, 150, 161, 171, 179, 186, 190, 193, 194, 193, 190, 186, 179, 171, 161, 150, 137, 123, 108, 91, 74, 56, 38, 19, //77.5%

0, 20, 39, 58, 77, 94, 111, 127, 141, 155, 166, 176, 185, 191, 196, 199, 200, 199, 196, 191, 185, 176, 166, 155, 141, 127, 111, 94, 77, 58, 39, 20, //80%

0, 20, 40, 60, 79, 97, 114, 131, 146, 159, 171, 182, 190, 197, 202, 205, 206, 205, 202, 197, 190, 182, 171, 159, 146, 131, 114, 97, 79, 60, 40, 20, //82.5%

0, 21, 42, 62, 82, 100, 118, 135, 151, 165, 177, 188, 197, 204, 209, 212, 213, 212, 209, 204, 197, 188, 177, 165, 151, 135, 118, 100, 82, 62, 42, 21, //85

0, 21, 43, 64, 84, 103, 122, 139, 155, 169, 182, 193, 202, 210, 215, 218, 219, 218, 215, 210, 202, 193, 182, 169, 155, 139, 122, 103, 84, 64, 43, 21, //87.5%

0, 22, 44, 65, 86, 106, 125, 143, 159, 174, 187, 198, 208, 215, 221, 224, 225, 224, 221, 215, 208, 198, 187, 174, 159, 143, 125, 106, 86, 65, 44, 22, //90%

0, 23, 45, 67, 88, 109, 128, 147, 163, 179, 192, 204, 213, 221, 227, 230, 231, 230, 227, 221, 213, 204, 192, 179, 163, 147, 128, 109, 88, 67, 45, 23, //92.5%

0, 23, 46, 69, 91, 112, 132, 151, 168, 184, 198, 210, 220, 228, 233, 237, 238, 237, 233, 228, 220, 210, 198, 184, 168, 151, 132, 112, 91, 69, 46, 23 //95%

//0, 25, 49, 73, 96, 118, 139, 159, 177, 193, 208, 220, 231, 239, 245, 249, 250, 249, 245, 239, 231, 220, 208, 193, 177, 159, 139, 118, 96, 73, 49, 25, //100%

Each 32 values corresponds to one half-cycle of a 50Hz sine wave, each set corresponding to a different duty cycle. The duty cycle varies as the amplitude of the sine wave is varied by adjusting the value of the CCPR1L register. The maximum value of each set of 32 values is set to correspond to a different duty cycle and the other 31 values are in the same ratio to the maximum value for all sets of values. A pointer is used in the main code to retrieve the required set of 32 values for a required duty cycle. The lowest duty cycle is 65% because, for feedback, lower duty cycles are not required. The maximum duty cycle is set at 95% to provide some dead-time and avoid cross-conduction. At the beginning of each half-cycle, one MOSFET is driven according to the duty cycle values retrieved from the table. At the end of the half-cycle and beginning of the next half-cycle, the other MOSFET is driven according to those same duty cycle values. Upon a fault condition (such as low-battery), both MOSFETs are turned off and kept off.

It works as intended and testing was successful. However, it requires adjustments to be made for the final one.

108 comments:

  1. hello tahmid

    i'm working on the same project
    i want to ask you somethings

    1- is the transformer 12-0-12 or less
    2- how fast is your feedback and why made it as a table and pointer instead of declaring a variable to be added to the original sine table.

    3- did you use filtering on dc side or ac side

    4- if possible, can you post your schematic and pcb

    thanks in advance

    ReplyDelete
  2. 1) Primary is 7-0-7, Secondary is 245 (or 250)
    2) I can't really tell an exact quantitative value, but it's fast enough. I've had to calibrate the time between duty cycles so that it isn't too fast (which results in too much overvoltage or undervoltage during correction) or too slow (which results in poor regulation). The calibration was largely an experimental trial-and-error process.
    3) At the output AC side.

    ReplyDelete
  3. okk thanks for your reply. i guess not answering 4) would be a no. one more question. what did you use as a driver for the mosfet. di you drive them directly from pic or did you use some sor of driver. i designed my own totem pole circuit. sometimes mosfets blow just when i connect the battery. sometimes i connect/reconnect the battery millions of time and they don't blow. any suggestion will be highly appreciated

    thanks in advance, with the hope of providing your schematic an program if possible

    ReplyDelete
  4. come on man, a little help here please. i'm really desparate to know what's going wrong with my circuit

    ReplyDelete
  5. Sorry for the late reply. Please be patient. I will reply to your queries.

    Since the MOSFETs are configured as low-side switches, low-side drivers will suffice. I used the TC427 driver manufactured by Microchip.

    Did you "step up" (level shift) the 5V of the PIC to 12V for MOSFET drive? You should do that, since Power MOSFETs are only fully on when driven with >8V VGS. Maybe your MOSFETs burn due to them not being fully on. It's very possible.

    ReplyDelete
    Replies
    1. hello Tahmid goodwork could u post this circuit for us to see. Thank you

      Delete
    2. hi
      i want to design 300v d.c to 220v a.c inverter can u help me...

      Delete
  6. hello tahmid nd thanks a lot for reply.

    i did level-shift the 5vdc to about 10vdc. i guess i have a poor totem pole circuit design! i will go for a driver ic to be safe. when will you upload your schematic and if possible, may i have your email please? it's an honor to me to know and be in touch with you. you are a very smart guy and i'm looking forward for your help whenever needed and to share thoughts and ideas as i'm interested in smsp domain too.

    thanks in advance, and beleive me, i have been opening this page about 30 times a day hoping each time that you have replied :)

    ReplyDelete
  7. Yes, it could be a problem with the totem-pole driver. Using a driver IC is better.

    I will upload a schematic, but now I'll give you an idea. It's quite simple. The signals from 2 pins of the PIC16F684 - the P1B and P1D of the ECCP module (pins 6 and 8 respectively) - are fed to the driver TC427 which drive the MOSFET, which then drive the transformer. There is a filter capacitor at the secondary of the transformer. One of the small transformers is used for feedback. Its output is rectified, filtered, stepped down and read by the ADC.

    My email address is: inferno-rage(at)hotmail.com

    ReplyDelete
  8. OK THANKS. I WILL WAIT FOR YOU TO UPLOAD THE SCHEMATIC. MEANWHILE I WILL BE TESTING AND REDESIGNING MY CIRCUIT. ONE MORE THING TO ADD TO MY DESIGN IS THE SNUBBER. ANY THOUGHTS OF HOW TO CHOOSE? RC OR RCD SNUBBER?

    BEST REGARDS TAHMID AND THANKS A LOT

    ReplyDelete
  9. Use RC snubber. Selection of the snubber really is up to test and trial, since there are too many factors that can not be taken into consideration in formulae.

    ReplyDelete
  10. hello tahmid. it's been long i hope you are fine. i'm still waiting for you to upload you schematic and code.
    Also, what is the type and value of capacitor you used for AC output filtering

    i hope you will reply and upload the files asap

    regards

    ReplyDelete
  11. MR TAHMID
    could you please upload the schematic or simulation of the circuit

    ReplyDelete
  12. Hello tahmid how are you i hope fine.

    I implemented the sine able in c at a frequency of 20KHz and 40 point SPWM for 180 degrees, and i changed my circuit to ir2110 driver instead of dicrete components. i get 21VAC at 65% dyty cycle values. i'm using a 8-0-8 to 220 transformer. however i notice that one side of the mosfet gets a little bit hot while the other doesn't. also the signal shown on oscilloscope has a high peak odf 272v while a low peak of 252v. what could be causing this difference. please comment on my work and suggest for me what to do to solve the high and low voltage difference

    i'm going to implement feedback now, while waiting for your reply.
    i hope you attach your files too.

    thanks in advace.

    ReplyDelete
  13. Can you show the oscilloscope signal?

    Which side MOSFET gets hot? If it's the high side, you need to increase the size of the bootstrap capacitor.

    "i get 21VAC at 65% dyty cycle values"

    Do you get 21VAC at the output side?
    That can't be right.

    ReplyDelete
  14. hello tahmid

    sorry it is a typing mistake
    it's 220VAC at 65% not 21VAC

    i'm using push-pull configuration and i referenced vb to 12v and vs to gnd, this way i'm using ir2110 as dual low side driver. i gues this way there is no high side driver, no?

    ReplyDelete
  15. hey tahmid

    i'm sending you by email the software i'm using for now, which has noo feedback yet. please, please try it in proteus and watch what's happening.

    i'm using pic12f683 and ccs c compiler

    ReplyDelete
  16. Ok. I got your email. I'll take a look.

    ReplyDelete
  17. i want to design single phase inverter (220V-10A) and i need some help

    1- the output of my inverter as shown
    how can i made it pure sin wave ? ( i want how to design Lc filter )


    2- Is it Necessary to use optocouplers in my circuit ??
    if it necessary , what type can i use and where can i put in circuit (between microcontroller and IR2110 ??)

    3-when i feed the 4 igbt with 24 Vdc , what transformer can i use to step up the voltage to 220 Vac and what is price ??

    4-if i feed the 4 igbt with 220Vdc , is the igbt work properly

    5-i need a protection for my circuit , what devices can i use for this

    thanks advanced

    ReplyDelete
    Replies
    1. 1) The inductor will be between H-bridge output and load (in series with load). The capacitor will be across the load (in parallel with the load). Just Google for LC filter.

      2) This depends on your requirement of isolation, your design and implementation.

      3) You need to use a 50Hz iron core step-up transformer. The primary:secondary ratio will be about 20V:350V. Price will depend on your location. But it won't be cheap.

      4) You can use the H-bridge with high voltage, obviously. For 220VAC output, the DC rail should be at least 320V.

      5) It depends on specifically what type of protection you need.

      Hope this helps!

      Regards,
      Tahmid.

      Delete
  18. this is my output
    http://imageshack.us/photo/my-images/194/22703433.jpg/

    ReplyDelete
    Replies
    1. Please upload the schematic and Proteus file. Specify the LC filter component values.

      You may upload to rapidshare or other such online storage site. Remember to make the file(s) public.

      Regards,
      Tahmid.

      Delete
  19. if i feed the 4 ibgt with 320 Vdc , i will need lc filter ( inductor and capacitor large enough to withstand high current (10A) is it right ??)

    how can i design the lc filter for 50Hz output to have pure sine wave??

    i will upload schematic and Proteus file now

    ReplyDelete
    Replies
    1. You can search Google and you'll get loads of results. Till now, I've designed the filter by experimentally selecting and adjusting component values. You can follow the same trial and error method.

      Regards,
      Tahmid.

      Delete
  20. i need a protection for 4 igbt and a protection for overload and short circuit

    ReplyDelete
    Replies
    1. You need a means of sensing the current and shutting down the PWM quickly.

      Common methods of current sensing involve the use of:
      1) Shunt Resistor
      2) Hall-Effect Sensor
      3) Current Transformer

      Shunt Resistor is the cheapest of the methods. Use a comparator/microcontroller-based circuit that shuts off the PWM when the voltage across the shunt resistor crosses a reference voltage(select for appropriate current).

      Hope this helps!

      Regards,
      Tahmid.

      Delete
  21. 2) This depends on your requirement of isolation, your design and implementation.

    here is my design , but really i use IR2110 not IR2112 , and i use your IR2110 circuit

    http://rapidshare.com/files/505816887/1.rar

    ReplyDelete
    Replies
    1. Your rapidshare file gives this error:

      "Download not available
      Download permission denied by uploader. (0b67c2f5)"

      You must make the file public. Do this by making a new folder in your file manager and copying the contents from the default folder to the new folder. Change the "privileges" of the new folder from private to public.

      Regards,
      Tahmid.

      Delete
  22. it is possible to made a rectifer to convert 220VAC to 320 VDC

    ReplyDelete
  23. sorry ,is it possible to made a rectifer to convert 220VAC to 320 VDC ??

    ReplyDelete
    Replies
    1. If the AC wave is sinusoidal in shape, when rectified and filtered with sufficiently large capacitor, the rectified DC voltage will be approximately 310VDC.

      Regards,
      Tahmid.

      Delete
  24. OK HERE IS
    http://rapidshare.com/files/505816887/1.rar

    BUT I WANT 10A OUTPUT the diode uf4007 rating is 1A , what i do ??

    ReplyDelete
    Replies
    1. UF4007 is okay. 10A is the output current you want. UF4007 is only for providing the supply for high-side drive. It doesn't decide the output current.

      In your current configuration, the MOSFET bridge runs off the same ground as the microcontroller and so there is no isolation. I don't think you need isolation unless there are issues with not being able to touch the ground.

      By the way, you forgot to connect VS of U5 to source of Q3.

      Regards,
      Tahmid.

      Delete
  25. HI
    you said :
    But, if you must check high side pulse, remove the MOSFETs. Connect VS (pin 5) to ground and measure/observe the pulse/voltage from pin 7 to ground. You can see the pulse then. Remember to remove the connection of VS from ground before reconnecting the MOSFETs again.


    why i must connect VS (pin 5) to ground to see the pulse ??
    and why i remove the connection of VS from ground before reconnecting the MOSFETs again.??

    when i connect 30Vdc to igbt the output is 3V and it is not sin wave , what is the problem ?

    ReplyDelete
    Replies
    1. VS is a virtual ground for the high side MOSFET. It is not connected to the ground - it isn't ground referenced. When HO = 1 (with respect to VS), VS is isolated from ground. But you'll be measuring with respect to ground. So, you need to connect VS to ground.

      I've found that measuring or attempting to measure across HO and VS doesn't give any output on the oscilloscope.

      Hope this helps!

      Regards,
      Tahmid.

      Delete
  26. Hi Tahmid
    Plz could u send schimatic and code for ur design?
    this is my email : far_a_way67@hotmail.com

    thank u

    ReplyDelete
    Replies
    1. I chose not to upload these as the purpose of my articles is educational and I believe that you will learn more by attempting to design the complete code from the multiple tutorials, hints and suggestions I have provided on the blog. If there are certain doubts you have in any part of the implementation of sine wave generation, feel free to ask. Although I believe, I would have that covered in one of my tutorials: http://tahmidmc.blogspot.com/p/blog-page.html

      Regards,
      Tahmid.

      Delete
  27. Thank u very much
    i want to ask about charging method,, what is u advice?
    1- using Angel phase control ac side of transformer ( i use half bridge center tap inverter )
    2- or use mosfet ( p-channel or N-channel ) on dc side and use pwm method to control volt and ampere

    also what is Yor suggestion of shunt resistor to calculate ampere use for 1000w inverter in 12v meaning 100Amp,,, use same cable of battery or use resistor?

    ReplyDelete
    Replies
    1. If you're using a full-bridge anyways, I would recommend choice (2). You can just utilize the existing full-bridge for charging. Why bother with additional phase angle control circuitry, right? The simpler the better.

      The current will be very high and so you'll want to keep sense voltage VERY low. You can use a resistor for precision but usually for over-current protection, accuracy isn't required. So, you may use the PCB trace or a piece of wire or the cable as the shunt.

      Regards,
      Tahmid.

      Delete
  28. i wait your replay, it's also for personal use, Becuse here in Gaza Palestine we have problem in electricity, try to solve ....

    ReplyDelete
    Replies
    1. Hi,

      I have replied to your query above.

      I wish you success on your projects. Don't hesitate to ask if you have any questions.

      If I do take time to respond to your queries, please be patient. I'm currently very busy with my exams.

      Just know that I WILL reply. Just give me time.

      Regards,
      Tahmid.

      Delete
  29. thanks very much, ihave another problem,, i have full H bridge 24v true sine wave inverter, for box issue i put the bridge away from controller 50cm using 1mm cable for each mosfet, the low side mosfet gate dont reach 8v !! its only 4v half of need, why? 50cm make this problem? can i use another boost drive ( pnp + npn ) to avoide this problem?in the end of 50cm cable?

    ReplyDelete
    Replies
    1. Are you measuring the voltage using a voltmeter? If so, you'll be reading the average voltage. Voltage reading will equal (peak voltage) * (duty cycle). You'll want (peak voltage) of >= 8V. Average voltage reading (read by multimeter) will be lower, depending on duty cycle. 50% is a common figure for duty cycle (for testing purposes usually, without feedback gives ~50% duty cycle). If feedback is implemented, a lower voltage will be read.

      Regards,
      Tahmid.

      Delete
  30. same read in orginal board give me in higt and low side 8 v, but in extended mosfet band , use only the same mosfet ( one mosfet for each side) give me in hight 8v and in low not 8,, output of transformel reduce to half 115v insted of 230v

    ReplyDelete
    Replies
    1. In that case, you should use a drive circuit near the MOSFETs on the same board where the MOSFETs are. First test by using a simple transistor-based driver, for example, and see if that helps. If it solves your problems, then reconstruct/redesign the MOSFET board with the driver incorporated. You can choose to use transistor-based driver or specialized driver cihp (I prefer the second). You may find these 2 tutorials/articles helpful:

      http://tahmidmc.blogspot.com/2013/01/using-high-low-side-driver-ir2110-with.html
      http://tahmidmc.blogspot.com/2012/12/low-side-mosfet-drive-circuits-and_23.html

      Regards,
      Tahmid.

      Delete
    2. In that case, you should use a drive circuit near the MOSFETs on the same board where the MOSFETs are. First test by using a simple transistor-based driver (maybe construct on a breadboard, verroboard or another PCB), for example, and see if that helps. If it solves your problems, then reconstruct/redesign the MOSFET board with the driver incorporated. You can choose to use transistor-based driver or specialized driver chip (I prefer the second). You may find these 2 tutorials/articles helpful:

      http://tahmidmc.blogspot.com/2013/01/using-high-low-side-driver-ir2110-with.html
      http://tahmidmc.blogspot.com/2012/12/low-side-mosfet-drive-circuits-and_23.html

      Regards,
      Tahmid.

      Delete
  31. Hi
    Thanks for a very educational blog.
    I am trying this out with small variations.
    The o/p comes on, like a switched square wave without a filter. I am getting a no load current of 2A without filter, where as it jumps higher when I try to filter the waveform. How do I design the filter cap value across the push pull transformer secondary? I am trying for a filter cutoff of 200Hz. Do I need to add a filter inductor also? Pi filter? T filter? lost......... :(
    My gate drive is a simple opto circuit, since I am using 1.6KHz SPWM for my mosfets.
    Thanks
    Dom

    ReplyDelete
    Replies
    1. A single capacitor should do it. Try with a range of values between 0.1uF and 10uF. If you still don't get satisfactory results, add a filter inductor in series with the capacitor and test again.

      Even though the frequency is low, you shouldn't underestimate the importance of the drive circuit. I hope you have a good driver circuit in place! You should find this helpful:

      http://tahmidmc.blogspot.com/2012/12/low-side-mosfet-drive-circuits-and_23.html

      Regards,
      Tahmid.

      Delete
  32. help me, please!!!
    I can not code feedback+spwm.
    send me please code feedback+spwm.
    tantra-yog@yandex.ru

    ReplyDelete
    Replies
    1. Where are you encountering problems? I've given the idea in the article. Use that and proceed. Keep on trying. If you struggle, ask questions. But do it yourself. Only then will you learn.

      Regards,
      Tahmid.

      Delete
  33. help me out am doing a project about speed control of induction motor using igbt power inverter.

    ReplyDelete
    Replies
    1. Use V/F control. You can get loads of resources for that online. Go through these:

      http://ww1.microchip.com/downloads/en/AppNotes/00843a.pdf
      http://ww1.microchip.com/downloads/en/AppNotes/00887a.pdf
      http://ww1.microchip.com/downloads/en/AppNotes/00967A.pdf
      http://techtrain.microchip.com/webseminars/documents/ACIM_PIC18Fxx31_BW.pdf
      http://www.atmel.com/dyn/resources/prod_documents/doc7545.pdf

      Regards,
      Tahmid.

      Delete
  34. Hello Tahmid keep up the good work I have been following your post on most of your blogs I just saw this sine wave inverter. Could u tell us where we can see your schematic diagram for this inverter . I am a lover of transformer output inverters. Thank you

    ReplyDelete
  35. Hi Tahmid,
    I am trying to make inverter of 800W.
    It gives me o/p of 220V AC without any load.
    But the problem is my o/p volts goes down to 60 V from 220V with load of 200W bulb.
    To resolve it i increase duty cycle in run time and i achieved 220V with load.
    But i reached to maximum duty cycle with one bulb of 200W.
    i have to connect load of 800W.
    My transformer rating is 12V AC to 300V AC.
    please help me to solve this issue.

    Thanks
    Dhaval

    ReplyDelete
  36. Hi Tahmid,
    I'm doing the same project for my course and I'm having trouble starting the code.frankly I don't know how to start it. I was wondering if you can help me. thanks

    ReplyDelete
    Replies
    1. You should start by working on the different sections one-by-one individually, and then finally combine all the parts. So, a good starting point would be to get the SPWM up and running. Then focus on the MOSFET drive, and then on the other parts.

      Regards,
      Tahmid.

      Delete
  37. Please I didn't see any circuit diagram for the project.

    ReplyDelete
  38. Hello Mr tahmid could u send me a link online for a trensformer based sine wave inverter not using a pic thank u. I have been searrching aroung over a year and even following ur blog but not able to get one going . please help me here thank u

    ReplyDelete
  39. Hi tahmid, ive really learned alot from you. please i have a serious problem. i modified your code to mikrobasic language, and it works very fine on proteus, but when i built it on center tap ups 600va transformer the heating was terrible, it works but the voltage dont get up to 250volts, and worse it doesnt carry load at all despite i filtered it with 1uf 400v ac capacitor. and one side of the drives fets gets hotter than the other. im using ir2110 x2 for lo side drive. please can you elaborate on this problem / wahala as my country people say. thanks in advance.

    ReplyDelete





  40. i created 15 constant callup table for different duty cycles with 32 steps each, couldnt upload them cos the blog cant accept more than 4096 characters.



    dim duty_cycle as byte[15]
    dim pointer, direction, pointer1 as byte
    dim cnt as byte
    dim feed_back, shut_down as word


    sub procedure interrupt
    if (PIR1.TMR2IF) then


    inc(pointer1)

    if feed_back < 220 then
    inc(cnt)
    end if

    if feed_back > 220 then
    if cnt > 0 then
    dec(cnt)
    end if
    end if

    if shut_down < 10 then
    CCPR1L = 0
    goto endd
    end if

    if pointer1 > 1 then
    pointer = pointer + 1
    pointer1 = 0
    end if
    if cnt > 14 then
    cnt = 14
    end if

    if pointer > 31 then
    if direction = 1 then
    CCP1CON.P1M1 = 0
    CCP1CON.P1M0 = 1
    direction = 0
    else
    CCP1CON.P1M1 = 1
    CCP1CON.P1M0 = 1
    direction = 1
    end if
    pointer = 0
    end if

    duty_cycle[0] = sin_table0[pointer]
    duty_cycle[1] = sin_table1[pointer]
    duty_cycle[2] = sin_table2[pointer]
    duty_cycle[3] = sin_table3[pointer]
    duty_cycle[4] = sin_table4[pointer]
    duty_cycle[5] = sin_table5[pointer]
    duty_cycle[6] = sin_table6[pointer]
    duty_cycle[7] = sin_table7[pointer]
    duty_cycle[8] = sin_table8[pointer]
    duty_cycle[9] = sin_table9[pointer]
    duty_cycle[10] = sin_table10[pointer]
    duty_cycle[11] = sin_table11[pointer]
    duty_cycle[12] = sin_table12[pointer]
    duty_cycle[13] = sin_table13[pointer]
    duty_cycle[14] = sin_table14[pointer]

    CCPR1L = duty_cycle[cnt]
    endd:

    PIR1.TMR2IF = 0
    TMR2 = 90
    end if

    end sub


    main:
    trisc = 0
    portc = 0
    trisA = $FF
    adcon1 = $82
    PR2 = 251
    cnt = 0
    TBL_POINTER_NEW = 0
    TBL_POINTER_SHIFT = 0
    TBL_POINTER_OLD = 0
    pointer = 0
    pointer1 = 0
    direction = 0
    CMCON0 = 7
    CCP1CON = 0x4c
    t2con = 4
    tmr2 = 90
    PIR1.TMR2IF = 0
    PIE1.TMR2IE = 1
    INTCON = $C0


    start:

    feed_back = adc_read(0)

    if feed_back > 1000 then
    feed_back = 1000
    end if


    shut_down = adc_read(1)

    if shut_down > 1000 then
    shut_down = 1000
    end if

    if shut_down < 10 then


    trisc.6 = 1
    trisc.5 = 1
    trisc.4 = 1
    trisc.3 = 1

    else

    trisc.6 = 0
    trisc.5 = 0
    trisc.4 = 0
    trisc.3 = 0
    end if
    goto start
    end.

    is the code i used.

    ReplyDelete
  41. hellooo, ive been waiting for your reply please.

    ReplyDelete
  42. ive built it on full bridge, the problem is that the transformer cant carry load. i used the transformer i use on my 1500watts squarewave Inverter on it, but i dont get up to 300watts from the same transformer on full bridge spwm. what do you think is the problem??

    ReplyDelete
  43. Hi,


    Did you use a filter between your Transformer and the switching mosfets?


    thanks, nick

    ReplyDelete
  44. no i didnt, i filtered it via the output of the transformer 1uf 400v ac capacitor. yet the output of the transformer isnt strong enough to carry loads compared to when i use the same ttansformer on a square wave application.

    i discovered that @ maximum duty cycle, 10v instead of 12volts goes into the full bridge.

    should i change the winding pattern of my transformer???

    ReplyDelete
  45. hi Utlrakings,

    I was asking at tahmid :p
    But to reply on your question make sure the winding ratio is right, you need something like 32 or 33 if you use a 12V suply.

    The peak voltage in a pure sine wave inverter is 325V (230/0,707), divided by your minimum operating volts (10V?) this gives about a 1/32 ratio.

    In a squarewave inverter its something like 1/23 if you use squarewave and for modified square wave something like 1/25.
    If you have a transformer with a1/25 ratio and your input is only 10V you have about 176V at your output.

    Make sure you are using mosfets in your bridge, igbts are not suitable for low voltage aplications.

    hope this helps!

    ReplyDelete
  46. thanks van.

    im actually using mosfets (IRF1404) for my circuit. i also found out that commercial sinewave Inverters uses much bigger transformers. im thinking of re-winding the transformer to suit my application. but Tahmid please throw more light on the transformer winding strategy, its giving me a headache. im tired of trial and error on this transformer stuff

    ReplyDelete
  47. Hurray!!!! ive finally done it. 600watts on full bridge, it works perfectly and its very stable, though i had problems stabilizing it, i successfully used pic16f684 for sinewave oscillator, then used an exclusive or gate to feed it into IR2110. the purpose of the ex_or gate is to enable me implement buckboost charging using another pic. Im very grateful Thamid for this blog, it helped me alot kudos to you.

    ReplyDelete
    Replies
    1. That's awesome Ultrakings! Good luck on the rest of your project(s)!

      Regards,
      Tahmid.

      Delete
    2. Hi there Ultraking and Thahmid......Pls ultraking, how did you eventually resolve your issue? what was the transformer winding ratio you finally settled for? thanks in advance.

      Delete
  48. Hi Tahmid,
    Is that an iron core transformer (designed for 50Hz) ?
    Is it safe if I use this kind of transformer and feed it with 6kHz - 18kHz spwm ?

    Because in my place it's pretty hard to find a ferrite core transformer...

    Thank you

    ReplyDelete
    Replies
    1. Hi,

      Yes, it's a 50Hz iron core transformer.

      Yes, it's completely safe. In fact, that's what you're supposed to use. You can't use a ferrite core like the way I did. The SPWM is at 6kHz to 18kHz (or whatever you decide), but the resulting AC waveform is 50Hz. Notice how the high frequency modulation takes place over 10ms; then the same happens over another 10ms in the opposite direction. So, the resulting wave has a 50Hz frequency.

      Hope that clears it up.

      Regards,
      Tahmid.

      Delete
  49. hello Tahmid,

    This is a great blog you have, your tips and tutorials has been helpful in clearing up some design problems I have been encountering for quiet a while now. While I have found some answers, I still have some questiosn which I will be very grateful if you will help me out.
    1. I have a circuit which consist of three irf3205 in parallel for a 700w, 12v-350Vdc converter, The first circuit i build gets too hot when I
    use a totem-pole driver(single driver for driving the 3 parallel mosfets in each leg) at the output of my SG3525 pwm controller to
    drive them with no output at the secondary side of my transformer when there is no load , the second circuit I build produces the
    require dc output(350V at no load) but the heatsinks of the transistors still gets too hot to the touch so I decide to switch to
    IR2110 IC for my drive. My question is :Can I use a single IR2110 to drive my mosfets(3 in parallel for each leg of the push pull)
    or do I need to use separate IR2110 for each pair of push-pull mosfets.

    2. Going through your 600W post here, from the questions your answered for of of the visitors here, you said it is okay to switch an
    18Khz SPWM signal through an iron-type transformer but from my studies in school, I thought that iron transformers can only be
    operated up to 400Hz only without excessive loss, won't operating at such high frequency heat up the core excessively?

    3. Please, can you create a tutorial on selection of simple RC snubbers for mosfet.

    Regards
    Faruq(Nigeria)

    ReplyDelete
    Replies
    1. 1. You should be able to use a single IR2110 to drive all the MOSFETs.

      2. You can't operate the iron core transformer at more than 400Hz. True. But, when I mentioned about using 18kHz SPWM, what I meant is that 18kHz SPWM is applied in ONE DIRECTION for about 10ms; then 18kHz SPWM is applied in the OTHER DIRECTION for about 10ms. So, while you ARE passing 18kHz SPWM signals, you're only doing this in ONE DIRECTION for 10ms, meaning that the transformer effectively "sees" 50Hz and not 18kHz. This is because while you're pulsing the 18kHz, you're not switching direction of current every 18kHz cycle, but after 10ms --> ie. 50Hz. I hope that clears it. If not, feel free to ask again.

      3. From experience, I've noticed that this is more of a trial and error thing rather than a fixed design process.

      Regards,
      Tahmid.

      Delete
    2. Yes, thanks very much. this also supports what I read in one of the IEEE publication I came across while researching spwm inverter design.The tittle is Bidirectional spwm inverter design. It is a good read for those Interested in spwm design.
      With this I can focuse my effort on using the iron type tranformer for my design because of its' availability in my country instead of wasting time on ferrites.

      Once again, thanks very much and keep up the good work.
      Regards,
      Faruq
      Nigeria

      Delete
  50. hello tahmid,
    is it possible to design a circuit like this using a push pull configuration but without using microcontrollers but analog components and if so how do we get the each half wave segment of 50 Hz broken into small tiny blocks to imitate each sine half wave

    ReplyDelete
    Replies
    1. Yes it is possible, but it is quite complicated. It's actually much less complex if you use a microcontroller. Of course, you'd need previous experience in microcontrollers. But, just with analog components, a complete sine wave inverter with functions such as those required for a commercial product, becomes extremely complex to make.

      Regards,
      Tahmid.

      Delete
  51. hello tahmid,
    thanks for replying.i am grateful
    well tahmid the thing is i really dont have experience with microcontrollers at all and i have never been comfortable with them and besides i am not trying to build one for commercial product i just want to do something that will keep me busy and motivated as i dont care how much i have to spend.I am a student on a long break but i am bored and this looks like a very good challenge so if you can give me tips and point me in the right direction i will be grateful to you.
    Here is what i want to do
    1)use a centre tap transformer just like you did in a push pull mode switching at maybe 6Khz-16Khz(will select between this figures)
    all done with analog components having just the most important function which is feedback for automatic voltage regulation under various loads.
    I dont mind the complexity just tell me what and what i have to do and show me the way.Dont worry about me.
    incase you have any thing more to tell me you can reach me on mexzony@gmail.com
    thanks

    ReplyDelete
  52. Dear Tahmid,Iam designing a syn buck converter. The voltage from 210VDC to142VDC/30A. I am using IRF350 N-Ch Mosfets. What difficuities I am facing is I have drive PWM from Pic 12F683. My Gate drive Ic IR2110. It has a Hin and Lin. How can I connect the single PWM to complementary out to feed IR2110 in put side? Thank you in Advance. Regards.
    -Ranganathan

    ReplyDelete
  53. hi i need some data about 300V D.C to 220V A.C inverter can anyone help me ...plz inbox me circuit diagram
    naumanali44@yahoo.com

    ReplyDelete
  54. Hi Tahmid, are they possible using 12v to generate 220v pure sinewave 1KVA? what are trafo we need?

    ReplyDelete
  55. The author is obviously not uploading any circuit nor giving any detail plus there is a live feed running this is more of a publicity stunt to trap people and get maximum number of hits and nothing else i think this board has been copied from somewhere if you see my message u won't waste time asking about the circuit as he as probably none

    ReplyDelete
  56. sir were is the circuit ????

    ReplyDelete
  57. I blog often and I genuinely appreciate your content. This article has really peaked my interest.
    I will take a note of your blog and keep checking for new information about
    once a week. I opted in for your Feed too.

    My blog; Inverter ABB

    ReplyDelete
  58. Dear Tahmid, I am designing a 3KW UPS. input is 230V - 50HZ mains. I want 230V - 50 HZ output. the driver circuit and H-bridge is working fine. The output LC filter is 3.1mh, 12.5uf and inductor is iron-core. On load the output is 228Volts. But as I load the output, voltage drops with load. At 12 Ampere, It drops to about 170 Volts.
    Can you suggest some remedy to this problem.
    Also if you could mention how to calculate D.C. capacitor bank value according to load in inverter.

    ReplyDelete
  59. Please help me in LC filter for Sine wave INverter ...Google isnot helping...PLease
    ijazasjjad6@gmail.com

    ReplyDelete
    Replies
    1. Hey! Where are you getting stuck? What problems are you having? Have you done the preliminary calculation before trial and error?

      Delete
  60. Hey bro ..
    Circiit diagram of power bank
    In it 1 usb cable for charging bank and use otg cable at same usb to charge mobile
    Input 2A , output 2A
    Pl help

    ReplyDelete
  61. Thank you for sharing information on this blog this is valuable , helpful
    Inverter manufacturers

    ReplyDelete
  62. Good work tahmid... u can as well find useful information on sinewave inverter and videos at www.acecct.blogspot.com

    ReplyDelete
  63. hai tahmid please send me the proteus simulation file for single phase full bridge mosfet with driver ir2112 to this mail akbarali.4511@gmail.com

    ReplyDelete
  64. HI Tahmid, It's been a while, I have tried two different design topology (Push-pull and Full bridge) using Iron Transformer as the main output transformer with capacitor as the only filter component at the output. On no load, I can get the required 24oV AC using 7Vac X2 to 220V transformer I removed from my UPS. However, when I load the inverter with only 60Watts filament bulbs the voltage drops to 125VAC on secondary and from 9.2VAC to 5VAc on the primary for both topology Can you please help me out.
    Note:
    1. The input voltage is 12VDC
    2. I have not really implement the feedback since I want to completely understand circuit behaviour before using feedback.
    3. I will like to resolve this because I want to implement same using High Frequency Transfomer, hence any help you can give will be greatly appreciated

    Regards

    ReplyDelete
    Replies
    1. Hi tahmid,
      I have solved the problem and decided to mention it here for those who have similar problem. I used a totem-pole driver to step up the SPWM drive signals from the 16F684 PIC to 12V before feeding it to the IR2110 driver. The reason being that, when on load one of the H-Bridge/Push-Pull mosfet(High-frequency side) was not turning on fully. Also, instead of the 5VDC supply to the VDD pin of the IR2110 driver, I wire the pin directly to VCC (12V supply) so that the gate-drive voltage for the mosfet will be about the same. I applied this correction to both type of inverter I designed (HF inverter using ferrite transformer ans single stage inverter using iron-transformer).

      Regards

      Delete
  65. Hi Tahmid

    This my email address asantefred8@gmail.com, l am from Ghana send me your email.com and lets talk. l want you to help
    me design PIC 16F876A inverter or one like the PIC16F684. Thank you let me hear from you soon.

    ReplyDelete
    Replies
    1. Hello Fredrick, I think it is wrong to ask some one to help you privately in this forum. If the blogsite owner was not an open and honest person, most of us in this forum won't receive the assistance we need to move forward with our projects. Rather than ask for private help, it will be more proper to give an explanation of where you are stuck so that people with similar issue can follow the posting and maybe solve their own problem using responses to you post.

      Please, describe what you are have an issue with and Tahmid and most if not all bloggers on this forum will try to assist you.

      If you don't know where to start I will suggest to download the underlisted application notes. I found them usefull when I was starting out on inverter and power designs.
      1. AN2794: 1KW dual stage DC-AC converter based on STP160N75F3
      2. AN3905
      3. AN1279: offline UPS Reference design using the dsPIC DSC


      Sorry, I don't have the links right now but if you search using google you should be able to get them easily. Also, I will try to post them when I get the links

      Regards

      Delete
  66. Hi Tahmid,

    I built a push-pull sine wave inverter circuit using Atmega8 with SPWM frequency of 16KHz. I used a 100 W rated transformer with a 7.2 - 0 - 7.2 V primary and secondary of 250V. when I switched the circuit on, I get a voltage of 350VAC at the secondary with a no-load current of 3 Amps. Is this normal? I have used a 1uf 440V capacitor at the secondary. I checked the driver and the SPWM sinewave...everything seems to be alright. I'm using MOSFET IRF3205. where does the problem lie? why am I not getting 250-260V at my output?

    ReplyDelete
  67. please thamid i need a sine wave inverter circuit diagram using any of the pic 16 series with the source code.send to my email:chidimabs2016@gmail.com

    ReplyDelete
  68. what was your transformer turns ratio?
    is there any formula to calculate it based on the output power i want?

    ReplyDelete
  69. Tamid I've got an issue with the MOSFETs being damaged after charging, I pulse the two lower sides with equal duty cycles and sometimes when the inverter switches back to back up mode the MOSFETs get damaged, an advice please inbox me at jjchinosoviolet@gmail.com

    ReplyDelete
  70. TAHMID,I want to make a full bridge pwm speed control for an inductive single phase 230 v ac 50hz motor.I make it using one ne 555 one 4017 two ir2110 four irf450 and a bridge 300 vdc. When the ct is 1μf the r1 100k pot and r2 1k the f=13698 when the pot is 10k f=100hz.the motor run well for full but no good for slow.Also i want to make this without ne 555 and 4017,using sg3525.Please help me to understand what is the correct f for the pwm for any motor.

    ReplyDelete
  71. my mail is pnikas2016@gmai.com

    ReplyDelete
  72. Thank you Tahmid for your exposition, i built the inverter using pic16f684 and it worked perfectly. but i want it to charge my battery when mains is available. please help me with the c code that will charge my battery. i am using 12v battery.

    ReplyDelete
  73. Thank you Tahmid for your exposition, i built the inverter using pic16f684 and it worked perfectly. but i want it to charge my battery when mains is available. please help me with the c code that will charge my battery. i am using 12v battery.

    ReplyDelete
  74. hi tahmid I have built the project using pic 16f684 and all worked well after I filtered with a capacitor, I am not not using a full bridge , I used just two tlp 250 to drive the signals from pin 6 and 8 from the pic and I used a 9-0-9v transformer and got a 230v after filtwring with a capacitor,my problem is that the output voltage reduces rapidly as load increases , I implemented the feedback code as explained, I used rectifier and voltage divider to feed 5v into RA0 of pic but didn't wrk, pls what can I do please

    ReplyDelete
  75. Tahmid thank u so much jazakumullahu khair

    1. I made the circuit and i get a pure sine wave. I observed that at output of 16f684 at pin 6 and 8 i get 1.2 voit at 7khz on each pin respectively of spam signal

    2. Then i feed the two output at dual low side MOSFET driver ir2110 to the MOSFET gate

    3. On no load i get 220vac at the output both when i connected a load of 50 watt. The output drop down to 70vac

    4. Please help me to correct this problem. Thanks alot.

    ReplyDelete
  76. Hello Mr tahmid mahbub, been trying to reach out to you, but no good luck, pls I have huge voltage drop on 60watts load using your code, pls how do I go about this, thanks

    ReplyDelete
  77. Please I need help creating a Single phase 50hz spwm with CMPWM module of dspic33fjmc microcontroller

    ReplyDelete