Pure sine wave inverter

Pure sine wave inverter using dspic33fj16gs504

Hello friends, I want to share with you my latest inverter project made with microchip DSPIC33FJ16GS504. I started this project in 2020 after many years of testing, correcting, updating and customers feedback implementations, I can now say I have a commercially quality and reliable inverter system that I want to share with all who have been looking for quality self-made inverter systems.

MCU CIRCUIT DIAGRAMS

KNOW THAT:

  •  I use this inverter system for my commercial production in Ghana, under the brand name “Hipower Inverters”
  • This is not for students, therefore no student should contact me on the base of school project.
  • This is a professional project and not for novice or people with no electronic background.

FUNCTIONS:

1. The core function of the project is to generate pure sine wave from DC source using sinewave pulse width modulation (SPWM) Technology.

2. Grid charging using bridgeless boost PFC principle.

BATTERY SYSTEM

The system can be used for 12V, 24V and 48V systems using the same control board.

If you desire to use a higher voltage system, then some modifications will have to be made to handle that higher DC voltage input.

I will provide you with all the needed support and assistance in any form (circuit and source code modification)

NB:

The battery voltage can be adjusted from settings.

INVERTER OUTPUT

The inverter can be set to produce an output voltage of 200V-240V AC.

For 110V systems, the inverter output can be set from 100V-120V AC. The output frequency is 50Hz for 220V system and 60Hz for 110V system.

Inverter output voltage can be selected from setting using the key buttons.

BATTERY CHARGING

The inverter has grid charging function built into it. It uses the principle of bridgeless boost PFC for charging.

It follows three stages charging algorithm:

  • Constant current with variable voltage(Bulk Stage)
  • Constant voltage with variable current (Absorb Stage)
  • Float charging

The charging current or maximum charging current can be selected from settings using the key buttons. The system can be set to charge from 10A to 40A using grid input power.

Power supply

12V versions do not need SMPS power supply assembling when you are using original TLP250 for mosfet driving. 

Other higher voltage systems will require the assembling of the on board buck converter circuit.  

Mosfet drive circuit

PROTECTIONS

  • Overload protections
  • Mosfet saturation protection
  • Over DC voltage input protection
  • Over AC input voltage protection
  • Under AC input voltage protection
  • Over charging protection
  • Over temperature protection
  • EMF/lighting protection
  • Inverter output over voltage protection
  • Short circuit protection
  • Transformer open loop protection
  • Fan failure detection
  • NTC failure detection

PROJECT COST

1. Buy source code and all PCB design files at $1,400 USD

  • The source code is readable
  • The source code is editable
  • The source code contains the hex file
  • The source code is written in C, using C30 compiler
  • The IDE is mplab x version 6 or higher
  • It can be modified for any battery system
  • it can be used for 500Va to 12000Va

2. Buy hex file and PCB design files at $ 800 USD

  • Hex code will be for 12V,24V and 48V battery system
  • It can be used for 1000W to 8000W
  • It’s not readable
  • It’s not editable
  • Can only be used to program the micro controller
  • All functions can be accessed by using the key buttons to go to system settings

3. FREE VERSION

I want to give away a free version of this project for test purposes. The hardware remains the same for the full version.

Limitation of the free version

  • The system will shutdown every 15 minutes
  • Some functions may be disabled in free version
  • Only free version of hex file is provided
  • Only PCB Gerber file, assembling file and circuit diagram is provided

Download free version files by clicking on this

dspic33fj16gs504 inverter free version download

DISPLAY SYSTEM

The inverter can be programmed to use 1602 (16×2) LCD or 1604 (16 x 4) LCD display as in the picture below.

TEST VIDEO

Watch the test video of this project on YouTube by clicking on this link

