0% found this document useful (0 votes)
170 views31 pages

Inverter

This document describes the design of an embedded system for controlling a single-phase DC/AC inverter. It includes the following key points: 1. The overall architecture consists of a boost converter block, single-phase inverter block, driver block, sensor block, and microcontroller (MCU) block. 2. The boost converter increases the 12V DC input from solar panels to 340V DC for the inverter. Components are calculated to boost in two stages. 3. An STM32 or TI C2000 MCU will generate PWM signals to control the inverter using voltage and current feedback from sensors. The inverter converts the DC to 220V 50Hz AC output.

Uploaded by

Đẹp Phan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
170 views31 pages

Inverter

This document describes the design of an embedded system for controlling a single-phase DC/AC inverter. It includes the following key points: 1. The overall architecture consists of a boost converter block, single-phase inverter block, driver block, sensor block, and microcontroller (MCU) block. 2. The boost converter increases the 12V DC input from solar panels to 340V DC for the inverter. Components are calculated to boost in two stages. 3. An STM32 or TI C2000 MCU will generate PWM signals to control the inverter using voltage and current feedback from sensors. The inverter converts the DC to 220V 50Hz AC output.

Uploaded by

Đẹp Phan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Embedded System Design Project

Single-phase DC/AC Inverter Embedded


Control System
Class: Advanced Program Control Engineering & Automation – Power System
Course: 63 – School of Electrical Engineering, Hanoi University of Science and Technology.
Supervisor: Chu Duc Viet

Name Student ID
Nguyen Sy Quan 20181916
Pham Viet Hung 20181891
Le Hoang Thinh 20181928
Tran Vu Quang 20181918

Hanoi, February, 2022

1
Table of Contents
I. Specification ........................................................................................................................... 2
II. Overall Architecture Design.................................................................................................. 4
III. Solution Design .................................................................................................................... 5
IV. Embedded Design & Implementation ............................................................................... 18
V. Conclusion & Remark ......................................................................................................... 31

List of Figure
Figure 1. Overall block diagram of the project .......................................................................... 4
Figure 2. Boost Converter Architecture for this project ............................................................ 5
Figure 3. MOSFET IRFB4110 .................................................................................................. 6
Figure 4. MOSFET 2SK3667 .................................................................................................... 7
Figure 5. Standalone Single-phase Inverter Architecture for this project ................................. 7
Figure 6. MOSFET 5N60 .......................................................................................................... 9
Figure 7. Voltage sensor circuit ................................................................................................. 9
Figure 8. Resistor divider using OPAMP ................................................................................ 10
Figure 9. IC current sensor topology ....................................................................................... 11
Figure 10. Typical connection of IR2104 ................................................................................ 12
Figure 11. Functional diagram of MIC4427 ............................................................................ 13
Figure 12. Voltage regulator topology recommended by the manufacture using LM2596-ADJ
.................................................................................................................................................. 13
Figure 13. Voltage regulator topology 5V using LM7805 ...................................................... 14
Figure 14. Voltage regulator using LM317 topology .............................................................. 14
Figure 15. Protect circuit topology .......................................................................................... 15
Figure 16. LCD 16x2 ............................................................................................................... 17
Figure 17. IC SN7414 logic diagram ....................................................................................... 18
Figure 18. Alarm speaker topology ......................................................................................... 18

2
I. Specification
For Inverter Design

Rated power 500VA


Input DC voltage 12V
Output voltage (Peak to Peak) 220V (RMS)
Output fundamental frequency 50Hz
Switching frequency 10000 Hz
Maximum drop voltage on inductor 10%Vout
Drop current on inductor 30%Iout
Power factor 0,8

* Note: This is the specification for the single-phase inverter circuit. We need 12V input
since the output of a standard solar panel is 12VDC, and our output voltage is 220V due
to industrial standards for in-house appliances in Vietnam. The output frequency will
be maintained at 50Hz, similar to the power system frequency, and our rated power will
be targeted at 500VA, but this figure can be subject to changes in the future if necessary.
Maximum drop voltage, maximum drop current, and power factor are all design criteria
to ensure the quality of our inverter is up to the task.

For Embedded Controllers

Maximum clock frequency 80MHz

Sensor Voltage Sensor


Current Sensor

Power consumption Depends on peripherals

Preferred Microcontroller STM32f103c8t6 or TI C2000

User Interface None

Can users control the reference value of the No


system?

3
II. Overall Architecture Design

Figure 1. Overall block diagram of the project

