After going through some of the tutorials on Arduino’s site, I really started to appreciate what a powerful platform Arduino really is. A lot of seemingly complex software/hardware interactions can be made quite easy with relatively few components and little coding. As one of my first Arduino based projects, I built a simple power inverter driven by Arduino.
The following is the circuit diagram of this inverter. As you can see, the two MOSFETs attached to the center-tapped transformer (mine was removed from an old UPS), when driven by a rectangular or sinusoidal wave, will produce alternating current in the primary winding. The pull-down resistors (1M) are necessary to prevent any electrical noise. The 10K resistors are not strictly necessary, but I placed them there to prevent damage to the Arduino board in case of a MOSFET failure.

The gates of the two MOSFETS are connected to two digital pins of the Arduino board. The following code shows how to use the simple bit-banging technique to generate the 60Hz square wave needed for the inverter.
int pin1 = 4; int pin2 = 5; void setup() { pinMode(pin1, OUTPUT); pinMode(pin2, OUTPUT); } void loop() { digitalWrite(pin1, HIGH); digitalWrite(pin2, LOW); delay(7); digitalWrite(pin1, LOW); digitalWrite(pin2, HIGH); delay(7); }
The benefit of using an Arduino to control the waveform generation is that the output frequency can be precisely controlled. Of course, if the output waveform accuracy is a concern, more advanced PWM signal with a 50% duty cycle should be used to drive the MOSFETs. An inverter gate would be necessary in this case to obtain the opposite phase pulse signal to drive the second MOSFET. We can even use Arduino to generate pure sinusoidal wave to drive this inverter.
In my example above, the gate-to-source voltage comes directly from the TTL output of the Arduino digital pin. This voltage is acceptable for a 12V Vcc. If the circuit requires higher DC voltage, the gate-to source-voltage may need to be amplified for the MOSFETS to switch properly. The optimal driven voltage can be found on the datasheet of the particular MOSFET used. In this case, it is RFP50N06.
The gates of the two mosfets are connected to two digital pins of the arduino board.
Then the benefit of using an Arduino to control the waveform generation is that the frequency can be precisely controlled. So that the output waveform accuracy is a concern, more advance PWM signal with a 50% duty cycle should be used to drive the MOSFETS. I got it, thanks for the info by the way.
Shouldn’t the delay on lines 13 & 16 be 8ms (62.5Hz) not 7ms (71.4Hz)?
The total delay should be around 8ms. Since the instructions take some time to execute, the total time delay is actually just above 8ms in my experiment and the resulted waveform is very close to 60Hz.
For more accurate timing, you can use the interrupt method mentioned here.
Dear Kerry
What if I change one of the Mosfet with a P-channel one, and just control it using single PWM pin in 50% ?
Can it work ??
sincerey
-bino-
You can’t just change one MOSFET to P-channel without any modifications. But you could refer to http://www.eleccircuit.com/dc-to-ac-inverter-by-ic-555-and-tip41-tip42/ (I haven’t tried myself, but it should work) and replace the 555 squarewave generator with an 50% Arduino PWM output. This circuit doesn’t need a center-tapped transformer.
IF i have four switches to be used in the inverter. Say I’m making a 3 level inverter, how do I go about it as I’m very new to Micrcontrollers.
I’m not an expert but could be possible to do this with a code.
I want to use this circuit but at 350V (300VA transformer).
What type of transistors do I need ?
Thanks!
Sir,
what will be the code if MOSFET’s are replaced with IGBT’s for 1KVA output?
and what should be the duty cycle?
Sir,
this is very good tutorial, I need to build inverter, but is posible to get 1000Hz and 20V-30V by changing transformator and delay on arduino from 7 to 0,5
sir how do i generate signal from arduino to get output 240V AC
¿una pregunta este circuito funciona con 24 voltios de entrada?
¿a question this circuit works with 24V input?
Hello, mr. Kerry.
How can i do to regulate de output AC voltage by using the internal comparator of the Arduino?
Because, when i get a well charged battery, the voltage is 13 Volts and my output grows up to 150V
Can you help me with this problem on the code and suggest the eletrical modifications to the schematic, please?
how to generate sine wave 60hz? give examples!!!!!!