Project Embedded System - Design Industrial DC Motor Controller
Project Embedded System - Design Industrial DC Motor Controller
Project Embedded System - Design Industrial DC Motor Controller
DC Motor Controller
Embedded Control System Design
Group 1:
Đoàn Đức Cương – 20181864
Vũ Minh Châu – 20181862
Phạm Ngọc Đạt – 20181870
Nguyễn Thành Nam – 20181909
Hanoi, 2022
1. Specifications
- Able to control 24V 120W DC motor
- Supply voltage: 24V
- Input:
- 3 LEDs
2
2. Architecture Design
Block diagram
- Power block: regulates the voltage, supplies power to components in the circuit, protects circuit
against reverse polarity
- Input block: Isolates inputs and components inside the controller, makes the input voltage suitable for
MCU
- H-bridge: Controls the speed and direction of rotation of the motor, protects the circuit against
overload and reverse polarity generated from motor
3
Power block:
Input block:
4
H-bridge
Current sensor:
Relay output:
5
LCD and LED:
6
Transceiver:
4. Detailed Design
3.1. Display block
- LCD 1602: 5V
- LEDs: 5V
7
Overview of power block
8
+ MOSFET IRF9540: Max drain to source voltage is -100V, much larger than 24V; max drain
current is -19A
+ Diode 1N4740: Nominal Zener voltage is 10V, smaller than gate-source voltage of MOSFET
(20V)
The power not delivered to the load is lost as heat in LDO, LDO is inefficient when input voltage
is much greater than the voltage needed for the components. To lower the voltage, a switching
converter is more efficient as the input voltage is 24V and the components in the circuit need around
3,3-5V
After the voltage is lowered, LDO can be used for better noise management
- Isolator B0505S/D:
+ Output voltage: 5V
9
- Isolator B1212S/D:
𝑉𝑉𝑜𝑜𝑜𝑜𝑜𝑜 = 5𝑉𝑉
𝑉𝑉𝐹𝐹𝐹𝐹 = 0,8𝑉𝑉
𝑅𝑅𝐵𝐵𝐵𝐵𝐵𝐵 = 10𝑘𝑘Ω
→ 𝑅𝑅𝑇𝑇𝑇𝑇𝑇𝑇 = 52500Ω ~ 52,3𝑘𝑘Ω
Inductor
0,22𝑉𝑉 𝑉𝑉𝑜𝑜𝑜𝑜𝑜𝑜 𝑉𝑉𝑜𝑜𝑜𝑜𝑜𝑜 5
= → 𝐿𝐿 = = = 22𝜇𝜇𝜇𝜇
𝜇𝜇𝜇𝜇 𝐿𝐿 0,22 0,22
10
3.2.3. Low-drop regulator
11
3.3.1. Digital inputs
According to the datasheet, 𝑅𝑅𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆 = 562Ω, 𝑅𝑅𝑇𝑇𝑇𝑇𝑇𝑇 = 1𝑘𝑘Ω is recommended if maximum threshold
voltage required is around 11V
12
The transfer characteristics of this amplifier are shown in Fig. 7.
The input stage consists of a servo amplifier, U1, which controls the LED drive current. The servo
photodiode is operated with zero voltage bias. This is accomplished by connecting the photodiodes
anode and cathode directly to U1’s inverting and non-inverting inputs. The characteristics of the servo
amplifier operation are presented in Fig. 7a and Fig. 7b. The servo photocurrent is linearly proportional
to the input voltage, IP1 = Vin/R1. Fig. 7b shows the LED current is inversely proportional to the servo
transfer gain, IF = IP1/K1. The servo photocurrent, resulting from the LED emission, keeps the voltage at
the inverting input of U1 equal to zero. The output photocurrent, IP2, results from the incident flux
supplied by the LED. Fig. 7c shows that the magnitude of the output current is determined by the output
transfer gain, K2. The output voltage, as shown in Fig. 7d, is proportional to the output photocurrent
IP2. The output voltage equals the product of the output photocurrent times the output amplifier’s
trans resistance, R2
𝑉𝑉𝑜𝑜𝑜𝑜𝑜𝑜 𝐾𝐾2 × 𝑅𝑅2
=
𝑉𝑉𝑖𝑖𝑖𝑖 𝐾𝐾1 × 𝑅𝑅1
Equation above shows that the composite amplifier transfer gain is independent of the LED forward
current. The K2/K1 ratio reduces to IL300 transfer gain, K3. This relationship is included in equation
below. This equation shows that the composite amplifier gain is equal to the product of the IL300 gain,
K3, times the ratio of the output to input resistors.
𝑉𝑉𝑜𝑜𝑜𝑜𝑜𝑜 𝐾𝐾3 × 𝑅𝑅2
=
𝑉𝑉𝑖𝑖𝑖𝑖 𝑅𝑅1
IP1, resulting from the peak input signal swing. This current is the product of the LED drive current, 𝐼𝐼𝐹𝐹 ,
times the servo transfer gain, K1. For this example, the Iout max is equal to the largest LED current signal
swing, i.e., 𝐼𝐼𝐹𝐹 = 𝐼𝐼𝑜𝑜𝑜𝑜𝑜𝑜 𝑚𝑚𝑚𝑚𝑚𝑚 .
13
determining the value of the trans resistance, R2, of the output amplifier. R2 is set by the composite
voltage gain desired, and the IL300’s transfer gain, K3. Given K3 = 1.0 and a required
Vout/Vin = G = 1.0,
LM2901
3.4. H-bridge
Topology
Using boost trap ic to stabilize the voltage at the gate of the mosfet. In our project we use driver ir2184
to control 4 mosfet.
14
- Max source current: 21A >> 5A
To make sure the switching operation of the MOSFETs are safe from short-circuit, we use IC IR2184 to
create a delay.
+ Sensitivity = 10mV/A
+ 200kHz Bandwidth
15
3.6. Output block
PC817
The forward voltage across the infrared LED with a forward current of 4mA should be about 1,2V, which
means 3,3 – 1,2 = 2,1V should be developed across Ri
3.7. Microcontroller
- Requirements:
+ Number of I/O pins: 38 (8 for LCD, 3 for LED, 2 for sensors, 12 for decoder, 3 for input, 2 for
outputs, 4 for H-bridge, 4 for communication)
+ Simultaneous-Sampling ADC
+ 2x12-bit DAC
+ 38 I/Os
16
3.8. Quadrature decoder
HCTL2032
3.9. Communication
17
4. Finite State Machine
Variables:
r - the direction of rotation (r = 1 => change the direction of rotation)
s - the desired speed
cs - the current speed
p - the state of motor on/off (p = 1 for on, p = 0 for off).
States:
ILDE – the motor remain current state before receiving different signals
STOP – the motor stop (p = 0)
SPEED UP – when s > cs, the motor speed up to get the desired speed
SPEED DOWN – when s < cs, the motor speed down to get the desired speed
CHANGE DIRECTION – the motor change the direction of rotation
Code Template:
#define STOP 0
#define IDLE 1
#define SPEEDUP 2
#define SPEEDDOWN 3
#define CHANGEDIRECTION 4
void Dcmotorcontrol() {
int state = STOP;
18
while (1) {
switch(state) {
STOP: p = 0; r = 0;
if (p == 1) {state = IDLE;}
break;
IDLE: p = 1; r = 0;
if (p == 0) {state = STOP;}
if (s > cs) {state = SPEEDUP;}
if (s < cs) {state = SPEEDDOWN;}
break;
SPEED UP: p = 1; r = 0;
if (p == 0) {state = STOP;}
if (!(s > cs)) {state = IDLE;}
break;
SPEED DOWN: p = 1; r = 0;
if (p == 0) {state = STOP;}
if (!(s > cs)) {state = IDLE;}
break;
CHANGE DIRECTION: p = 1; r = 1;
if (r == 0) {state = IDLE;}
break;
}
}
}
19