1. Single-phase Inverter Block


Single-phase Inverter, the heart of our project, coverts DC current to AC current, which can be
used for home appliances. The input will be from the boost converter block and the output will
be stable 220VAC.
Components in the block require calculation are:
• Filter Inductor
• Filter Capacitor
• MOSFET
• Diode

2. Driver Block

It is beneficial to use N-channel MOSFETs as the high side switches as well as the low side
switches because they have a lower ‘ON’ resistance and therefore less power loss. However,
to do so, the drain of the high side device is connected to 220V DC power which is to be
inverted into the 220V AC power. This is a problem because the 220V is the highest voltage
in the system and for the switch to be turned on the voltage at the gate terminal must be 10V
higher than the drain terminal voltage. Therefore, to drive MOSFETs in the H-Bridge MOSFET
driver IC is used with a bootstrap capacitor specifically designed for driving a half-bridge.

3. Boost Converter Block


Boost Converter boost the 12VDC from solar panel to 220VDC, which then can be fed into the
inverter block. For this project, we choose the conventional boost converter architecture.
Components in the block require calculation are:
• MOSFET

4
• Diode
• Output Capacitor

4. Sensor Block
There will be two sensor blocks in our design: one for the boost converter control and another
for inverter control. To control the single-phase inverter, both output voltage and current are
required, therefore we need voltage sensor and current sensor. For the boost converter, only
voltage sensor is needed.

5. MCU Block

The main component of this inverter is a microcontroller as it is used to generate control


signals. The theory of encoding a sine wave with a PWM signal is relatively simple. A sine
wave is needed for the reference that will dictate the output, and a triangle wave of higher
frequency is needed to sample the reference and actuate the switches. The process can also be
done with a microcontroller and crystal oscillators. For this project, STM32f103c8t6 and TI
C2000 are preferred due to the previous experience of our team members.

III. Solution Design


1. Boost Converter Block Design

Figure 2. Boost Converter Architecture for this project

In this project, we choose a classic Boost converter topology. This topology can
increase a maximum of ten times the input voltage. Here, we need to increase 12V
input to 340V output which is enough to have 220VAC in the overall if there is 10%
of voltage loss in the filter inductor. So, we decide to have 2 Boost converter
cascaded. The first block boosts from 12V to 63.9V and the second from 63.9V to
340V
In order for the boost inverter to have stable performance, components in the boost
topology have to be carefully calculated.
+) The first block calculation:
𝑉𝑜 63.9 1
= =
𝑉𝑖 12 1−𝐷
So, firing angle D = 0.81
Inductance of the inductor is:
𝑉𝑆 × 𝐷
𝐿= = 78𝜇𝐻
𝑓 × ∆𝐼
Hence the 𝑳 = 𝟔𝟖 𝝁𝑯 (maximum current 100A) is chosen based on the availability of
the components in the market
5
Capacitance of the capacitor is:
𝐼𝑎 .𝐷
𝐶= = 50 (𝜇𝐹)
𝑓.∆𝑉
Hence the 𝑪 = 𝟒𝟕 𝝁𝑭 (maximum voltage 120V) is chosen based on the availability of
the components in the market.
At this part, we choose the MOSFET IRFB4110

Figure 3. MOSFET IRFB4110

IRFB4110 is silicon N-channel MOSFET with high-speed power switching,


uninterruptible power supply application. The maximum rating voltage of IRFB4110 is
100V (which is adequate to our design) and maximum rating of drain current is 180A.
+) The second block calculation:
𝑉𝑜 340 1
= =
𝑉𝑖 63.9 1 − 𝐷
So, firing angle D = 0.81
Inductance of the inductor is:
𝑉𝑆 × 𝐷
𝐿= = 2.15𝐻
𝑓 × ∆𝐼
Hence the 𝑳 = 𝟏 𝒎𝑯 (maximum current 20A) is chosen based on the availability of the
components in the market
Capacitance of the capacitor is:
𝐼 .𝐷
𝐶 = 𝑎 = 1.75 (𝜇𝐹)
𝑓.∆𝑉
Hence the 𝑪 = 𝟐. 𝟐 𝝁𝑭 (maximum voltage 700V) is chosen based on the availability of
the components in the market.
At the second block, we choose the MOSFET 2SK3667

6
Figure 4. MOSFET 2SK3667

2SK3667 is a N-channel MOSFET which can withstand high drain source voltage (up
to 600V) which is appropriate with our application. It also has high forward transfer
admittance, low leakage current and low drain-source ON resistance.
* Connection:
• Input: 12VDC from the source
• Output: 340VDC, which will be fed into the Inverter
• MOSFET input: PWM signal from the Driver

