SINE WAVE INVERTER USING ARDUINO

Hardware prototype

CIRCUIT DIAGRAM



WAVE FORMS AT GATE OF MOSFET










 wave forms at upper(blue) and lower(yellow) switches

WAVE FORMS AT OUTPUT CFL BULB LOAD  AT 150Hz 


PROGRAM  (FREQUENCY -150Hz)
void setup()
{              
  pinMode(7, OUTPUT);  pinMode(8, OUTPUT);    
}
void loop()
{

digitalWrite(7, HIGH);
delayMicroseconds(5);
  digitalWrite(7, LOW);
delayMicroseconds(95);

digitalWrite(7, HIGH);
delayMicroseconds(10);
  digitalWrite(7, LOW);
delayMicroseconds(90);

digitalWrite(7, HIGH);
delayMicroseconds(15);
  digitalWrite(7, LOW);
delayMicroseconds(85);

digitalWrite(7, HIGH);
delayMicroseconds(20);
  digitalWrite(7, LOW);
delayMicroseconds(80);

digitalWrite(7, HIGH);
delayMicroseconds(25);
  digitalWrite(7, LOW);
delayMicroseconds(75);

digitalWrite(7, HIGH);
delayMicroseconds(30);
  digitalWrite(7, LOW);
delayMicroseconds(70);

digitalWrite(7, HIGH);
delayMicroseconds(35);
  digitalWrite(7, LOW);
delayMicroseconds(65);

digitalWrite(7, HIGH);
delayMicroseconds(40);
  digitalWrite(7, LOW);
delayMicroseconds(60);

digitalWrite(7, HIGH);
delayMicroseconds(45);
  digitalWrite(7, LOW);
delayMicroseconds(55);

digitalWrite(7, HIGH);
delayMicroseconds(50);
  digitalWrite(7, LOW);
delayMicroseconds(50);
               
digitalWrite(7, HIGH);
delayMicroseconds(55);
  digitalWrite(7, LOW);
delayMicroseconds(45);

digitalWrite(7, HIGH);
delayMicroseconds(65);
  digitalWrite(7, LOW);
delayMicroseconds(35);

digitalWrite(7, HIGH);
delayMicroseconds(75);
  digitalWrite(7, LOW);
delayMicroseconds(25);

digitalWrite(7, HIGH);
delayMicroseconds(85);
  digitalWrite(7, LOW);
delayMicroseconds(15);

digitalWrite(7, HIGH);
delayMicroseconds(90);
digitalWrite(7, LOW);
delayMicroseconds(10);

digitalWrite(7, HIGH);
delayMicroseconds(95);
  digitalWrite(7, LOW);
delayMicroseconds(5);

digitalWrite(7, HIGH);
delayMicroseconds(90);
  digitalWrite(7, LOW);
delayMicroseconds(10);

digitalWrite(7, HIGH);
delayMicroseconds(85);
  digitalWrite(7, LOW);
delayMicroseconds(15);

digitalWrite(7, HIGH);
delayMicroseconds(75);
  digitalWrite(7, LOW);
delayMicroseconds(25);


digitalWrite(7, HIGH);
delayMicroseconds(65);
  digitalWrite(7, LOW);
delayMicroseconds(35);


digitalWrite(7, HIGH);
delayMicroseconds(55);
  digitalWrite(7, LOW);
delayMicroseconds(45);

digitalWrite(7, HIGH);
delayMicroseconds(50);
  digitalWrite(7, LOW);
delayMicroseconds(50);

digitalWrite(7, HIGH);
delayMicroseconds(45);
  digitalWrite(7, LOW);
delayMicroseconds(55);
digitalWrite(7, HIGH);
delayMicroseconds(40);
  digitalWrite(7, LOW);
delayMicroseconds(60);

digitalWrite(7, HIGH);
delayMicroseconds(35);
  digitalWrite(7, LOW);
delayMicroseconds(65);

digitalWrite(7, HIGH);
delayMicroseconds(30);
  digitalWrite(7, LOW);
delayMicroseconds(70);

digitalWrite(7, HIGH);
delayMicroseconds(25);
  digitalWrite(7, LOW);
delayMicroseconds(75);
digitalWrite(7, HIGH);
delayMicroseconds(20);
  digitalWrite(7, LOW);
delayMicroseconds(80);
digitalWrite(7, HIGH);
delayMicroseconds(15);
  digitalWrite(7, LOW);
delayMicroseconds(85);
digitalWrite(7, HIGH);
delayMicroseconds(10);
  digitalWrite(7, LOW);
delayMicroseconds(90);
digitalWrite(7, HIGH);
delayMicroseconds(5);
  digitalWrite(7, LOW);
delayMicroseconds(5);


digitalWrite(8, HIGH); //22
delayMicroseconds(5);
  digitalWrite(8, LOW);
delayMicroseconds(95);
digitalWrite(8, HIGH);
delayMicroseconds(10);
  digitalWrite(8, LOW);
delayMicroseconds(90);
digitalWrite(8, HIGH);
delayMicroseconds(15);
  digitalWrite(8, LOW);
delayMicroseconds(85);
digitalWrite(8, HIGH);
delayMicroseconds(20);
  digitalWrite(8, LOW);
delayMicroseconds(80);
digitalWrite(8, HIGH);
delayMicroseconds(25);
  digitalWrite(8, LOW);
delayMicroseconds(75);

digitalWrite(8, HIGH);
delayMicroseconds(30);
  digitalWrite(8, LOW);
delayMicroseconds(70);

digitalWrite(8, HIGH);
delayMicroseconds(35);
  digitalWrite(8, LOW);
delayMicroseconds(65);
digitalWrite(8, HIGH);
delayMicroseconds(40);
  digitalWrite(8, LOW);
delayMicroseconds(60);
digitalWrite(8, HIGH);
delayMicroseconds(45);
  digitalWrite(8, LOW);
delayMicroseconds(55);

digitalWrite(8, HIGH);
delayMicroseconds(50);
  digitalWrite(8, LOW);
delayMicroseconds(50);

digitalWrite(8, HIGH);
delayMicroseconds(55);
  digitalWrite(8, LOW);
delayMicroseconds(45);

digitalWrite(8, HIGH);
delayMicroseconds(65);
  digitalWrite(8, LOW);
delayMicroseconds(35);

digitalWrite(8, HIGH);
delayMicroseconds(75);
  digitalWrite(8, LOW);
delayMicroseconds(25);


digitalWrite(8, HIGH);
delayMicroseconds(85);
  digitalWrite(8, LOW);
delayMicroseconds(15);

digitalWrite(8, HIGH);
delayMicroseconds(90);
  digitalWrite(8, LOW);
delayMicroseconds(10);

digitalWrite(8, HIGH);
delayMicroseconds(95);
  digitalWrite(8, LOW);
delayMicroseconds(5);

digitalWrite(8, HIGH);
delayMicroseconds(90);
  digitalWrite(8, LOW);
delayMicroseconds(10);

digitalWrite(8, HIGH);
delayMicroseconds(85);
  digitalWrite(8, LOW);
delayMicroseconds(15 );

digitalWrite(8, HIGH);
delayMicroseconds(75);
  digitalWrite(8, LOW);
delayMicroseconds(25);


digitalWrite(8, HIGH);
delayMicroseconds(65);
  digitalWrite(8, LOW);
delayMicroseconds(35);


digitalWrite(8, HIGH);
delayMicroseconds(55);
  digitalWrite(8, LOW);
delayMicroseconds(45);

digitalWrite(8, HIGH);
delayMicroseconds(50);
  digitalWrite(8, LOW);
delayMicroseconds(50);

digitalWrite(8, HIGH);
delayMicroseconds(45);
  digitalWrite(8, LOW);
delayMicroseconds(55);
digitalWrite(8, HIGH);
delayMicroseconds(40);
  digitalWrite(8, LOW);
delayMicroseconds(60);
digitalWrite(8, HIGH);
delayMicroseconds(35);
  digitalWrite(8, LOW);
delayMicroseconds(65);
digitalWrite(8, HIGH);
delayMicroseconds(30);
  digitalWrite(8, LOW);
delayMicroseconds(70);

digitalWrite(8, HIGH);
delayMicroseconds(25);
  digitalWrite(8, LOW);
delayMicroseconds(75);
digitalWrite(8, HIGH);
delayMicroseconds(20);
  digitalWrite(8, LOW);
delayMicroseconds(80);
digitalWrite(8, HIGH);
delayMicroseconds(15);
  digitalWrite(8, LOW);
delayMicroseconds(85);
digitalWrite(8, HIGH);
delayMicroseconds(10);
  digitalWrite(8, LOW);
delayMicroseconds(90);
digitalWrite(8, HIGH);
delayMicroseconds(5);
  digitalWrite(8, LOW);
delayMicroseconds(5);
}
PROGRAM FOR 50Hz
void setup()
{              
  pinMode(7, OUTPUT);  pinMode(8, OUTPUT);    
}
void loop()
{
digitalWrite(7, HIGH);
delayMicroseconds(15);
  digitalWrite(7, LOW);
delayMicroseconds(285);

digitalWrite(7, HIGH);
delayMicroseconds(30);
  digitalWrite(7, LOW);
delayMicroseconds(270);

digitalWrite(7, HIGH);
delayMicroseconds(45);
  digitalWrite(7, LOW);
delayMicroseconds(255);

digitalWrite(7, HIGH);
delayMicroseconds(60);
  digitalWrite(7, LOW);
delayMicroseconds(240);

digitalWrite(7, HIGH);
delayMicroseconds(75);
  digitalWrite(7, LOW);
delayMicroseconds(225);

digitalWrite(7, HIGH);
delayMicroseconds(90);
  digitalWrite(7, LOW);
delayMicroseconds(210);

digitalWrite(7, HIGH);
delayMicroseconds(105);
  digitalWrite(7, LOW);
delayMicroseconds(195);

digitalWrite(7, HIGH);
delayMicroseconds(120);
  digitalWrite(7, LOW);
delayMicroseconds(180);

digitalWrite(7, HIGH);
delayMicroseconds(135);
  digitalWrite(7, LOW);
delayMicroseconds(165);

digitalWrite(7, HIGH);
delayMicroseconds(150);
  digitalWrite(7, LOW);
delayMicroseconds(150);
               
digitalWrite(7, HIGH);
delayMicroseconds(165);
  digitalWrite(7, LOW);
delayMicroseconds(135);

digitalWrite(7, HIGH);
delayMicroseconds(195);
  digitalWrite(7, LOW);
delayMicroseconds(105);

digitalWrite(7, HIGH);
delayMicroseconds(225);
  digitalWrite(7, LOW);
delayMicroseconds(75);

digitalWrite(7, HIGH);
delayMicroseconds(255);
  digitalWrite(7, LOW);
delayMicroseconds(45);

digitalWrite(7, HIGH);
delayMicroseconds(270);
digitalWrite(7, LOW);
delayMicroseconds(30);

digitalWrite(7, HIGH);
delayMicroseconds(285);
  digitalWrite(7, LOW);
delayMicroseconds(15);

digitalWrite(7, HIGH);
delayMicroseconds(270);
  digitalWrite(7, LOW);
delayMicroseconds(30);

digitalWrite(7, HIGH);
delayMicroseconds(255);
  digitalWrite(7, LOW);
delayMicroseconds(45);

digitalWrite(7, HIGH);
delayMicroseconds(225);
  digitalWrite(7, LOW);
delayMicroseconds(75);


digitalWrite(7, HIGH);
delayMicroseconds(195);
  digitalWrite(7, LOW);
delayMicroseconds(105);


digitalWrite(7, HIGH);
delayMicroseconds(165);
  digitalWrite(7, LOW);
delayMicroseconds(135);

digitalWrite(7, HIGH);
delayMicroseconds(150);
  digitalWrite(7, LOW);
delayMicroseconds(150);

digitalWrite(7, HIGH);
delayMicroseconds(135);
  digitalWrite(7, LOW);
delayMicroseconds(165);
digitalWrite(7, HIGH);
delayMicroseconds(120);
  digitalWrite(7, LOW);
delayMicroseconds(180);

digitalWrite(7, HIGH);
delayMicroseconds(105);
  digitalWrite(7, LOW);
delayMicroseconds(195);

digitalWrite(7, HIGH);
delayMicroseconds(90);
  digitalWrite(7, LOW);
delayMicroseconds(210);

digitalWrite(7, HIGH);
delayMicroseconds(75);
  digitalWrite(7, LOW);
delayMicroseconds(225);
digitalWrite(7, HIGH);
delayMicroseconds(60);
  digitalWrite(7, LOW);
delayMicroseconds(240);
digitalWrite(7, HIGH);
delayMicroseconds(45);
  digitalWrite(7, LOW);
delayMicroseconds(255);
digitalWrite(7, HIGH);
delayMicroseconds(30);
  digitalWrite(7, LOW);
delayMicroseconds(270);
digitalWrite(7, HIGH);
delayMicroseconds(15);
  digitalWrite(7, LOW);
delayMicroseconds(285);


digitalWrite(8, HIGH); //22
delayMicroseconds(15);
  digitalWrite(8, LOW);
delayMicroseconds(285);
digitalWrite(8, HIGH);
delayMicroseconds(30);
  digitalWrite(8, LOW);
delayMicroseconds(270);
digitalWrite(8, HIGH);
delayMicroseconds(45);
  digitalWrite(8, LOW);
delayMicroseconds(255);
digitalWrite(8, HIGH);
delayMicroseconds(60);
  digitalWrite(8, LOW);
delayMicroseconds(240);
digitalWrite(8, HIGH);
delayMicroseconds(75);
  digitalWrite(8, LOW);
delayMicroseconds(225);

digitalWrite(8, HIGH);
delayMicroseconds(90);
  digitalWrite(8, LOW);
delayMicroseconds(210);

digitalWrite(8, HIGH);
delayMicroseconds(105);
  digitalWrite(8, LOW);
delayMicroseconds(195);
digitalWrite(8, HIGH);
delayMicroseconds(120);
  digitalWrite(8, LOW);
delayMicroseconds(180);
digitalWrite(8, HIGH);
delayMicroseconds(135);
  digitalWrite(8, LOW);
delayMicroseconds(165);

digitalWrite(8, HIGH);
delayMicroseconds(150);
  digitalWrite(8, LOW);
delayMicroseconds(150);

digitalWrite(8, HIGH);
delayMicroseconds(165);
  digitalWrite(8, LOW);
delayMicroseconds(135);

digitalWrite(8, HIGH);
delayMicroseconds(195);
  digitalWrite(8, LOW);
delayMicroseconds(105);

digitalWrite(8, HIGH);
delayMicroseconds(225);
  digitalWrite(8, LOW);
delayMicroseconds(75);


digitalWrite(8, HIGH);
delayMicroseconds(255);
  digitalWrite(8, LOW);
delayMicroseconds(45);

digitalWrite(8, HIGH);
delayMicroseconds(270);
  digitalWrite(8, LOW);
delayMicroseconds(30);

digitalWrite(8, HIGH);
delayMicroseconds(285);
  digitalWrite(8, LOW);
delayMicroseconds(15);

digitalWrite(8, HIGH);
delayMicroseconds(270);
  digitalWrite(8, LOW);
delayMicroseconds(30);

digitalWrite(8, HIGH);
delayMicroseconds(255);
  digitalWrite(8, LOW);
delayMicroseconds(45 );

digitalWrite(8, HIGH);
delayMicroseconds(225);
  digitalWrite(8, LOW);
delayMicroseconds(75);


digitalWrite(8, HIGH);
delayMicroseconds(195);
  digitalWrite(8, LOW);
delayMicroseconds(105);


digitalWrite(8, HIGH);
delayMicroseconds(165);
  digitalWrite(8, LOW);
delayMicroseconds(135);

digitalWrite(8, HIGH);
delayMicroseconds(150);
  digitalWrite(8, LOW);
delayMicroseconds(150);

digitalWrite(8, HIGH);
delayMicroseconds(135);
  digitalWrite(8, LOW);
delayMicroseconds(165);
digitalWrite(8, HIGH);
delayMicroseconds(120);
  digitalWrite(8, LOW);
delayMicroseconds(180);
digitalWrite(8, HIGH);
delayMicroseconds(105);
  digitalWrite(8, LOW);
delayMicroseconds(195);
digitalWrite(8, HIGH);
delayMicroseconds(90);
  digitalWrite(8, LOW);
delayMicroseconds(210);

digitalWrite(8, HIGH);
delayMicroseconds(75);
  digitalWrite(8, LOW);
delayMicroseconds(225);
digitalWrite(8, HIGH);
delayMicroseconds(60);
  digitalWrite(8, LOW);
delayMicroseconds(240);
digitalWrite(8, HIGH);
delayMicroseconds(45);
  digitalWrite(8, LOW);
delayMicroseconds(255);
digitalWrite(8, HIGH);
delayMicroseconds(30);
  digitalWrite(8, LOW);
delayMicroseconds(270);
digitalWrite(8, HIGH);
delayMicroseconds(15);
  digitalWrite(8, LOW);
delayMicroseconds(285);
}