Pure Sinewave Inverter Part 1
Pure Sinewave Inverter Part 1
Pure sinewave inverters are starting to be sold on the Indonesian market today. But, at a
fairly high price compared to the type of box wave inverter or modified sine wave (modified
sinewave). Many sine wave generator modules are also available which can be assembled
directly according to the desired power. The module is based on IC egs002 or
egs8010. Those who want to make simple pure sinewave inverters can use the Arduino
board.
The basic knowledge for making a sine wave generator is PWM (Pulse Width
Modulator). This PWM is utilized by all types of inverters including square wave, sine wave
modification and pure sine wave. If you already know about PWM, how to adjust the
frequency and duty cycle you can make your own inverter. Pure sine waves can be generated
from PWM by adjusting the percentage of the duty cyclic, the greater the percentage of duty
cycle, the greater the flow that can be flowed and vice versa.
we can see the following picture of the sine wave formation method using PWM.
from the picture above can be seen the comparison of pwm duty cycle and sine wave
shape. there it starts from the sinus 0 degrees to 90 degrees and to 180 degrees the duty
cycle enlarges to the top and shrinks back when heading 180 degrees.
If you can make a pwm shape like that then you can adjust the frequency so that the final
frequency after filtering is 50-60Hz.
so a glimpse of the theory of making sine wave inverters. then we will learn how to calculate
so that the final frequency can be 50-60Hz after filtering because the waveform frequency
pwm frequency must be at least 20KHz and after filtering it into pure sine wave the frequency
becomes 50-60Hz according to the electricity rules in our country.
Picture of the mosfet A and mosfet B waveforms.
From the picture above, it describes waveforms to induce transformers alternately. When
Part A drives or switches or gives pwm waves to mosfet A, Part B is 0 and vice versa.
The formula for sharing switching times is
So to reach one period it takes 20 milliseconds. Because it is divided into two to switch
Mosfet A and B, each gets 10 milliseconds.
for 10 milliseconds each must be able to form a half-sine wave using a high frequency
PWM. according to my experience around 15-20KHz is minimal to be able to produce good
output and not noisy when using an iron transformer.
Next we have to calculate the number of pwm samples in half 50Hz sine wave.
for example i use the frequency of pwm 20KHz then
sample pwm = 20ms / (1 / 20KHz) = 400 samples in one period. when we divide it into
two to switch Part A and Part B, each becomes 200 samples.
Next how to form pure sine waves using PWM by utilizing duty cycle.
simply the value of the duty cycle can be calculated by the formula:
duty cycle = sin (sample x 180 / total sample) * A
Where :
sample = the value of each calculated angle (0 - total sample)
total sample = total sample in half sine wave in this case 200 samples for 20KHz
frequency pwm
But in reality the Sinus formula in Arduino is not the same as the calculator we
use. calculation of sine values in Arduino uses radians not degrees. So, you need to change
radians to degrees with formulas
1 radians = 180 / pi
degree = sample x (180 / total_sampel) x phi / 180
DT = sin (degree) x A
Thus the discussion of pwm wave processing for switching so that a pure sine wave is
generated in the output filter section later.
later we will continue to discuss how to program using Arduino and design the hardware.
thank you for reading I apologize for all the shortcomings, hopefully useful. Don't forget to
also watch my youtube channel on the top right.
3. Prepare the Arduino board with a minimum of Arduino with the Atmega328 chip.
after all is ready, then the program design procedure phase is in accordance with the theory
that we have learned before.
phi = 3.14
sample [n] = sample from 1 - 200
the above procedure is the main procedure, please download the program code
#include <TimerOne.h>
float sinus[200];
float phi=3.14;
int total_sample=200;
int A=1023;
int outA = 11;
int outB=12;
int flag = 0;
int sample=0;
int f_sine=50;// Hz
int f_pwm=15000;//Hz
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
sampling();
for (int samples=0;samples<total_sample;cnt++){
float degree= samples*(180./total_sample)*phi/180;
sinus[samples]=sin(degree)*A;
//Serial.println(sinus);
//delay(1000);
}
float t_pwm=(1000./f_pwm)*1000;
Serial.println(t_pwm);
delay(1000);
Timer1.initialize(t_pwm); // 20KHz
Timer1.attachInterrupt(generate_sinus);
}
void loop() {
// put your main code here, to run repeatedly:
}
void generate_sinus(){
if(sample>total_sample && flag==0){
flag=1;
sample=0;
}
if(sample>total_sample && flag==1){
flag=0;
sample=0;
}
sample++;
if(flag==0){
Timer1.pwm(outA,sinus[sample]);
Timer1.pwm(outB,0);
}
if(flag==1){
Timer1.pwm(outB,sinus[sample]);
Timer1.pwm(outA,0);
}
}
void sampling(){
float sine=1./f_sine;
float duty_pwm=1./f_pwm;
total_sample=(sine/duty_pwm)/2;
This is the last material for the discussion of Pure Sine Wave Inverter. After discussing the
formula and making software, the last is designing a hardware circuit. to just try whether
everything we made from the beginning works well or not, the circuit does not need high
spec, just use small transformers and mosfets with small power, we will see the waveform
and the ability to turn on electronic devices with 220v voltage with a maximum power of
100 watts
The transformer used is a transformer with CT input (Center Tap), each of which has a 7v -
12V voltage if using 12volt AKI. Transformer ampers can be adjusted to the desired power
can be calculated by the formula P = IxV.
P = Power, I = current (Amper) and V = Input Voltage.
That is a brief explanation of hardware design that I made hopefully useful. If there is an
error in hardware design whether it is writing the component value or installation error
please comment below.
Sine wave with feedback output
#include <TimerOne.h>
//total sample = 1/2 (Ts / Tpwm)
//Ts = the time taken (ms) takes 1 wave period (1 / 50Hz)
//Tpwm = time required (ms) to take 1 wave period (eg 1 / 19KHz)
void setup() {
for (int cnt=0;cnt<total_sample;cnt++){
//change radians to degrees
//degree = (sample [n] x (180 / total sample) x phi) / 180.
float sine_val= cnt*(180./total_sample)*phi/180;
// calculate the pwm duty cycle value with the formula
//DC = sin (degrees)
sinus[cnt]=sin(sine_val);
}
float t_pwm=(1000./f_pwm)*1000; //52.6
delay(1000);
pinMode(potinput, INPUT);
pinMode(feedbackinput, INPUT);
pinMode(mosA, OUTPUT);
pinMode(mosB, OUTPUT);
A = 0;
//set the interrupt according to Tpwm or every 1 / 19KHz
Timer1.initialize(t_pwm);
Timer1.attachInterrupt(generate_sinus);
}
void loop() {
potinputval = analogRead(potinput); //read pot value from adc0
potinputval = map(potinputval, 1023, 0, 1000, 0); //scale to 1000
ARD1
ON
Reset BT N
w w w .T heEngineeringProjects.com
AREF A
13
PB5/SCK B
RV1 12
PB4/MISO
RESET 11
~ PB3/MOSI/OC2A C
10
~ PB2/OC1B
9
~ PB1/OC1A D
43%
8
PB0/ICP1/CLKO
ATMEGA328P-PU
1121
7
ANALOG IN
PD7/AIN1
6
1k A0 ~ PD7/AIN1
5
PC0/ADC0
A1 ~ PD5/T1/OC0B
4
PC1/ADC1
A2 PD4/T0/XCK
PC2/ADC2 3
A3 ~ PD3/INT1/OC2B
2
PC3/ADC3 PD2/INT0
A4 1
PC4/ADC4/SDA PD1/TXD
A5 0
PC5/ADC5/SCL PD0/RXD
1k