2. Inverter Block Design

Figure 5. Standalone Single-phase Inverter Architecture for this project

For the single-phase inverter to have stable performance, components in the inverter
topology must be calculated.

7
a) Output current calculation:
The single-phase inverter is designed to transfer a maximum apparent power S of
500VA. The maximum load current is calculated as following:
𝑆
𝐼𝐿𝑚𝑎𝑥 = = 3.21(𝐴)
𝑉𝑜𝑢𝑡 /√2

b) Output filter design:


To prevent the drop current on the inductor exceeding 30% of the output current, the
inductance value is determined by:
𝑉𝐷𝐶
𝐿𝑓 ≤ = 8.83𝑚𝐻
4 × 𝑓𝑠𝑤 × ∆𝐼𝑝𝑝 𝑚𝑎𝑥
Hence the 𝑳𝒇 = 𝟓 𝒎𝑯 (maximum current 10A) is chosen based on the availability of
the components in the market.
With the given value of inductance, the value of filter capacitance is found by applying
the formula below, where the switching frequency 𝑓𝑠𝑤 is 10kHz.
1 𝑓𝑠𝑤
𝑓𝑐 = <
2𝜋√𝐿𝑓 𝐶𝑓 10
𝐶𝑓 must be larger than 5𝜇𝐹, so we choose 𝑪𝒇 = 𝟒𝟕𝟎𝝁𝑭 (𝟓𝟎𝑽)

c) IGBTs and Diode calculation


With a power factor cos 𝜑 = 0.8 in the worst situation, the avarage current flowing
through power switches (MOSFETs/IGBTs) is:
𝜋
1
𝐼𝑎𝑣𝑔 = ∫ 𝐼𝐿𝑚𝑎𝑥 √2 sin 𝜃𝑑𝜃 = 0.91(𝐴)
2𝜋
𝜑
The average current flowing through antiparallel diodes:
𝜋+𝜑
1
𝐼𝐷𝑎𝑣𝑔 = ∫ 𝐼𝐿𝑚𝑎𝑥 √2 sin 𝜃𝑑𝜃 = 0.1(𝐴)
2𝜋
𝜋
* Connection:
• Input: 340VDC from the Boost converter
• Output: 220VAC for appliances usage
• MOSFET input: PWM signal from the Driver. It is important to mention that
only one Driver is required to control all 4 MOSFETs since two pairs of
MOSFETs are in reverse phase.
For the inverter block, we choose MOSFET 5N60:

8
Figure 6. MOSFET 5N60

The 5N60 is a high voltage MOSFET and is designed to have better characteristics,
such as fast switching time, low gate charge, low on-state resistance and have a high
rugged avalanche characteristic. This power MOSFET is usually used at high-speed
switching applications in power supplies, PWM motor controls, highly efficient DC to
DC converters and bridge circuits. It has maximum drain source voltage is 600V, drain
current 4.5A which is appropriate in our application.

3. Sensor block
a) AC Voltage sensor
The purpose of AC voltage sensor is to transform the value of output voltage of inverter
block (the load voltage) into the value which the ADC of MCU can accept and it can
isolate the measured and measuring part from each other. Here, we choose MCU is
STM32 whose ADC’s maximum measure voltage is 3.3V. So, we propose the
difference circuit using operational amplifier: (has been recommended by Texas
instrument)

Figure 7. Voltage sensor circuit

The OPAMP impedance is infinite so it can isolate the input and output parts which
meet our requirement. Here, we choose IC LM339 which is a quad operational amplifier
circuit.
In order to create output voltage in the range of 3.3V in the ADC of the MCU, the value
of Rc and Rd should be carefully calculated.

9
From the calculation, we choose 𝑅𝑑 = 47 and 𝑅𝑐 =10k which is available on the market
and meet requirements of output voltage and maximum input current of the OPAMP.
The input voltage of the OPAMP, which is at 2 inverting and non-inverting pins also
has been calculated and is set in the required range of the OPAMP.

b) DC voltage sensor:
Similar to the chosen AC voltage sensor topology, we also use OPAMP to do the DC
task. The topology we choose is resistor divider circuit. This topology is simple and
usually used in Texas Instrument recommendation

Figure 8. Resistor divider using OPAMP

