July 30, 2025

Arduino 3-phase Inverter 12V to 380V

This is a simple 3-phase Inverter using Arduino to convert 12V DC into 380V AC.

It has 3 push button: 

1-Forward 

2-Reverse

3-Stop (turn OFF) 

Forward and Reverse buttons used when the load is motor by swapping two phases. 

Output waveform is square wave and maximum power depends on the size of the transformers and MOSFETs.

 

Arduino 3-phase Inverter 12V to 380V

Parts list:

Arduino (UNO or MEGA) 

IC 7805  

LCD Display 16x2 with I2C 

Transformer center taped 9V-0-9V / 220V (3pcs)

MOSFET IRFZ44n (6pcs)

Optocoupler PC817 (6pcs)

Resistor 91K 

Resistor 10K (7pcs)

Resistor 300 ohm (6pcs)

Resistor 1K (6pcs) 

Capacitor 1000uF 16v (2pcs) 

Capacitor 100nF (2pcs) 

Heatsink for MOSFETs (6pcs)

12V Battery 

Battery connecting cable 

 

Circuit:

If you want to use Arduino UNO instead of Arduino MEGA, you have to connect the pin A4 of the Arduino UNO to SDA of the LCD and pin A5 of the Arduino UNO to SCL of the LCD, Rest of the wiring and even the code remains the same!

Arduino 3-phase Inverter 12V to 380V

Video:

 


Code:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <TimerOne.h>

// LCD
LiquidCrystal_I2C lcd(0x27, 16, 2);  // Adjust I2C address if needed

// Phase pins
const int phaseA = 2;
const int phaseB = 3;
const int phaseC = 4;
const int phaseA_inv = 5;
const int phaseB_inv = 6;
const int phaseC_inv = 7;

// Buttons (Active HIGH)
const int btnForward = 8;
const int btnReverse = 9;
const int btnStop = 10;

// Battery sensing
const int battPin = A0;
const float battDividerRatio = 10;
const float lowCutOff = 10.5;
const float restoreVoltage = 11.0;

// State variables
volatile bool inverterOn = false;
volatile bool reverseMode = false;

// Debounce tracking
bool lastForwardState = LOW;
bool lastReverseState = LOW;
bool lastStopState = LOW;
unsigned long lastDebounceForward = 0;
unsigned long lastDebounceReverse = 0;
unsigned long lastDebounceStop = 0;
const unsigned long debounceDelay = 200;

// Phase control
volatile int phaseStep = 0;

// Correct symmetrical 6-step sequence
bool seqForward[6][3] = {
  {1,0,0},  // Step 1
  {1,1,0},  // Step 2
  {0,1,0},  // Step 3
  {0,1,1},  // Step 4
  {0,0,1},  // Step 5
  {1,0,1}   // Step 6
};

void setup() {
  lcd.init();
  lcd.backlight();

  pinMode(phaseA, OUTPUT);
  pinMode(phaseB, OUTPUT);
  pinMode(phaseC, OUTPUT);
  pinMode(phaseA_inv, OUTPUT);
  pinMode(phaseB_inv, OUTPUT);
  pinMode(phaseC_inv, OUTPUT);

  pinMode(btnForward, INPUT);  // Active HIGH (use pull-down resistors)
  pinMode(btnReverse, INPUT);
  pinMode(btnStop, INPUT);

  lcd.setCursor(0, 0);
  lcd.print("System Init...");
  delay(1000);
  lcd.clear();

  // Timer1 for 50Hz
  Timer1.initialize(3333); // 300Hz steps = 50Hz fundamental
  Timer1.attachInterrupt(stepPhases);
}