sample code

 switch (systemState)

        {

        case SYSTEM_STARTUP:

          {

              switch(starting)

              {

                case 1:

                {  

                    display_state = SYSTEM_STARTUP;

                     fan2_on

                     mainsState     = MAINS_NOT_OK;        

                    float_led_on

                    mainsled_on

                    chrging_on

                    invled_on

                    fault_led_on

                    overload_on       

                 grid_stop=1;

                }

                break;

                case 2:

                {

                  display_state = INVERTER_MODE;

                   regular_checks ();

                   mainsState  = MAINS_NOT_OK;

                    // fan2_off

                    float_led_off

                    mainsled_off

                    chrging_off 

                    invled_off

                    fault_led_off

                    overload_off        

                }

                  break;

                case 3:

                  {    

                     first_on=1; 

                     ups_mode=0;

                     initPWM();  

                     systemState=STANDBY_MODE;

                  }

               break;

                default: starting=3;

                  }

              }

          break;

        case STANDBY_MODE:

          {

            display_state = INVERTER_MODE;

             regular_checks ();

             recovery();

       if((mainsState==MAINS_NOT_OK))

       {

           if (switchstate == INVSWITCH)

                 { 

                     if(change_ovr==1)

                       {  

                        change_ovr0

                        surge_relay=0;

                        }

                 switch_overdly++;

              if(switch_overdly>=relay_transfer_time)//=150;relay_time)

                 {        

                    if(first_on==1)

                      {    

                       vcorrect = 0;

                       inverter_init (); /////////3

                        switch_overdly=0;

                       }

                    else if(ups_mode==1)  

                       {

                            priority_delay=0;   

                            vcorrect = 1;  

                            if(switch_overdly>=(relay_transfer_time+5))

                              {

                                p=60;

                              inverter_init (); /////////3

                              loaddisp=0;

                            switch_overdly=0;

                            }

                       }

                     }

               }

                     }

              if(mainsState == MAINS_OK)

                    {    

                        switch_overdly=0;

                        first_on=0;

                        ups_mode=1;

                        if(allow_grid_chrge==1)

                          {

                             systemState=GRID_CHARGER_MODE;

                          }

                    }

          }

          break;

        case GRID_CHARGER_MODE:

          {

           display_state = GRID_CHARGER_MODE;

                    regular_checks ();

                    mainsled_on

                    invled_off

                    if ((acin < ac_inp_minimum) || (acin > ac_inp_maximum))

                      {

                        ups_mode=1;

                        mainsState=MAINS_NOT_OK;

                        systemState=STANDBY_MODE;

                        relay_transfer_time=relay_off_time;//1

                      }  

                if(mains_absent_count >=zero_cross_count)///1

                  {

                     ups_mode=1;

                     mainsState=MAINS_NOT_OK;

                     systemState=STANDBY_MODE;

                     relay_transfer_time=relay_time;  

                 }

                else

                  {

                         if((allow_grid_chrge==1) &&(change_ovr==1))

                            {

                             fault_led_off   

                                  if(charger_initialised==0)

                                    {

                                       charging_start++;

                                        if(charging_start==15000)

                                          {

                                            charger_on();

                                            charging_start=0;

                                          }

                                    }

                              if(charger_initialised==1)

                                {

                                  charging_current=(ct_mv*(chrclb));

                                  if(charging_current<=0)

                                      charging_current=0;

                                    charging_speed++;

                                    if(charging_speed==100)

                                      {           

                                         charging_system();

                                         charging_speed=0;

                                      }

                                }

                      }

                  }

             }

          break;

        case INVERTER_MODE:

          {

            display_state = INVERTER_MODE;

            float_led_off

             overload_handling();       

            if (mainsState == MAINS_NOT_OK)

              {  

                    if(first_on==1)

                      {

                        feedback_detect++;

                        if ((feedback_detect >600)&&(acout < 50))

                          {

                            feedback_detect = 0;

                            systemState = SYSTEM_ERROR;

                             errorState = NO_FEEDBACK;   

                          } 

                    }

                if (vcorrect == 1)

                  {

                    invled_on

                    regular_checks ();

                  }

                 if(acin>ac_inp_minimum)

                 {

                    if((switchstate==1))//&&(grid_stop==1))

                      {

                       inverter_init ();/////check

                      }

                 }

              }

            if(flags.onflag == 1)

              {   

                 power_out=(((output_current*(acout/10))/loadclb)*10);

                 loaddisp=((power_out/100));

                  if(power_out<30) 

                    {

                   power_out=0;

                    loaddisp=0;

                   }

              }

            else

              loaddisp=power_out=0;

              }

          break;

        case SYSTEM_ERROR:

          {

            display_state = SYSTEM_ERROR;

            change_ovr0;

            PTCONbits.PTEN = 0;

            IOCON1bits.OVRDAT = 0x00;

            IOCON2bits.OVRDAT = 0x00; 

            IOCON1bits.OVRENH = 1;

            IOCON1bits.OVRENL = 1;

            IOCON2bits.OVRENH = 1;

            IOCON2bits.OVRENL = 1;

            PTCONbits.PTEN = 1;

            if(temperature<grid_fan_run)

            fan2_off     

            recovery();

          }

          break;

          default: systemState= INVERTER_MODE; 

        }

      togdly++;

    }

  if (grid_charging == float_charging_active)

    {

      if (togdly > 9900)

        {

          togdly = 0;

          batt_floatdly++;

        }

    }

  else

    batt_floatdly = 0;

  screen_light();

  press_switch ();

  fan_report ();

  shift_data ();

  pv_priority ();

  IGBT_protection();

  fault_trigger();

      if(solar_priority==1)

        {

        bulk_charge= grid_to_batt;

        }

      else

       bulk_charge=setbatful;

           charge_protect =   ( acin-ac_input_norminal);

           if(charge_protect<0)

              charge_protect=0;

              if(charge_protect>0)

                {

                   if(safe_charge_current>(max_charging_current/2))

                    safe_charge_current=(max_charging_current-(charge_protect*10));

                   else

                     safe_charge_current=(max_charging_current/2);

                }

              else

                {

                   safe_charge_current=max_charging_current;

                }

   if (INV_SW == 1)

  {

     switched=1;

     switchstate = INVSWITCH;

    if(priority_delay==1)

      relay_transfer_time=250;

    else

       priority_delay=0;   

    if(quit==1)

     {

      buz0;

       soft_off_dly=0;

       quit=0;

     }

   }

if(INV_SW==0)

{  

    switchstate = SYSTEM_OFF; 

   if (flags.onflag == 1) 

     {

       if((solar_priority==1)&&(acin>0))

         {

           grid_stop=0;

           mainsState=mains_Synchronising;

           priority_delay=1;

          }

       else

         {

        priority_delay=0;   

        zcd_count++;

       quit=1;

    if(zcd_count>40)

       { 

        zcd_count=0;   

        soft_off_dly++;

        if(soft_off_dly==5)

          {

            amplitude-=5; 

            soft_off_dly=0;

           }

            buz1;

            if(acout<= (ac_inp_minimum+10))

              { 

                invoff();

                buz0;

              }

       }

       }

       }

}

  IFS0bits.T2IF = 0; /* Clear Interrupt Flag */

}   

Leave a Comment

Scroll to Top