Design and Implementation of A Microcontroller Based DC/AC Inverter
Design and Implementation of A Microcontroller Based DC/AC Inverter
* *
Firas Mohammed Ali Al-Raie Hawraa Qasim Hameed
Abstract
In this paper, a method is proposed to improve the frequency stability and
accuracy of the generated wave in DC/AC square wave inverters using a
microcontroller-based stabilized oscillator circuit.
The proposed technique relies on using the 8051 microcontroller as a
stable oscillator to generate two anti-phase 50 Hz square waves for the
driving power stage of the inverter based on a program stored in its
internal ROM. These signals are then boosted to increase their voltage
and current levels using BJT switching mode power transistors operating
in the push/pull mode. The resulting signal is then raised into the required
voltage level with the aid of a step-up transformer.
A practical inverter circuit has been designed and constructed to convert
a 12 V battery DC input into 220 V AC output based on the 8051
microcontroller. This circuit consists of an 8051 microcontroller, buffer,
driver power transistor stage, final power transistor stage, and a step-up
transformer. The inverter circuit has been simulated, implemented, and
tested practically. The test measurements have indicated that the circuit
gives a full load power of 10 W with full-load voltage regulation of 8%, and
a maximum conversion efficiency of 70%.
*
Department of Electrical Engineering, University of Technology
- 19 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
1. Introduction
An inverter is an electronic circuit that converts direct current (DC) to
alternating current (AC) as shown in Figure 1.
- 20 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
- 21 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
- 22 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
4. Inverter Design
In this section, the design approach of the practical inverter circuit will be
clarified and illustrated. The design process involves designing the
microcontroller circuit to operate as a 50 Hz square wave oscillator,
designing the driver and power stage, selecting the step-up transformer,
and finally assembling the overall circuit.
- 23 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
td
N ( N max 1) (1)
Tck
Where Nmax is the full-scale value of the timer which equals to 65535
(FFFFH), and Tck is the clock period and is equal to the reciprocal of the
clock frequency fck.
The value of N can be converted from decimal to hexadecimal before
loading it into the timer registers. Thus, to generate a square wave of 50
Hz, a time delay of 10 ms should be produced for each of the HIGH and
LOW portions of the signal. A 10 MHz crystal is used for the AT89C51
microcontroller, which ensures an internal clock frequency of 833.333 kHz,
and a clock interval Tck of 1.2 µs. Substituting both td = 10 ms, and Tck =
1.2 µs in equation (1) yields N = 57203. This value is equivalent to DF73H.
Figure 5 presents the 8051 assembly code for generating two out-of-
phase 50 Hz square-wave signals at pins P1.0 and P1.1 of the AT89C51
microcontroller.
The program resides in the microcontroller’s on-chip memory at a starting
address of 00H. Initially, pin P1.0 of Port 1 is cleared, and pin P1.1 is set
to 1 to generate 180o out of phase signals. Timer 0 of the 8051 chip is
selected by properly defining the codeword in the TMOD control register
(in this case codeword = 01H). The calculated hexadecimal value (DF73H)
is loaded into the TL0 and TH0 registers of timer 0. Afterwards, the timer is
started counting by activating the TR0 flag bit through the SETB
instruction. The state of the TF bit (timer flag) is monitored using the JNB
instruction. Actually, the timer will count a total number of clock signals
equal to 208DH (FFFFH-DF73H+1) before reaching the overflow state.
When the timer reaches its maximum limit, the TF bit will go HIGH and the
counting process is stopped by resetting the flag bit TR0 to 0. Before
repeating the counting cycle, both signals at pin P1.0 and P1.1 should be
complemented using the CPL instruction and timer flag TF should be
- 25 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
- 26 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
- 27 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
Resistors R1 and R2 are used to control the input base currents of Q 1 and
Q3. They can be chosen to place the transistors in saturation when
conducting. This will minimize the losses due to transistors’ power
dissipation. For a specified collector current in Q 2 or Q4, resistor R1 should
be chosen such that [7]:
Where VIN1 is the peak input voltage at the base of Q 1 when conducting
and is equal to 5 V, IC2 is the collector current of Q2, while hFE1 and hFE2
are the minimum values of the DC current gain for Q 1 and Q2 respectively.
For a collector current passing in Q2 of 1A, hFE1 = 40, hFE2 = 20, and
VBE1(sat) = VBE2(sat) = 0.75V, then R1 should be less than 2.8 kΩ. A value of 1
kΩ was selected to place the transistors deeply in saturation. The value of
resistor R2 is calculated in a similar manner as Q3 and Q4 are identical with
Q1 and Q2 respectively.
Q1 is working as a driver transistor for Q2, and Q3 is the driving stage of
Q4. Without these driving transistors, the input signals would not drive Q 2
and Q4. Q1 and Q3 are medium power transistors, while Q2 and Q4 are
high power transistors. The power transistor BD137 has been chosen to
implement Q1 and Q3. This is a medium power transistor with maximum
current rating of 1.5 A. On the other hand, the well–known power transistor
2N3055 has been selected to implement Q2 and Q4. This transistor can
pass a maximum collector current of 15 A.
During the first half interval of the square wave (ON period), both Q 1 and
Q2 will conduct (becoming ON), while Q3 and Q4 will be OFF. On the other
hand, during the second half of the interval of the square wave, both Q 3
and Q4 will be ON while Q1 and Q2 will be OFF. So, the current will reverse
its direction through the primary winding of the transformer during each
half cycle, thereby producing an AC alternating signal. The signal
amplitude will then be stepped up to 220 V at the secondary winding.
Actually, a center–tap step-up transformer (12 V to 220 V) with a
maximum current rating of 1 A at the low voltage side has been used in
this design.
The power stage of the inverter circuit has been simulated using a
powerful circuit simulator (ADS of Agilent Technologies) to scope the
voltage waveforms at the base and collector of the power transistors as
- 28 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
well as the output voltage and load current. Other popular circuit
simulators, such as PSpice, can also be used for such a purpose [8]. The
input driving signals of the circuit are provided from two out-of-phase pulse
generators with a frequency of 50 Hz and amplitude of 5 V. The simulation
has been carried out for a load power of 10 W.
Figure 8 shows the base voltages of Q1 and Q3. The amplitude of the
base voltage of Q1 reaches approximately 1.4 V which equals
approximately VBE1(sat) plus VBE2(sat). The spikes appearing in the
transitions of the signals are due to the emitter-base junction capacitance.
These spikes can be eliminated practically using freewheeling diodes. It is
clear that these waveforms are out of phase to prevent Q 1 and Q3 from
conduction at the same time, which is necessary for the push-pull
operation.
2.0 2.0
1.5 1.5
1.0 1.0
Vb3, V
Vb1, V
0.5 0.5
0.0 0.0
-0.5 -0.5
0 10 20 30 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100
- 29 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
25
20
15
VC E2, V
10
0
0 10 20 30 40 50 60 70 80 90 100
time, msec
15
10
5
Vpr1, V
-5
-10
-15
0 10 20 30 40 50 60 70 80 90 100
time, msec
The output signal of the inverter is sketched in Figure 11. For a load of 10
W, the simulated peak value is about 208 V. It is well-known that the r.m.s
value of the voltage equals the peak value for the square wave.
- 30 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
300
200
100
Vo, V
-100
-200
-300
0 10 20 30 40 50 60 70 80 90 100
time, msec
200
150
Vo(f), V
100
50
0
0 50 100 150 200 250 300 350 400 450 500
freq, Hz
- 31 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
60
40
20
io, mA
0
-20
-40
-60
0 10 20 30 40 50 60 70 80 90 100
time, msec
- 32 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
- 33 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
Figure 17: Signal at the Output of the 74LS244 Buffer (Scale: 2V/div,
10 ms/div)
- 34 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
- 35 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
In this test setup, a 12 V car battery was used for DC input and 220 V, 2 W
bulbs (lamps) were used for the AC load. The input voltage, input current,
output current, and output voltage have been measured while changing
the wattage of the load bulbs. The output voltage actually falls with a
heavy load. The consumption of power by the bulbs changes with the
voltage.
Figure 21 shows a sketch of the output voltage versus load power, while
Figure 22 shows a sketch of the inverter efficiency versus load power
where:
Pout V .I
100 out out 100 (4)
Pin V dc . I dc
Where Vdc and Idc are the DC input voltage and current respectively, and
Vout and Iout are the r.m.s voltage and current at the output.
It can be seen from Figure 21 that the output voltage falls with increasing
load power and reaches to 200 V approximately at 10 W output (Full-load).
From this figure, the AC voltage regulation can be calculated as:
V NL VFL
VR 100 (5)
VFL
216 200
8%
200
Where VNL is the no-load output voltage and VFL is the full-load output
voltage.
- 36 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
On the other hand, the efficiency increases with the increase in load power
and reaches a maximum value of 70% approximately at 10 W load power
as shown in Figure 22.
250
200
150
Vout (V)
100
50
0
0 2 4 6 8 10 12 14
PL (W)
90
80
70
60
% Efficiency
50
40
30
20
10
0
0 2 4 6 8 10 12 14
PL (W)
- 37 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ.م. م، ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ.م.م
- 38 -
Al-Mansour Journal / Issue ( 24 ) 2015 ( 24) اﻟﻌﺪد/ﻣﺠﻠﺔ اﻟﻤﻨﺼﻮر
References
[1] Fang L. Luo and Hong Ye, “Advanced DC/AC Inverters: Applications
in Renewable Energy”, Taylor & Francis Group, LLC, 2013.
[2] Denis Fewson, “Introduction to Power Electronics”, Oxford University
Press, New York, USA, 1998.
[3] James H. Hahn, “Modified Sine Wave Inverter Enhanced”, Power
Electronics Technology, August 2006, pp. 20-22.
[4] M. U. Rafique, S. Aslan, and J. Anwer, “Implementation of a Novel
Microcontroller-Based Voltage Source Sine-Wave Inverter”,
Proceedings of the 2011 Frontiers of Information Technology, pp.
167-172.
[5] A. S. K. Chowdhury et al., “Design and Implementation of a Highly
Efficient Pure Sine-Wave Inverter for Photovoltaic Applications”,
Proceedings of the 2013 International Conference on Informatics,
Electronics & Vision (ICIEV), 17-18 May 2013, pp. 1-6.
[6] Muhammad Ali Mazidi, Janice G. Mazidi, and Rolin D. McKinlay,
“The 8051 Microcontroller and Embedded Systems Using Assembly
and C”, 2nd Edition, Prentice-Hall, New-Delhi, India, 2006.
[7] Bob Cordell, “Designing Audio Power Amplifiers”, McGraw-Hill
Companies, Inc., 2011.
[8] M. H. Rashid, and H. M. Rashid, “SPICE for Power Electronics and
Electric Power”, 2nd Edition, Tylor & Francis Group, LLC, 2006.
- 39 -
Hawraa Qasim Hameed Firas Mohammed Ali Al-Raie م.م.ﻓﺮاس ﻣﺤﻤﺪ ﻋﻠﻲ ،م.م .ﺣﻮراء ﻗﺎﺳﻢ ﺣﻤﯿﺪ
ﺗﺼﻤﯿﻢ وﺗﻨﻔﯿﺬ ﻋﺎﻛﺲ ﺗﯿﺎر ﻣﺴﺘﻤﺮ /ﺗﯿﺎر ﻣﺘﻨﺎوب ﺑﺎﺳﺘﺨﺪام اﻟﻤﺴﯿﻄﺮ اﻟﺪﻗﯿﻖ
اﻟﻤﺴﺘﺨﻠﺺ
ﻓﻲ ھﺬا اﻟﺒﺤﺚ ﺗﻢ اﻗﺘﺮاح ﻃﺮﯾﻘﺔ ﻟﺘﺤﺴﯿﻦ اﻹﺳﺘﻘﺮارﯾﺔ اﻟﺘﺮددﯾﺔ ودﻗﺔ ﺗﺮدد اﻹﺷﺎرة اﻟﻤﺘﻮﻟﺪة ﻟﺪواﺋﺮ
اﻟﻌﺎﻛﺲ ذات اﻹﺷﺎرة اﻟﻤﺮﺑﻌﺔ ﻋﻦ ﻃﺮﯾﻖ اﺳﺘﺨﺪام داﺋﺮة ﻣﺬﺑﺬب ﻋﺎﻟﻲ اﻻﺳﺘﻘﺮار ﻣﺒﻨﯿﺔ ﺑﺎﺳﺘﺨﺪام اﻟﻤﺴﯿﻄﺮ
اﻟﺪﻗﯿﻖ.
ﺗﻌﺘﻤﺪ اﻟﺘﻘﻨﯿﺔ اﻟﻤﻘﺘﺮﺣﺔ ﻋﻠﻰ اﺳﺘﺨﺪام اﻟﻤﺴﯿﻄﺮ اﻟﺪﻗﯿﻖ 8051ﻟﯿﻌﻤﻞ ﻛﻤﺬﺑﺬب ﻋﺎﻟﻲ اﻻﺳﺘﻘﺮار ﻟﺘﻮﻟﯿﺪ
إﺷﺎرﺗﯿﻦ ﻣﺮﺑﻌﺘﯿﻦ ﻣﺘﻌﺎﻛﺴﺘﯿﻦ ﺑﺎﻟﻄﻮر ﺑﺘﺮدد 50 Hzوإرﺳﺎﻟﮭﻤﺎ إﻟﻰ ﻣﺮﺣﻠﺔ ﻣﺸﻐﻞ اﻟﻘﺪرة ﻟﺪاﺋﺮة اﻟﻌﺎﻛﺲ ﻋﻦ
ﻃﺮﯾﻖ ﺑﺮﻧﺎﻣﺞ ﻣﺨﺰون ﻓﻲ ذاﻛﺮﺗﮫ اﻟﺪاﺧﻠﯿﺔ اﻟﺪاﺋﻤﯿﺔ .ﯾﺘﻢ ﺑﻌﺪ ذﻟﻚ ﺗﻀﺨﯿﻢ ھﺬه اﻹﺷﺎرات ﻟﺰﯾﺎدة ﻣﺴﺘﻮى اﻟﺘﯿﺎر
واﻟﻔﻮﻟﺘﯿﺔ ﻓﯿﮭﺎ ﻋﻦ ﻃﺮﯾﻖ ﻣﻀﺨﻢ ﻗﺪرة ﺗﺤﻮﯾﻠﻲ ﯾﻌﻤﻞ ﺑﻄﺮﯾﻘﺔ اﻟﺪﻓﻊ/اﻟﺴﺤﺐ ﺑﺘﺮاﻧﺰﺳﺘﻮرات ﻗﺪرة ﻣﻦ ﻧﻮع
.BJTوﯾﺘﻢ رﻓﻊ ﺟﮭﺪ اﻹﺷﺎرة اﻟﻤﺘﻨﺎوﺑﺔ اﻟﻤﺘﻮﻟﺪة اﻟﻰ اﻟﻘﯿﻤﺔ اﻟﻤﻄﻠﻮﺑﺔ ﺑﻮاﺳﻄﺔ ﻣﺤﻮل راﻓﻊ ﻟﻠﺠﮭﺪ.
ﺗﻢ ﺗﺼﻤﯿﻢ وﺗﻨﻔﯿﺬ داﺋﺮة ﻋﺎﻛﺲ ﻋﻤﻠﯿﺔ ﻟﺘﺤﻮﯾﻞ ﺟﮭﺪ ﻣﺴﺘﻤﺮ ﻣﻘﺪاره 12 Vإﻟﻰ ﺟﮭﺪ ﻣﺘﻨﺎوب ﻗﯿﻤﺘﮫ اﻟﻔﻌﺎﻟﺔ
220 Vﺑﺎﺳﺘﺨﺪام اﻟﻤﺴﯿﻄﺮ اﻟﺪﻗﯿﻖ .8051ﺗﺘﻜﻮن اﻟﺪاﺋﺮة اﻟﻤﻘﺘﺮﺣﺔ ﻣﻦ اﻟﻤﺴﯿﻄﺮ اﻟﺪﻗﯿﻖ 8051وﻋﺎزل
وﻣﻀﺨﻢ ﻗﺪرة أوﻟﻲ وﻣﺮﺣﻠﺔ ﺗﻀﺨﯿﻢ ﻗﺪرة ﻧﮭﺎﺋﯿﺔ ﺑﺎﻹﺿﺎﻓﺔ إﻟﻰ ﻣﺤﻮل راﻓﻊ ﻟﻠﺠﮭﺪ .ﺗﻤﺖ ﻣﺤﺎﻛﺎة داﺋﺮة
اﻟﻌﺎﻛﺲ ﺑﻮاﺳﻄﺔ اﻟﺤﺎﺳﻮب وﻣﻦ ﺛﻢ ﺗﻨﻔﯿﺬھﺎ واﺧﺘﺒﺎرھﺎ ﻋﻤﻠﯿﺎً .وﻗﺪ ﺑﯿﻨﺖ ﻧﺘﺎﺋﺞ اﻟﻘﯿﺎﺳﺎت اﻟﻌﻤﻠﯿﺔ ﺑﺄن اﻟﺪاﺋﺮة
ﺗﻌﻄﻲ ﻗﺪرة ﺧﺮج ﻣﻘﺪارھﺎ 10 Wﻟﻠﺤﻤﻞ اﻟﻜﺎﻣﻞ ﺑﺘﻨﻈﯿﻢ ﺟﮭﺪ ﻣﻘﺪاره 8%وﺑﻜﻔﺎءة ﺗﺤﻮﯾﻞ ﻗﺼﻮى ﺗﺼﻞ إﻟﻰ
.70%
- 40 -