void loop() {
  float battVoltage = readBatteryVoltage();

  // Display battery voltage
  lcd.setCursor(0, 0);
  lcd.print("Battery:");
  lcd.print(battVoltage, 2);
  lcd.print(" V   ");

  // Low battery cutoff
  if (battVoltage < lowCutOff) {
    inverterOn = false;
  }

  // --- Forward Button ---
  bool currentForward = digitalRead(btnForward);
  if (currentForward == HIGH && lastForwardState == LOW && (millis() - lastDebounceForward > debounceDelay)) {
    inverterOn = true;
    reverseMode = false;
    lastDebounceForward = millis();
  }
  lastForwardState = currentForward;

  // --- Reverse Button ---
  bool currentReverse = digitalRead(btnReverse);
  if (currentReverse == HIGH && lastReverseState == LOW && (millis() - lastDebounceReverse > debounceDelay)) {
    inverterOn = true;
    reverseMode = true;
    lastDebounceReverse = millis();
  }
  lastReverseState = currentReverse;

  // --- Stop Button ---
  bool currentStop = digitalRead(btnStop);
  if (currentStop == HIGH && lastStopState == LOW && (millis() - lastDebounceStop > debounceDelay)) {
    inverterOn = false;
    lastDebounceStop = millis();
  }
  lastStopState = currentStop;

  // Status display
  lcd.setCursor(0, 1);
  if (battVoltage < lowCutOff) {
    lcd.print("Battery is LOW ");
  } else {
    if (!inverterOn) {
      lcd.print("Motor Stopped  ");
    } else {
      if (reverseMode) lcd.print("Reverse         ");
      else lcd.print("Forward         ");
    }
  }
}

// Averaged battery voltage reading
float readBatteryVoltage() {
  long sum = 0;
  for (int i = 0; i < 10; i++) {
    sum += analogRead(battPin);
    delay(2); // small delay between readings
  }
  float adcValue = sum / 10.0;
  return (adcValue * 5.0 / 1023.0) * battDividerRatio;
}

// Timer1 ISR for phases
void stepPhases() {
  if (!inverterOn) {
    // All outputs off
    digitalWrite(phaseA, LOW);
    digitalWrite(phaseB, LOW);
    digitalWrite(phaseC, LOW);
    digitalWrite(phaseA_inv, LOW);
    digitalWrite(phaseB_inv, LOW);
    digitalWrite(phaseC_inv, LOW);
    return;
  }

  bool A = seqForward[phaseStep][0];
  bool B = seqForward[phaseStep][1];
  bool C = seqForward[phaseStep][2];

  digitalWrite(phaseA, A);
  digitalWrite(phaseB, B);
  digitalWrite(phaseC, C);
  digitalWrite(phaseA_inv, !A);
  digitalWrite(phaseB_inv, !B);
  digitalWrite(phaseC_inv, !C);

  if (reverseMode) {
    phaseStep--;
    if (phaseStep < 0) phaseStep = 5;
  } else {
    phaseStep++;
    if (phaseStep > 5) phaseStep = 0;
  }
}


 

July 27, 2025

Arduino inverter 12V to 220V with LCD Display

This is a simple inverter to convert 12V DC to 220V AC with LCD Display to show the battery voltage. 

It has low battery cut off voltage at 10.5V to protect the battery from over discharge. 

The output is square waveform and the maximum output power depends on the power of your transformer and also the MOSFETs and heatsink's size. 

 

Arduino inverter 12V to 220V

Arduino inverter 12V to 220V with LCD Display

Parts list:

Arduino (UNO or MEGA) 

IC 7805  

LCD Display 16x2 with I2C 

Transformer center taped 9V-0-9V / 220V 

MOSFET IRFZ44n (2pcs)

Optocoupler PC817 (2pcs)

Resistor 91K 

Resistor 10K (3pcs)

Resistor 300 ohm (2pcs)

Resistor 1K (3pcs) 

Capacitor 1000uF 16v (2pcs) 

Capacitor 100nF (2pcs) 

Heatsink for MOSFETs (2pcs)

12V Battery 

Battery connecting cable 

 

Circuit:

If you want to use Arduino UNO instead of Arduino MEGA, you have to connect the pin A4 of the Arduino UNO to SDA of the LCD and pin A5 of the Arduino UNO to SCL of the LCD, Rest of the wiring and even the code remains the same!