At each DC voltage sensor block, the resistors’ values are chosen to make sure the
output voltage of the block which is also the input voltage of the ADC is in the accepted
range. Also, the input voltage of the OPAMP is scaled down due to this operation so it
is in the accepted range of the OPAMP.

c) Current sensor
The current sensors are used to measure currents at the boost and inverter.
The purpose of current sensor is to transform the value of current which we need to
measure into voltage so we can measure it using ADC of MCU. In this project, we
propose using an IC current sensor ACS759LCB-50B. This current sensor is fast
respond (Propagation delay is only 997 𝑛𝑠 and response time is 3.96 𝜇𝑠). This is small
enough for the sampling time which is 100 𝜇𝑠 used in this project. The value of the 𝐶𝐹 is
chosen to be 1𝜇𝐹 for optimal noise management. Some fundamental features:
• 3.0 to 3.6 V, single supply operation
• 120 kHz typical bandwidth
• 3 μs output rise time in response to step input current
• Output voltage proportional to AC or DC currents
• Factory-trimmed for accuracy
• Extremely stable output offset voltage
• Nearly zero magnetic hysteresis

10
Figure 9. IC current sensor topology

d) Discussion
In this project, we need to measure the 4 different values: Load voltage, load current,
inverter output current, Boost converter output voltage. Hence, there are some options
we can choose. The first option is using MCU or several MCUs to ensure that we have
4 ADCs. The second option is using one MCU which have less than 4 ADCs and the
operating frequency of the microcontroller is much larger than switching frequency of
the circuit. In this case, we need to set different priorities for input signal for the ADCs
to measure those in turn.

4. MOSFET Driver Block Design


+) Driver for Inverter
After considering various IC options, the ideal choice was the IR2104, which is rated
at 600V, with a gate driving current of 2A and a gate driving voltage of 10-20V. The
turn on and turn off times are 680ns and 150ns respectively. Delay time is 520ns and
terminal type is DIP 8 / SOP 8.
The driver can operate both the high side and low side devices. A typical connection
diagram of IR2104 can be seen in Figure 10 below. The capacitor from Vb to Vs is a
'battery' that supplies power to the high side driver. When Vs is high (the top FET is on,
and the bottom FET is off) the high side driver must live from the power stored in this
capacitor. When Vs is low (the bottom FET is on) power flows through the diode and
charges the capacitor to Vcc-0.7 volts.

11
Figure 10. Typical connection of IR2104

Generally, it is common for this bootstrap capacitor to have the value between 1uF and
10uF. We choose 5uF as the value for bootstrap capacitor.

+) Driver for Boost converter:


After considering various IC options, the ideal choice was the MIC4427, which is
highly reliable dual low-side MOSFET drivers fabricated on a BiCMOS/DMOS pro-
cess for low power consumption and high efficiency. The driver can operate both the
high side and low side devices.
Some fundamental features:
• 1.5A-peak output current
• 4.5V to 18V operating time
• Logic input protection to 18V
• Dual inverting, dual noninverting, and inverting/noninverting configurations

12
Figure 11. Functional diagram of MIC4427

For this project, 2 PWM channels are required: one for the Inverter and another
for the Boost converter. Therefore, 2 MOSFET Drivers are needed.

5. Voltage regulator
In order to provide stable voltage for MCU, current sensor IC, we need to step down
voltage from 12-volt input to 5 and 3.3 volt. To do this, we propose using switching
fixed regulator circuits and an LDO. In this, we apply LM2596S-ADJ which are high
efficiency adjustable voltage regulators. This is good power supply, small size and do
not hot. We apply this IC to regulate voltage to 7VDC and then use IC LM7805 to turn
the voltage to 5VDC. After that, we get 3.3V by using LM317 voltage regulator. This
is a LDO regulator which is usually used in the market.

Figure 12. Voltage regulator topology recommended by the manufacture using LM2596-ADJ

13
At this topology, we have to use R1 =1k Ohm for best quality performance and match
the ideal inpur current of the IC LM2596. Cin is chosen to be 470𝜇𝐹-50V and Cout =
220𝜇𝐹 for trasient response. The diode is required to have fast switching characteristics
so we choose Schottky Rectifier 1N5825. The coil for filter application = 68𝜇𝐻.
The output voltage is calculated by using formula:
𝑅2
𝑉𝑜𝑢𝑡 = 𝑉𝑅𝑒𝑓 (1 + )
𝑅1
At here, Vref = 1.23V so in order to create 7V at the output then R2 should be 4k7 Ohm
𝐶𝐹𝐹 is feedforward capacitor which is used to add lead compensation to the feedback
loop and increases phase margin for better loop stability. We choose the value = 470𝜇𝐹

