Sunday, November 4, 2018

How to convert a square modified wave inverter to pure sine wave

In this project i conver a modified sine wave of an inverter to pure wave using microcontroller (Arduino) and low pass filter(LPF). Watch this video here.

Parts list:
Arduino
Inductor 900mH(2pcs)
Capacitor 2 to 3uF 400V
Capacitor 0.8uF(800nF) 400V
Capacitor 1000uF 16V
Transformer 220v to 6v
Potentiometer 100K
Resistor 750R
 


How to convert a square modified wave inverter to pure sine wave

How to convert a square modified wave inverter to pure sine wave

How to convert a square modified wave inverter to pure sine wave
How to convert a square modified wave inverter to pure sine wave

Video:



Code:

void setup() {
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
}

void loop(){

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(1500);
 
  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(75);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(50);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(150);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(125);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(200);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(150);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(300);
  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(250);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(400);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(300);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(650);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(550);

 {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(900);

   {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(750);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(650);
  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(600);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(400);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(300);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(300);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(250);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(200);
  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(175);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(150);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(125);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  }
  delayMicroseconds(75);

  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(50);



///////////////////
 
  {
  digitalWrite(3, HIGH);
  digitalWrite(4, HIGH);
  }
  delayMicroseconds(1500);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(75);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(50);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(150);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(125);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(200);

 {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(175);

   {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(300);


 {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(250);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(400);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(300);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(650);

 {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(550);

   {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(900);


{
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(750);

   {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(700);


{
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(550);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(400);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(300);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(300);

 {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(250);

   {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(200);


 {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(175);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(150);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(125);

  {
  digitalWrite(4, HIGH);
  digitalWrite(3, LOW);
  }
  delayMicroseconds(75);

 {
  digitalWrite(4, HIGH);
  digitalWrite(3, HIGH);
  }
  delayMicroseconds(50);

 }