Arduino inverter 12V to 220V with LCD Display

Video: 

 


Code: 

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <avr/io.h>
#include <avr/interrupt.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);  // Try 0x3F if 0x27 doesn’t work

const int square1 = 8;
const int square2 = 9;
const int buttonPin = 2;

volatile bool waveState = false;       // Toggles HIGH/LOW
volatile bool outputEnabled = false;   // ON/OFF by user
bool voltageOK = true;                 // Low voltage check

const unsigned int deadTimeMicros = 200;
const float voltageThreshold = 10.5;   // Cutoff threshold

unsigned long lastLCDUpdate = 0;
const unsigned long lcdInterval = 200;

unsigned long lastButtonTime = 0;
const unsigned long debounceDelay = 200;

void setup() {
  pinMode(square1, OUTPUT);
  pinMode(square2, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);

  digitalWrite(square1, LOW);
  digitalWrite(square2, LOW);

  lcd.init();
  lcd.backlight();
  lcd.clear();

  attachInterrupt(digitalPinToInterrupt(buttonPin), toggleOutput, FALLING);

  // Timer1 for 50Hz waveform (10ms toggle = 20ms full cycle)
  noInterrupts();
  TCCR1A = 0;
  TCCR1B = 0;
  TCNT1 = 0;
  OCR1A = 2499;  // 10ms at 16MHz / 64
  TCCR1B |= (1 << WGM12);
  TCCR1B |= (1 << CS11) | (1 << CS10);
  TIMSK1 |= (1 << OCIE1A);
  interrupts();
}

ISR(TIMER1_COMPA_vect) {
  if (outputEnabled && voltageOK) {
    waveState = !waveState;
    if (waveState) {
      digitalWrite(square2, LOW);
      delayMicroseconds(deadTimeMicros);
      digitalWrite(square1, HIGH);
    } else {
      digitalWrite(square1, LOW);
      delayMicroseconds(deadTimeMicros);
      digitalWrite(square2, HIGH);
    }
  } else {
    digitalWrite(square1, LOW);
    digitalWrite(square2, LOW);
  }
}

void loop() {
  // Update LCD every 200ms
  if (millis() - lastLCDUpdate >= lcdInterval) {
    lastLCDUpdate = millis();

    int adc0 = analogRead(A0); delay(2);
   
    float v0 = adc0 * (5.0 / 1023.0)*10;
   

    // Voltage check
    voltageOK = (v0 >= voltageThreshold);

    // Display voltages
    lcd.setCursor(0, 0);
    lcd.print("BATTERY: ");
    lcd.print(v0, 2);
    lcd.print(" V     ");


    // Show status
    lcd.setCursor(1, 1);
    if (!voltageOK) {
      lcd.print("BATTERY IS LOW");
    } else {
      lcd.print(outputEnabled ? "INVERTER IS ON " : "INVERTER IS OFF");
    }
  }
}

void toggleOutput() {
  unsigned long now = millis();
  if (now - lastButtonTime > debounceDelay) {
    outputEnabled = !outputEnabled;
    lastButtonTime = now;
  }
}


 

July 22, 2025

How to run 3 phase motor using single phase supply

This is a simple way to run 3 phase motor using single phase supply.

By this method you can get only 50% to 60% of the motor's power. 

 

How to run 3 phase motor using single phase

Change direction of rotation by a ON-OFF-ON switch:

How to run 3 phase motor using single phase

 

Video:

 


July 16, 2025

Full array local dimming / mini LED

 This is a new method to make local dimming TV / monitor by using LED module !

 

Full array local dimming / mini LED

Full array local dimming / mini LED

 

Circuit to convert the color LED module to black and white:

Full array local dimming / mini LED

 Video:


 

July 10, 2025

DIY 3 phase inverter without microcontroller

This is a DIY 3 phase inverter without using any microcontroller.

It convert 12V DC into 220V/380V AC.