Figure 13. Voltage regulator topology 5V using LM7805

Figure 14. Voltage regulator using LM317 topology

14
6. Protect circuit design
In case the supply source has too high or too low voltage, the system needs to be turned
off to protect the load. To meet these criteria, we choose the relay topology to switch
on and off.

Figure 15. Protect circuit topology

We use MCU to control the relay. MCU receives measured input voltage from ADC
and sends the control signal to the transistor. To isolate high input power from the output
pin of MCU, we apply a photocouplers. Diodes are used to eliminate leakage current.
Resistors values are chosen to set the transistor in cut-off or saturation region following
switch on and off signal.
Here, we choose the photocoupler PC817 which has maximum reverse voltage 6V,
maximum CE voltage is 80V.
The input current/voltage of PC817 is in range from 5-20mA/ 1.2-1.4V
𝑉𝑅1 = 3.3 − 𝑉𝐴𝐾 where 1.2 < 𝑉𝐴𝐾 < 1.4 (𝑉 )
So 1.9 < 𝑉𝑅1 < 2.1𝑉
We have 5<𝐼𝑅1 < 20𝑚𝐴 and 1.9 < 𝑉𝑅1 < 2.1𝑉
So 105 < 𝑅1 < 380
Choose R1=240 Ω
For the transistor, we choose 2N2222 which is NPN switching transistor which is
frequently used for the switching application. Maximum collector current of PC817 is
5−0.7
50mA so R2 should be larger than = 87. So, we choose R2=220 (Ohm).
50×10−3
The two diodes are 1N4007 (low voltage drop rectifier)
We also choose 3A fuse for the supply voltage for controlling and measurement system
to protect overcurrent case

7. Microcontroller Selection

15
For this project, STM32f103c8t6 will be our microcontroller of choice to control the
embedded system.

Criteria STM32 Offer


Require 2 PWM channels in total: STM32 features 4 Timers, each Timer has 4
one for boost converter and PWM channels.
another for the inverter

Microcontroller must have at least STM32 operating frequency is 72MHz, which is


4 ADCs (Scenario 1) or less than much larger than the 10kHz switching
4 but must have operating frequency.
frequency much larger than
switching frequency (Scenario 2)

Additional advantages • Has working voltage (3.3V) suitable with


other components in the designed circuit
• Working frequency match the switching
frequency of PWM for inverter and boost
converter.
• Easy to acquire in the market.
• Fairly cheap, therefore bring economical
advantage.
• Easy to program using MATLAB/Simulink
• Our team members have experience working
with this microcontroller in their previous
projects.

8. Display Device Selection


To display two stages required in this project: Run and Diagnosis. We use two simple
LEDs controlled by MCU to indicate which stage is performing in the circuit: Green
LED for Run mode and red LED for Diagnosis mode.
In addition, in order to provide the users with the best vision of how the system is
performing, LCD 16x2 is used to show different parameters of the inverters such as:
Output AC Voltage, Input DC Voltage, Output AC Frequency.

16
Figure 16. LCD 16x2

9. Button
In the system description, we have known that if the voltage in the source is too big or
too small, the relay will shut down and the whole inverter go to off mode. But if the
user wants to restart the system, he/she can easily do that by pressing the restart button.
In this design, we used IC SN7414 for fast edge performance and by doing that, noise
can also be reduced. Also, we choose this IC because the logic output voltage is in right
order with MCU STM32. In addition, there are another two button NEXT and
PREVIOUS to show different data on LCD as well.
Most CMOS, BiCMOS and TTL devices require fairly fast edges on the high and low
transitions on their inputs. If the edges are too slow, they can cause excessive current,
oscillation and even damage the device. Slow edges are sometimes hard to avoid at
power up or when using push button or manual type switches with the large capacitors
needed for filtering. Heavily loaded outputs can also cause input rise and fall time to be
out of spec for the next part down the line.
On a normal (non-Schmitt trigger) input the part will switch at the same point on the
rising edge and falling edge. With a slow rising edge, the part will switch at the
threshold. When the switch occurs, it will require current from Vcc. When current is
forced from VCC, the VCC level can drop causing the threshold to shift. When the
threshold shifts it will cross the input again causing the part to switch again. This can
go on and on causing oscillation which can cause excessive current. The same thing can
happen if there is noise on the input. The noise can cross the threshold multiple times
and cause oscillation or multiple clocking.
The solution to these problems is to use a Schmitt trigger type device to translate the
slow or noisy edges into something faster that will meet the input rise and fall specs of
the following device. A true Schmitt trigger input will not have risen and fall time
limitations.

17
Figure 17. IC SN7414 logic diagram

10. Alarm speaker


In diagnosis state, there will be alarm speaker to raise awareness of user of dangerous
situation. Here, we use buzzer PS1420P02CT which is normally utilized in alarming
application. It has some parameters as:
- Sound pressure level (min): 70dB
- Frequency: 2kHz
- Rated input voltage: 5VDC

Figure 18. Alarm speaker topology

Resistor R* is to set a suitable current for the buzzer. Following the recommendation of
the manufacturer, it should be 1000 Ohm. 2N2222 is chosen to be switching transistor
for this topology for its high transition frequency (up to 300MHz). The base current of
this transistor should be under 100mA so we choose R to be 1000 Ohm.

IV. Embedded Design & Implementation


1. Schematic & Connection Diagram
18
VOLTAGE REGULATOR INVERTER BLOCK PROTECT CIRCUIT
DRIVER BLOCK
C21 VSOURCE
340VDC

470u F1
5VDC Vline1
D 2 Q1 D 2 Q2
R25 R27 Fuse 1 - 1A
PWM1 G
5N60 PWM2 G
5N60
1 1 Vline1 U
1k 4k7 S S
3 3
L2 D2
INV(+) INV(-) LOAD (+) RL1 7 PWM1
2 VCC
5mH 5 PWM1'
U D1 1 Vline2 1N4007
L5 C2 1N4007 VB
2 7VDC
ON!/OFF 470uF 3 C3 VS
FB Inductor
Vline1 68uH LOAD (-) 1uF IN PWM1
VIN D4 C22 IN
3.3VDC SD1
1N5825 220uF C4 SD
D 2 Q3 D 2 Q4
C23 3 PWM1' G
5N60 PWM2' G 5N60 R11 INV(+) 1uF
470u 240 COM
6 1 1
U2
S 3 S 3 A C

QB1 IR2104
R12
LM2596S-ADJ K E
2N2222
PC817 1k

C1
1uF

7VDC SWITCH Vline1 U1


D3
7 PWM2
VCC
U 5 PWM2'
3 5VDC 1N4007
IN VB
C7 VS
C24 C27 1uF IN PWM2
GND

0.22u 0.1u IN
SD2
C8 SD
LOAD (-)
1uF
COM
LM7805 MCU BLOCK
IR2104

IC2 U
L3
5VDC 2 3.3V VDDA 9 3.3VDC
ADJ

IN
VDD 24 10uH 12VDC
36 3.3VDC C29
VDD
R26 48 M1 1000pF
VBAT VDD
C5 1k C6 5
0.1u 1u NRST NC
LM317 BOOT0
IN PWM3 6 PWM3
INA C30 C31
VR1 PA0_WKUP 4.7uF 0.1uF
AC VSENSE 7
320 PA1 GND
I INV PB0 18 I boost1
PA2
I LOAD 19 I boost2 IN PWM4 8 PWM4
PA3 PB1 INB
DC SENSE1 20
PA4 PB2
DC SENSE2 39 SWITCH MIC4427
PA5 PB3 C32
DC SENSE3 40 RS
PA6 PB4 1000pF
41 D0
PA7 PB5
IN PWM1 42 D1
PA8 PB6 C13 C14 C9 C10 C11 C12
IN PWM2 43 D2
PA9 PB7 4.7uF 4.7uF 1uF 10uF 1uF 10uF
IN PWM3 45 D3
PA10 PB8
IN PWM4 46 D4
R23 PA11 PB9
3.3VDC 21 D5
DC VOLTAGE SENSOR PA12 PB10 22 D6
LED RED 220 PA13 PB11 25 D7
R24 PA14 PB12 26 RST
PA15 PB13
12VDC INV 27 BUZZ C17
220
LED GREEN PB14
Vline1 28
PC13-TAMPER-RTC PB15
PC14-OSC32_IN
PC15-OSC32_OUT PD0_OSC_IN 5
X1
1uF
GND2
CURRENT SENSOR
R13 PD0_OSC_OUT 6 C18
47k IC5A 8Mhz A1 3.3VDC
4 Vcc

LM339 1 A3 3.3VDC
1uF L4
1 DC SENSE1 VSSA 8 INV(+) 1
R1 1 GND IP+ C15
VSS 23 10uH 2 Idc1 (+)
6k8 0.1uF IP+ C35
VSS 35 INV(-) 2
Vee

IP- 0.1uF
VSS 47 3 Idc1 (-)
IP-
3
STM32F103C8T6 ACS759LCB-05
ACS759LCB-20

C16
R2 1uF C36
R7 1uF
I INV
6k8 R31
I boost1
R9 1k
6k8 BOOST CONVERTER LCD Display 1k
A4 3.3VDC
A2 1
5VDC 1 3.3VDC Idc2 (+)
IP+ C37
LOAD (+) 2
IP+ C19 0.1uF
59VDC 2 Idc2 (-)
0.1uF IP-
Vline1 LCD1 LOAD (-) 3
IP-
59VDC 3
A ACS759LCB-20
R10 VDD ACS759LCB-05 C20
100k IC1A VR2 1uF
D7 D8
Vcc

L1 L7 R8
4

LM339 Vline2 340VDC 1k VSS I LOAD C38


Idc1 (+) Idc1 (-) Idc2 (+) Idc2 (-)
1 DC SENSE2 68uH 1mH 1uF
R14 1 1N4007 1N4007 1k R32
GND I boost2
2k2 K
Vee

1k

R/W
EN

D0
D1
D2
D3
D4
D5
D6
D7
RS
D 2 Q5 D 2 Q6
PWM3 G C25 PWM4 G C26
1
IRFB4110
47uF 1
2SK3667
2.2uF AC VOLTAGE SENSOR
S 3 S 3

R15 LCD16x2A

D0
D1
D2
D3
D4
D5
D6
D7
2k2
LOAD (+)
R16 3.3VDC Vline1

RS
2k2
R17 R3
10k 10k
IC3A

Vcc
R4

4
LM339
340VDC 1 AC VSENSE
R18 470 1
Vline1 5VDC
BUTTON 5VDC ALARM SPEAKER 10k LOAD (-)
R5

Vee
R28
R19 SW1 1k 100k
U3 5VDC
470k IC1B 1 2 14
LM339
SW
7 DC SENSE3 C28 2 RST
R20 2 1A R33 B1
4 +
2k2 2A 1k R6
6 NEXT PS1420P02CT
100nF R29 3A
8
SW2 1k 4A 470
10 -
5A
1 2 12 PREVIOUS
6A
SW R34 QB2
C33 7 BUZZ 2N2222
R21 R30 1k
100nF 1k SN7414N
2k2 SW3 C39 Title
R22 1 2
1uF
2k2 SW
C34 Size Number Revision
A2
100nF Date: 25-Feb-22 Sheet of
File: D:\THINH HOC\..\BTL ver30.SchDoc Drawn By:
a) Voltage Regulator

b) Inverter Block

20
c) Protection Circuit

d) Driver Block

21
e) Current Sensor

f) AC Voltage Sensor

22
g) Boost Converter

h) MCU Block

i) Button

23
k) LCD Display

24
l) DC Voltage Sensor

m) Alarm speaker

25
2. Working Principle

The working principle and overall operation of our design can be seen as follow:
• When the device is connected to the solar panel and to the appliances of
customers, the operation will be handled in Normal Mode
o In Normal Mode, if the deviation of output voltage is less than ± 2% of
nominal value (which is 220V), there will be no error and the controller
will compensate the deviation and bring the output voltage back to
intended value. Similarly, if the input voltage is larger than or equal 10V,
there will be no alteration in operation mode.
o The value “±2%” is based on the design and simulation of the limit of
our controller.
• If the deviation of voltage goes out of the ± 2% threshold, or the input voltage
drop lower than 10V, the operation mode will be shifted to the Diagnosis Mode
o In the diagnosis mode, the circuit will operate quite similar to Normal
Mode, but there will be warning in the User Interface in the form of red
LED lighting and horn. At first, the CPU will check whether the voltage
not only violate the ±2% threshold but also ±10% threshold as well. If
not, Diagnosis mode will continue until the output voltage either restore
to lower than ±2% of nominal value or exceed the ±10% limit. It is vital
for customer to pay attention to the warning on the devices and take
countermeasures. It is important to note that the “±10%” value is based
on the standard for lots of commercial appliances.
• If the output voltage goes out of ±10% range or continue to fall lower than 10V
in the Diagnosis Mode, the inverter will go into Idle Mode, in which the device
will be disconnected from the source by using the protection circuit. The
protection circuit will be controlled by MCU.
• Once disconnected, the device won’t be reconnected again automatically in any
cases. Customers will have to manually reconnect the device by pressing the
“Restart” button. However, it is important for customer to stay cautious, due to
the fact that if there is still violation of either input or output voltage after manual
reconnection, the protection circuit will disconnect the system again. Continuous
fail reconnection can damage the device.
• The LCD screen will display the output voltage, input voltage and output
frequency. LCD screen will be controlled by two buttons, in case the customer
wants to fully view all parameters.
• There will be 2 LED and 1 horn, LED green for Normal Mode, LED red and
horn for Diagnosis mode.
Note:
❖ Our device is designed as a plug-n-play Blackbox, in the fashion that customer
can only interact with the display only. No further alteration of controller
parameters or functions is allowed.

26
3. Finite State Machine

27
4. Implementation & Results

------------------------------------------------------------------------------------------------
#DEFINE RUN 0
#DEFINE DIAGNOSIS 1
#DEFINE IDLE 2
#DEFINE OUT_AC_VOL 0
#DEFINE IN_DC_VOL 1
#DEFINE OUT_AC_FREQ 2

int state1 = NORMAL;


int state2 = RUN;
int error = 0;
int caseE = 0;

int stateUI = OUT_AC_VOL;


int stateLEDsiren = NORMAL;

void unit_control()
{
while(1)
{
switch(state1)
{
case NORMAL:
RUN: run = 1; diagnosis = 0; idle = 0;
errorDetect();
if(error == 0)
{
state1 = NORMAL;
}
if(error == 1)
{
state1 = PROTECTION;
}
ctrlsignalGen();
break;

case PROTECTION:
switch(state2)
{
case DIAGNOSIS: run = 0; diagnosis = 1; idle = 0;
{
analyzeError();
if(caseE == 0)
{
critErrorHandle();
state2 = DIAGNOSIS;
}
if(caseE == 1)
28
{
state2 = IDLE;
}
break;
}

case IDLE: run = 0; diagnosis = 0; idle = 1;


{
sourceDisconnect();
while(restart == 0)
{
sourceDisconnect();
}
if(restart == 1)
{
sourceReconnect();
}
}
}
break;
}
}

void user_interface()
while(1)
{
switch(stateUI1)
{
case OUT_AC_VOL: outACvol = 1; inDCvol = 0; outACfreq = 0;
displayOutACVol();
if(Next == 0 && Previous == 0)
{
stateUI = OUT_AC_VOL;
}
if(Next == 1)
{
stateUI = OUT_AC_VOL;
}
if(Previous == 1)
{
stateUI = OUT_AC_FREQ;
}
break;

case IN_DC_VOL: outACvol = 0; inDCvol = 1; outACfreq = 0;


displayInDCVol();
if(Next == 0 && Previous == 0)
{
stateUI = IN_DC_VOL;

29
}
if(Next == 1)
{
stateUI = OUT_AC_FREQ;
}
if(Previous == 1)
{
stateUI = OUT_AC_VOL;
}
break;

case OUT_AC_FREQ: outACvol = 0; inDCvol = 0; outACfreq = 1;


displayOutACFreq();
if(Next == 0 && Previous == 0)
{
stateUI = OUT_AC_FREQ;
}
if(Next == 1)
{
stateUI = OUT_AC_VOL;
}
if(Previous == 1)
{
stateUI = IN_DC_VOL;
}
break;
}

switch(stateLEDsiren)
{
case NORMAL: normal = 1; protection = 0;
if(state1 == NORMAL)
{
stateLED = GREEN;
siren = 0;
}
if(state1 == PROTECTION)
{
stateLED = RED;
siren = 1;
}
break;

case PROTECTION: normal = 0; protection = 1;


RedLED();
if(state1 == PROTECTION)
{
stateLED = RED;
siren = 1;
}

30
if(state1 == NORMAL)
{
stateLED = GREEN;
siren = 0;
}
break;
}
}
}

void main()
{
while(1)
{
unit_control();
user_interface();
}
}
------------------------------------------------------------------------------------------------

V. Conclusion & Remark


After 4 months of hard work and continuous debugging, we have finally finished our project
“Design the Single-phase Inverter Embedded Controller for Household Appliances”. From this
project, we have been able to achieve a greater understanding into the embedded system design
as well as important points to pay attention to of the embedded programming field. Because of
that, we would like to express our sincerest thanks and appreciation to Dr. Chu Duc Viet for
his ongoing support and supervision throughout the semester.

31

You might also like