Efficiency was almost 69%

Output waveform is Square wave.

 

DIY 3 phase inverter without microcontroller

 

Parts list:

IC 4017

IC 555

IC 4049

IC 7809 

MOSFET IRFZ44N (6pcs)

Diode 1N4148 (9pcs)

Capacitor 680uF 16V or 35V (2pcs)

Capacitor 100nF (4pcs)

Resistor 30K for 50Hz or 24K for 60Hz

Resistor 10K (7pcs)

Resistor 100 ohm (6pcs)

Resistor 1K (3pcs)

Toggle switch 6pin ON-ON

Car fuse 50A (depends on the max. load) 

Transformer center tap 9-0-9 to 220 (3pcs)

IC socket 8 DIP 

IC socket 16 DIP (2pcs)

Heatsink for Mosfet (6pcs) 

12V Battery cable/connector 

 

Circuit:

For 24V battery, the capacitors must be 35V instead of 16V and the transformers must be 18V instead of 9V.

DIY 3 phase inverter without microcontroller

You can order the PCB from PCBWay

https://www.pcbway.com/project/shareproject/DIY_3_phase_inverter_without_microcontroller_e4c7cfde.html

DIY 3 phase inverter without microcontroller

Video: 

 


 

July 07, 2025

DIY isolation transformer

In following video you can see how to make an isolation transformer using two regular 220/12v transformers, and then modified them to work as a single isolation transformer 240v to 240v or 120v to 120v .

 

DIY isolation transformer

Video:


 

July 05, 2025

PC Oscilloscope ET601/ET602

This is a review and test of USB Oscilloscope ET601.

I test the maximum frequency bandwidth and also tear it down to see what is inside!


PC Oscilloscope ET601/ET602

 

PC Oscilloscope ET601/ET602

Video: 

 



June 22, 2025

How to program and install LED Billboard

In following video you can see how to program and install LED Billboard with WiFi and HDMI input.



How to program and install LED Billboard

How to program and install LED Billboard

Parts list:

P2.5 LED module 32cm x 16cm 

Receiving card R712

Multimedia player HD-A4L

Power Supply 5V 40A

Connecting wire

 

Software :

https://www.hdwell.com/Download/index_100000010736467.html 

 

Video:

 



 

June 08, 2025

How to use Rotary Dial instead of Keypad

I used a Rotary Dial Pad instead of ordinary Keypad to select between 10 LEDs and display a number from 0 to 9 on a seven-segment. We can also use it with Arduino.

 

How to use Rotary Dial instead of Keypad

Parts list:

IC 4017

IC4026

LED 5mm (10pcs)

Common cathode seven segment

Capacitor 100nF (2pcs)

Resistor 1K (9pcs) 

Resistor 10K 

Resistor 30K  

9V Battery with holder / cable

IC socket 16DIP (2pcs) 

Rotary Dial pad

 

Circuit:

The rotary dial pad in my case has 5 wires, however i used 4 of them. the color of wires could be different from one telephone to another, so you need to use continuity tester of your multimeter to distinguish the wires. 

Orange and Pink are "normally closed switch", they become open several times depends on the number you dial you release the rotary pad, so the counter IC start to count UP.

Blue and Gray are "normally open switch", they become closed once you rotate the pad clockwise then back to open when you release the rotary pad, i used them to Reset the counter and seven segment to zero each time before you dial a new number.

You can order the PCB from PCBWay: 

https://www.pcbway.com/project/shareproject/Using_Rotary_Dial_Pad_instead_of_Keypad_27515a7e.html

 

How to use Rotary Dial instead of Keypad

Using Arduino:

You need only 2 wires (Orange and Pink) if you want to use the rotary dial pad with Arduino.

Once again the colors of wires could be different in your telephone's rotary.  

Rotary Dial with arduino

Parts list: 

Arduino UNO

LCD 2X16 with I2C

Rotary Dial pad 

Resistor 10K

 

Code: 

#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27,16,2);
int needToPrint = 0;
int count;
int in = 2;
int lastState = LOW;
int trueState = LOW;
long lastStateChangeTime = 0;
int cleared = 0;
int dialHasFinishedRotatingAfterMs = 100;
int debounceDelay = 10;

void setup()
{
  lcd.init();          
  lcd.backlight();
Serial.begin(9600);
pinMode(in, INPUT);
}

void loop()
{
int reading = digitalRead(in);

if ((millis() - lastStateChangeTime) > dialHasFinishedRotatingAfterMs) {
if (needToPrint) {
Serial.print(count % 10, DEC);
  lcd.print(count % 10, DEC);
needToPrint = 0;
count = 0;
cleared = 0;
}
}

if (reading != lastState) {
lastStateChangeTime = millis();
}
if ((millis() - lastStateChangeTime) > debounceDelay) {
if (reading != trueState) {
trueState = reading;
if (trueState == HIGH) {
count++;
needToPrint = 1;
}
}
}
lastState = reading;
}

 

Video:

 


 

 

February 21, 2025

Capacitor bank switch for PFC (Power factor correction)

 This is a Capacitor bank switch for PFC (Power factor correction)

 

Capacitor bank switch for PFC (Power factor correction)

Parts List:

400V 0.1uF capacitor (10PCS) 

400V 1uF capacitor (20PCS) (the capacitor value is optional but should be 1uF or less)
Toggle Switch (30PCS)
10A Fuse with holder
Terminal 2P (2pcs) 


Video:

 


 

February 15, 2025

Composite Video to analog XYZ signal for Oscilloscope

This Circuit is a Composite Video to analog XYZ signal converter which take s-video signal and display it on an analog Oscilloscope CRT display. It uses IC LM1881 which is a composite video sync separator. 

 

Composite Video to analog XYZ signal for Oscilloscope
 
Composite Video to analog XYZ signal for Oscilloscope

Composite Video to analog XYZ signal for Oscilloscope


Parts List:

IC LM1881 (SMD or THT)

IC AD8032 (SMD or THT)

Transistor 2N2222 (4pcs)

Transistor 2N3906 (2pcs) 

Diode 1N4148 (2pcs)

Potentiometer 1K

Potentiometer 10K

Capacitor 680uF 16V

Capacitor 100nF (3pcs)

Capacitor 10nF

Capacitor 22nF

Resistor 180 ohm

Resistor 680 ohm

Resistor 180 ohm

Resistor 1k

Resistor 2.2k (3pcs)

Resistor 3.3k (3pcs)

Resistor 6.8k (2pcs)

Resistor 2.2k (3pcs)

Resistor 4.7k

Resistor 5.6k

Resistor 68k (2pcs)

Resistor 680k 

9V Battery

9V Battery cable/holder

IC Socket 8dip (2pcs)

ON/OFF Switch

Knob for Potentiometers (2pcs)

BNC Connector (4pcs)

BNC Cables (4pcs)

HDMI to AV Converter (optional)

 

Circuit : 

NOTE: If you want to use different op-amp (instead of AD8032) it must be rail to rail op-amp otherwise the circuit not going to work properly. 

Download the circuit with better resolution (PDF) here:

https://drive.google.com/file/d/1levyhMAB9TWcYP5NufMxrQ7pRDUImYUH/view?usp=drive_link

 

Composite Video to analog XYZ signal for Oscilloscope


You can order this PCB from PCBWay here:

 https://www.pcbway.com/project/shareproject/Video_on_Oscilloscope_3b6c3d70.html

Composite Video to analog XYZ signal for Oscilloscope

 

The two holes near the battery could be use to holding the battery in place by a piece of wire !

Composite Video to analog XYZ signal for Oscilloscope

Video:

 



 

 

 

 

 

 

 

 

 

 

 


 

 

February 12, 2025

How Power Factor Correction Affects Battery runtime of an Inverter/UPS ?

Power factor correction (PFC) improves the efficiency of power transfer from an inverter or UPS to the load, but it does not directly increase battery runtime in most cases. 

How Power Factor Correction Affects Battery runtime of an Inverter/UPS ?


How Power Factor Correction Affects an Inverter/UPS

1. Reduced Apparent Power Demand:
PFC reduces the apparent power (VA) drawn from the inverter by making the load more resistive (higher power factor, ideally 1.0).
This means the inverter/UPS operates at lower current, reducing heat losses in its components.


2. Lower Internal Losses:
Since lower currents flow through the inverter's internal wiring and components, losses due to resistance (I²R losses) are reduced.
This can slightly improve efficiency but does not significantly increase battery runtime.
Why Battery Runtime Won’t Increase Much
Battery runtime depends mainly on watt-hour capacity (Wh = Ah × V) and the actual real power (W) consumed by the load.
If the load needs 500W, it will still consume 500W even if PFC is applied.
The inverter draws the same real power from the battery regardless of power factor.
Power factor affects the inverter's apparent power handling, but not the real power demand from the battery.


When PFC Might Help Battery Runtime
If the inverter is undersized and struggling to provide enough VA for low power factor loads, it may heat up and operate inefficiently.
A poor power factor can cause excess heating in the inverter due to high current draw, reducing efficiency and wasting some energy.
Correcting power factor can slightly reduce these losses, indirectly improving battery runtime by a small margin.


Better Ways to Increase Battery Runtime
If you want to extend the battery life of your inverter or UPS, consider:
✔ Using a larger battery capacity (higher Ah rating)
✔ Switching to a more efficient inverter with a better conversion efficiency
✔ Reducing load power consumption (LEDs instead of incandescent bulbs, efficient appliances, etc.)
✔ Using a pure sine wave inverter (they are more efficient with inductive loads like motors and transformers)


Conclusion
PFC improves efficiency but does not significantly increase battery runtime unless your inverter is experiencing excessive heating due to a very poor power factor. The best way to increase runtime is to use larger batteries or reduce power consumption.

 


 


 

August 26, 2024

How to compare 3 different voltages

This circuit is an op-amp comparator with three inputs, to compare 3 different voltages and show the higher one by using an LED.

 

compare 3 different voltages

Parts list:

IC CD4001

IC LM324

Resistor 510 ohm (3pcs)

RED LED

GREEN LED

BLUE LED

IC socket 14 pin(2pcs)

Capacitor 220uF

Capacitor 100nF

 

Circuit:

VCC could be any voltage between 4 to 15V

How to compare 3 different voltages

Video:

 


 


August 15, 2024

Automatic Transfer Switch ATS / Changeover with 3 Input Sources

This circuit is an Automatic Transfer Switch ATS / Changeover with 3 Input Sources (3 ways).

It has 3 seconds time delay to transfer between Grid and Solar system (No delay time for Generator).

Maximum current up to 20 Amps.

Works with both 110V and 220V systems.

Automatic Transfer Switch ATS / Changeover with 3 Input Sources

Parts list:

IC LM358

IC Socket 8dip

Power supply HI-LINK 12V 3W 250mA

Resistor 51K (2pcs)

Resistor 3K (2pcs)

Resistor 1K (2pcs)

Resistor 10K (4pcs)

Resistor 560

Resistor 3.9K

Capacitor 100uF 16V

Optocoupler PC817

RED LED 

BLUE LED

Screw Terminal

Relay 12V 20A (4pcs)

Bridge diode DB107 (2pcs)

Diode 1N4007 (3pcs)

Transistor 2N2222 (2pcs)


Circuit:

 

Automatic Transfer Switch ATS / Changeover with 3 Input Sources

You can order this PCB from PCBWay.com:

https://www.pcbway.com/project/shareproject/Automatic_Transfer_Switch_ATS_Changeover_with_3_Input_Sources_6cea22a5.html

 

Automatic Transfer Switch ATS / Changeover with 3 Input Sources

Video: