3-Phase BLDC Motor Control with Hall Sensorread.pudn.com/downloads362/ebook/1574390/3-Phase BLDC... · 2011-06-20 · similar to three-phase asynchronous motor. Since motor rotor
Post on 12-Mar-2020
3 Views
Preview:
Transcript
3-Phase BLDC Motor Control with Hall Sensor
V1.3 - Dec 22, 2006 English Version
19, Innovation First Road • Science Park • Hsin-Chu • Taiwan 300 • R.O.C.
Tel: 886-3-578-6005 Fax: 886-3-578-4418 E-mail: mcu@sunplus.com
http://www.sunplusmcu.com http://mcu.sunplus.com
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 1 V1.3 - Dec 22, 2006
Important Notice
SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information
provided by SUNPLUS TECHNOLOGY CO. is believed to be accurate and reliable. However, SUNPLUS
TECHNOLOGY CO. makes no warranty for any errors which may appear in this document. Contact SUNPLUS
TECHNOLOGY CO. to obtain the latest version of device specifications before placing your order. No
responsibility is assumed by SUNPLUS TECHNOLOGY CO. for any infringement of patent or other rights of third
parties which may result from its use. In addition, SUNPLUS products are not authorized for use as critical
components in life support systems or aviation systems, where a malfunction or failure of the product may
reasonably be expected to result in significant injury to the user, without the express written approval of Sunplus.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 2 V1.3 - Dec 22, 2006
Revision History
Revision Date By Remark Page Number(s)
V1.3 2006/12/22 Li Jing Proofreading
V1.2 2006/05/25 Li Jing Translate ‘3-Phase BLDC Motor Control with Hall Sensor V1.2, Chinese version’
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 3 V1.3 - Dec 22, 2006
Table of Content PAGE
1 Operation Principle ............................................................................................................................ 4
1.1 Summary of BLDC......................................................................................................................... 4 1.2 Basic Principle ............................................................................................................................... 4 1.3 Driving for BLDC............................................................................................................................ 5 1.4 Speed Regulation by PWM Control............................................................................................... 6
2 Hardware Design ................................................................................................................................ 8
2.1 SPMC75F2413A Application Circuit ............................................................................................ 10 2.2 IPM Module and Driver................................................................................................................ 10 2.3 Position Detecting........................................................................................................................ 13
3 PID Controller ................................................................................................................................... 14
4 Software Design................................................................................................................................ 17
4.1 Software Description ................................................................................................................... 17 4.2 Source File .................................................................................................................................. 17 4.3 DMC Interface ............................................................................................................................. 17 4.4 Subroutines ................................................................................................................................. 17
5 Demo Listing..................................................................................................................................... 20
5.1 Demo ........................................................................................................................................... 20 5.2 Main Process Description............................................................................................................ 21 5.3 ISR Description............................................................................................................................ 22
6 MCU Resource .................................................................................................................................. 23
7 Test..................................................................................................................................................... 24
7.1 Control Signals ............................................................................................................................ 24 7.2 Speed Adjustment........................................................................................................................ 26 7.3 Current Waveform ....................................................................................................................... 27 7.4 System Response ....................................................................................................................... 28
8 Reference .......................................................................................................................................... 32
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 4 V1.3 - Dec 22, 2006
1 Operation Principle
1.1 Summary of BLDC
Since current BLDC has substituted the electrical commutator for the mechanical one, it conquered the disadvantages of noise, spark, electromagnetic disturbance, short lifetime, etc. Now BLDC is provided with advantages of simple structure, dependable operation and easy maintenance as AC motor does, as well as advantages of high efficiency, no excitation cost and functional speed regulation as traditional DC motor does. Thus, it is widely used in various fields of industrial control presently.
1.2 Basic Principle
Usually, motor stator winding is three-phase symmetry star connection type which is similar to three-phase asynchronous motor. Since motor rotor is assembled with magnetized permanent magnet, in order to detect rotor polarity, a position sensor is built in motor. Motor driver, consisting of inverters and integrated circuit, is designed for: receiving start/stop/brake signals to control the motor operations; capturing position and forward/backward rotate signals to control the transistors state and make BLDC generate the continuous torque; receiving speed command and speed feedback signal to control and adjust rotate speed; protecting BLDC. The basic principle of BLDC is shown as Figure 1-1.
Figure 1-1 BLDC Control Principle
The main circuit is a typical voltage source AC-DC-AC converter. The inverters supplies a symmetrical rectangular voltage with a permanent amplitude & frequency (5 ~24 KHz). Alternating the N-S pole of permanent magnet makes the position sensor generate H1, H2 and H3 waveform with 120° phase-different, which forms six condition codes: 010, 011, 001, 101, 100, and 110. Via some logic components, these codes control to conduct V6 – V1, V5 – V6, V4 – V5, V3 – V4, V2 – V3, V1 – V2 respectively, that is, load bus of U - >V, W - >V, W - >U, V - >U, V - >W, U - >W with DC voltage in turns. Therefore, each time the rotor revolves a pole-pair, the transistors V1, V2, V3, V4, V5 and V6 are conducted one
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 5 V1.3 - Dec 22, 2006
by one according to their condition code and the magnetic field produced by stator winding rotates 60 electrical degree for that only two phases winding are loaded. Consequently, the rotor rotates 60 electrical degrees. The new position signal of rotor will be captured via the sensor to form a new set of condition codes, thus to drive the corresponding transistors, which makes the rotor rotate 60 electrical degrees further. Circulating unceasingly, BLDC will generate a continuous torque to rotate the load continuously.
1.3 Driving for BLDC
This application is designed for driving the IGBT built in IPM (Intelligent Power Module) using 120-degree waveform, thus to drive BLDC. The signals of driving IGBT are generated according to the motor position. The feedback position signal is encoded as six condition codes: 010, 011, 001, 101, 100, and 110, which can determine the assignment of IGBT driving signal. Here we add PWM signal to the upper phase and active voltage to the lower one so that we can vary the output voltage by changing the PWM duty. The timing of driving assignment and position signals are shown as Figure 1-2.
Figure 1-2 Driving and Position Signals
Where, the upper phase transistors V1, V3, V5 and the lower phase transistors V2, V4, V6 consist of a three-phase full-bridge circuit which controls the current direction of U, V, W phases which are connected as shown in Figure 1-1. H1, H2 and H3 are hall signals.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 6 V1.3 - Dec 22, 2006
If the motor is driven in forward direction as shown in Figure 1-2, the transistors are conducted as the sequence: 010 (H3 H2 H1) V6-V1, 011 (H3 H2 H1) V5-V6, 001 (H3 H2 H1) V4-V5, 101 (H3 H2 H1) V3-V4, 100 (H3 H2 H1) V2-V3, 110 (H3 H2 H1) V1-V2. Accordingly, based on the position signal, the conducting sequence of transistors when the motor rotates in backward direction can be obtained as: 001 (H3 H2 H1) V1-V2, 011 (H3 H2 H1) V2-V3, 010 (H3 H2 H1) V3-V4, 110 (H3 H2 H1) V4-V5, 100 (H3 H2 H1) V5-V6, and 101 (H3 H2 H1) V6-V1. The commutate timing should be considered carefully; otherwise, BLDC will vibrate or doesn’t work, or will have a larger current with a wrong waveform.
The control signals mentioned above control the state of transistors, thus make the current flow into the three-phase coil (U, V, W) in turn and accordingly generate rotating magnetic field within BLDC. Figure 1-3 shows the current timing of each phase.
Figure 1-3 Current Timing
1.4 Speed Regulation by PWM Control
The inverters are based on the PWM modulation, which means that they can vary the output voltage fundamental with different PWM duty, thus to control the motor speed. There are totally 4 methods to add PWM-based control: upper phase, lower phase, pre-sixty degree and post-sixty degree as shown in Figure 1-4.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 7 V1.3 - Dec 22, 2006
(a) Upper Phase PWM
(b) Lower Phase PWM
(c) Pre-sixty Degree PWM
(d) Post-sixty Degree PWM
Figure 1-4 Commutate Timing When Active High
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 8 V1.3 - Dec 22, 2006
2 Hardware Design
BLDC is widely applied in various technology fields with different control methods. This application adopts SPMC75F2413A chip equipped with a 16-bit TPM (Timer PWM Mode, TPM) timer and IPM (Intelligent Power Module) via basic driving algorithm to drive and adjust rotate speed of three-phase winding BLDC
The hardware circuit mainly contains power supply, control system, IPM and the corresponding driver, position sensors and RS232 communication module. The hardware block diagram and schematic are shown in Figure 2-1 and Figure 2-2 respectively.
Figure 2-1 System Block Diagram
In the following, we will illustrate IPM and the corresponding driver, position sensors and RS232 communication module in detail.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 9 V1.3 - Dec 22, 2006
WP
UART-TXD
MO
TO
R1-
WN
STEP-B
D22
LED
12
IC15
74HC373
111
20
256912151619
3478
13141718
OELE
VCC
1Q2Q3Q4Q5Q6Q7Q8Q
1D2D3D4D5D6D7D8D
STEP-A
MO
SI
IC16PC817
12
43
R57
5.1K
R53
1.8K
XTAL2
P+15V
ProbeSDA
C400.22uF
CON8
Probe conn
12345
Q22N3904
2
13
Drive
S1
C46100pF
P+15V
+5V
S2
UART-TXD
DRV-EN
MOTOR1-WP
UART-RXD
P+15V
HC
UR
MO
TO
R1-
VN
TSE
N1
R401K
IC8
PS21563
123456
789101112
131415161718
192021222324252627282930
31
32
33
34
35
VUFSNC
VUFBVP1NCUP
VVFSNC
VVFBVP1NCVP
VWFSNC
VWFBVP1NCWP
NCVNO
UNVN
WNFO
CFOCIN
VNCVN1NCNC
P
U
V
W
N
VVFB
IOD
7
Prob
eSD
A
Protect
CIN
VVFS
ProbeEN
MO
TO
R1-
UP
LED
3
UART-RXD
SEG
1
+5V
+5VA
VVFS
R553.9K
MOTOR1-VN
FAN-UN
IOD
4
R58
10
TSE
N1
SOFT-RELAY
R261K
AVSS
FOIN1
Q42N3904
2
13
R131
2.2K
C300.22uF
D10MUR160
12
P+5V
DRV-EN
HALL-U2
DRV-EN
WN
FO
+5
UN
FAN-UP
MO
TO
R1-
VP
RE
SET
V
ACZVC
HC
UR
UP
C550.1uF
IC29
MAX232
1
2
5
3
4
1110
129
16
6
15
147
138
C1+
Vs+
C2-
C1-
C2+
T1INT2IN
R1OUTR2OUT
VCC
Vs-
GND
T1OUTT2OUT
R1INR2IN
IPM-MW
MIS
O
MO
TO
R1-
WP
SCFO
Q52N3904
2
13
+C51LXZ-33uF/35V
+C48LXZ-33uF/35V
MOTOR1-WN
D8MUR160
12
R123
2.2K
IC11PC817
12
43
R1IN
SOFT-RELAY
C45100pF
MOTOR1-VN
VVFB
HA
LL-U
1
+C43LXZ-33uF/35V
R563.9K
Q72N3904
2
13
R353.9K
IPM-MU
VN
C500.22uF/50V
R421K
+5V
IOD
6
INFRAD
ACI-CLKB
+5V
IPM-MV
OLIN2
FAN-VP
IC14PC817
12
43
RESET
MHALL-U
C990.1uF
FAN-VN
P+15V
R4910K
C930.1uF
IC10PC817
12
43
C790.1uF
+5V
+5VA
IPM-MW
VUFS
T1OUT
SEG
4
S1SW
P+5V
MHALL-W
VWFS
R523.9K
FAN-UP
TSE
N5
UP
+5V
MOTOR1-VP
ACI-CLKC
STEP-BN
SEG
3
MO
TOR
1-U
P
VD
DL
R3310K
IC4C
74HC00_0
9
108
+5V
IPM-MV
HALL-V2
DIR-VALVE
VDDL
MO
TO
R1-
UN
Prob
eEN
P+15V
TSE
N4
VBU
S
S1
R129
3.3K
C491000pF
+5V
TSE
N2
VWFS
R513.9K
R591K
IC4D
74HC00_0
12
1311
MO
TOR
1-V
N
CON6
HALL SENSOR
12345
R271K
R373.9K
+5V
SCFO
R1IN
R61
10
VBU
S
+ C97220uF/16V
P+15V
S5
C96
20pF
1 2
+5V
FOIN1
R3210K
S6
Y16M
LED
4
FAN-WN
STEP-AN
D201N4148
12
C44100pF
N
STU-LED
TSE
N2
R4810K
R17510K
VP
HA
LL-V
1
D9MUR160
12
C390.22uF
VCC
AVSS
MOTOR1-VP
S4
UN
MOTOR1-UN
C520.22uF/50V
AVC
MD
+5V
C34100pF
FO
R45330
+C53LXZ-33uF/35V
C1050.1uF
12
R30330
+5V
CON3TO-MOTOR
123
P+5V
STU-LED
HALL-V2
MPC
LK
HALL-U2
FAN-UN
IOD
5
+5V
P+5V
MOTOR1-UN
XTAL1
R343.9K
Q62N3904
2
13
MO
TOR
1-V
P
VUFB
S3
R150220
+ C98220uF/16V
P+5V
MOTOR1-WP
FAN-VN
VDC
C540.22uF/50V
+5V
S3
C1040.1uF
12
C32100pF
FAN-WN
AVC
MD
MOTOR1-WN
MO
TOR
1-W
N
HA
LL-W
1
R29330
C1000.1uF
D213.3V
12
1206
FB260_ohm_3A_1206
HALL-W2
HAL
L-V
1
Prob
eSC
L
R251K
S2
C940.1uF
12
R3110K
P+5V
VUFB
HAL
L-W
1
CIN
N
EMGSTOP
R117
3.3K
+5V
FOIN
1
FOIN2
XTA
L1
R543.9K
IC13PC817
12
43
C1010.1uF
R393.9K
C850.1uF
SPMC75F2413A
S6
ProbeSCL
C310.22uF/50V
R363.9K
P+15V
P+5V
VWFB
S4
R601K
R62
10
C33100pF
C280.22uF
TSE
N4
MPSTE
FAN-WP
ACZVC
SEG
2
MHALL-V
VWFB
C350.22uF/50V
R411K
R122
3.3K
R503.9K
T1OUT
ACI-CLKD
TSE
N5
R4710K
Q172N3904
21
3
R14010K
UART
VP
MOTOR1-UP
C95
20pF
1 2
R383.9K
C380.22uF
R46BRP58F0.082-K
C410.022uF/50V
WP
LED
2
ACI-CLKA
1206
FB160_ohm_3A_1206
C473300pF
IC12PC817
12
43
IPM-MU
WN
OLI
N1
FOIN2
BUZZER
C290.22uF
R148100
MO
TOR
1-U
N
XTA
L2
LED
1
R149200K
C360.22uF/630VDC
HALL
+5V
FAN-VP
FO
IN1
VN
IC9PC817
12
43
Q182N3904
2
13
R43330
R118
2.2K
MOTOR1-UP
VUFS
HALL-W2
IC4B
74HC00_0
4
56
Q192N3904
2
13
HAL
L-U
1C42
0.22uF/50V
+C9210uF/16V
VDC
FAN-WP
S5
TSE
N3
DRV-EN
R44330
C370.22uF/50V
C820.1uF
P4
CONNECTOR DB9
594837261
TSE
N3
MO
TOR
1-W
P
R28330
P+5V
U1
SPMC75F2413A - QFP80
55 5354
1
52
2 3 4 5 76 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25262728293031323334353637
60 59 58 57 568
5051 49 48 47 46 45 44 43 42 41
403938
80797877767574737271706968676665
64 63 62 61
VSSL
XTA
L1X
TAL2
TEST
VDD
L
ICE
CLK
ICE
SDA
IOD
0/IC
EC
LKIO
D1/
ICE
SDA
RE
SET
IOD
2
NC
NC
IOB
0/TI
O3F
/W1N
IOB
1/TI
O3E
/V1N
IOB
2/TI
O3D
/U1N
IOB
3/TI
O3C
/W1
IOB
4/TI
O3B
/V1
IOB
5/TI
O3A
/U1
IOB
6/FT
IN1
IOB
7/O
L1IO
B8/
TIO
0CIO
B9/
TIO
0BIO
B10
/TIO
0AIO
B11
/SC
KIO
B12
/SD
I/RX
D1
IOB
13/S
DO
/TX
D1
IOB14IOB15IOD12IOD13IOD14IOD15
IOA8IOA9/TIO2A
IOA10/TIO2BIOA11/TCLKAIOA12/TCLKBIOA13/TCLKCIOA14/TCLKD
IOD
8IO
D7
IOD
6IO
D5
IOD
4IO
D3
AVSS
AVD
D
VEX
TREF
IOA
7/A
N7
IOA
6/A
N6
IOA
5/A
N5
IOA
4/A
N4
IOA
3/A
N3
IOA
2/A
N2
IOA
1/A
N1
IOA
0/A
N0
VSSVDD
IOA15/ADCTRG
IOC15/TIO4F/W2NIOC14/TIO4E/V2NIOC13/TIO4D/U2NIOC12/TIO4C/W2IOC11/TIO4B/V2IOC10/TIO4A/U2IOC9/FTIN2IOC8/OL2IOC7/TIO1CIOC6/TIO1BIOC5/TIO1AIOC4/BZOIOC3/EXINT1IOC2/EXINT0IOC1/TXD2IOC0/RXD2
NC
IOD
11IO
D10
IOD
9
+5V
IPM
C1020.1uF
12
C1030.1uF
12
IC4A
74HC00_0
1
23
Q32N3904
2
13
R17210K
IC34PC817
12
43
C1190.1uF
C1180.1uF
IC35TOP234P1 5
2 3 7 8
4
M D
S S S S
C
L1Choke
C122KX-2200pF/250VAC
CT1
+12V
T2
TR-10
1
3
4
5 6
79
10
C20X1-0.22uF/250VAC
D28P6KE200A
12
P1
N
R168470
P+5V
+ C114470uF/25V
+C23JACK-470uF/400V
D27
MUR160
1 2
EARTH
ACZVC
D30MUR160
12
D51N4148
12
P+18V
SOUT
P+18V
C19X1-0.22uF/250VAC
R191K
+5V
R170680
IC337815
1
2
3VI
GN
D
VO
VDC
R20200K,1/2W
T1CT
Q12N3904
2
1 3
C1200.1uFVDC
L3100uH
R2110K
R1660
R17451, 1W
ZNR315G471K
IC7PC817
12
43
D32
1N4148
12
CON11
VAC input
123
VCC
CT2
D311N5822
1 2
EMI
+5V
C1160.1uF
C18Y2-2200pF/250VAC
IC36TL431
23
1ROUT
SOUT
Switching Power Supply
R22470
SOFT-RELAY
+
C12133uF/35V
VDC
R167910K
R17310
+5VC25Y2-2200pF/250VAC
ROUT
SOFT-RELAYVDC
+C11747uF
R2320K
P+15V
ZNR115G471K
ZNR215G471K
C1130.1uF
R24200K
C21KH-103K/250VAC
C24224K/630VDC
D6
1N4148
1 2
C22Y2-2200pF/250VAC
+12V
P+15V
L23.3uH
R16939.2K
- +
DB1GBU6K
1
3
2
4
C270.1uF
+ C112470uF/35V
tRT1
PTC
C26100pF
SOUT
ROUT
+C110470uF/25V
+C12447uF
R1651M
C1230.1uF
IC3778L05
1
2
3VI
GN
D
VO
ZNR415G471K
D29
MUR160
1 2
D7
1N4148
12
+ C115470uF/25V
F1
10A
R1713.3K
L43.3uH
+5V/P+15V/P+5V power
RLY1
G6B-1174P-US
34
16
ACZVC
+C111470uF/25V
IC32SI-8050S
1
5
2
4
3
VIN
SS
SWOUT
VOSGN
D
C1250.1uF
L5100uH
Figure 2-2 Hardware Schematic
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 10 V1.3 - Dec 22, 2006
2.1 SPMC75F2413A Application Circuit
The SPMC75F2413A is the embedded 16-bit micro-controller, designed for inverter-fed motor driver, power electronics, home appliance and car fan control system, etc.
Figure 2-3 shows the hardware schematic of SPMC75F2413A.
Figure 2-3 SPMC75F2413A Hardware Block Diagram
Connecting the embedded In-Circuit-Emulation circuit of SPMC75F2413A via Probe can facilitate the development for user, accordingly improve the production efficiency and reduce time to market.
2.2 IPM Module and Driver
IPM (Intelligent Power Module) product is designed and developed with the advantages of reduced design, development and manufacturing costs as well as increased system reliability through self protection circuits (such as over-current, over-voltage, and over-temperature circuits) . It also supplies a solution for users to drive low-power BLDC. Figure 2-4 shows IPM electrical connections.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 11 V1.3 - Dec 22, 2006
P+15V
C410.022uF/50V
IPM-MV
CIN
IPM-MW
R53
1.8K
IPM-MU
+C43LXZ-33uF/35V
VWFB
VUFB
N
P+15V
UN
P+15V
CON3TO-MOTOR
123
C370.22uF/50V
C310.22uF/50V
IPM-MU
VN
C360.22uF/630VDC
CIN
VUFS
VVFS
IC8
PS21563
123456
789101112
131415161718
192021222324252627282930
31
32
33
34
35
VUFSNC
VUFBVP1NCUP
VVFSNC
VVFBVP1NCVP
VWFSNC
VWFBVP1NCWP
NCVNO
UNVN
WNFO
CFOCIN
VNCVN1NCNC
P
U
V
W
N
VWFS
C473300pF
R17510K
C420.22uF/50V
IPM-MW
P+15V
N
P+5V
R46BRP58F0.082-K
WN
VP
FO
VVFB
VDC
WP
IPM-MVC350.22uF/50V
VDC
UP
Figure 2-4 IPM Electrical Connections
To protect MCU, electrical isolation is done between IPM and MCU with HVDC (High Voltage Direct Current) which improves the stability and reliability of system. Figure 2-5 shows the electrical diagrams via optical isolating the drive between IPM and MCU.
Where:
IC8: IPM PS21563
C31, C35, C37: bootstrap capacitor 0.22uF/50V
C41: malfunction pulse width timing capacitor (ceramic material) 0.022uF/50V
C42: decoupling capacitor 0.22uF/50V
C43: power supply filter capacitor 33uF/35V
C47: short-circuit sampling RC filter capacitor 3300pF
R46: short-circuit current limiting resistance 0.082Ω
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 12 V1.3 - Dec 22, 2006
S2
R4810K
Q32N3904
2
13 R33
10KS1
R43330
C33100pF
IC10PC817
12
43
IC14PC817
12
43
P+5V
S5
Q62N3904
21
3
R421K
P+5V
R4710K
R411K
R30330
R383.9K
R363.9K
P+5V
S4
R4910K
Q22N3904
2
13
R523.9K
IC13PC817
12
43
+5V
IC9PC817
12
43
+5V
+5V
P+5V
C32100pF
R3110K
R44330
WPUP
Q42N3904
2
13
IC12PC817
12
43
R261KR29
330
R503.9K
+5V
R45330
WNUN
R543.9K
R3210K
R401K
C45100pF
C300.22uF
C290.22uF
R373.9K
VN
C400.22uF
R343.9K
IC11PC817
12
43
S3
R513.9K
C380.22uF
Q52N3904
2
13
C390.22uF
R28330
R563.9K
P+5V
VP
C34100pF
R553.9K
+5V
Q72N3904
2
13
S6
R353.9K
C280.22uF
R271K
P+5V
R393.9K
+5V
C46100pF
R251K
C44100pF
Figure 2-5 Optical Isolate the Drive Between IPM and MCU
Where, OC (Optical Coupler) must be connected to different power supplies in its two sides to implement electrical isolation. It is recommended to adopt quick OC, however, when the carrier wave frequency is not required too high, PC817/TLP521 OC can also be considered to reduce the cost.
Additionally, the ability of the IPM to self protect in fault situations is critical when MCU runs abnormally. Therefore, a “protect lock” is specially designed into hardware circuit. Once an error is detected, the driving signal sent to IPM will be cut off immediately and the hardware will request for IRQ to MCU at the same time. Upon eliminating the error, MCU enables the signal output bit to run IPM again. Figure 2-6 shows the hardware protection circuit.
IC4A
74HC00_0
1
23
MOTOR1-WP
MOTOR1-VN
IC15
74HC373
111
20
256912151619
3478
13141718
OELE
VCC
1Q2Q3Q4Q5Q6Q7Q8Q
1D2D3D4D5D6D7D8D
MOTOR1-VP
IC4B
74HC00_0
4
56
FO
MOTOR1-UN
IC4C
74HC00_0
9
108
S6MOTOR1-WN
+5V
FOIN1
R601K
MOTOR1-UP
SCFO
SCFO
MOTOR1-UNMOTOR1-WP
S1MOTOR1-VP
S2
C491000pF
IC16PC817
12
43
+5V
MOTOR1-WN
DRV-EN DRV-ENFOIN1
P+5V
R591K
MOTOR1-UP
MOTOR1-VN
S5S4
S3
IC4D
74HC00_0
12
1311
R57
5.1K
Figure 2-6 Hardware Protection Circuit
Where, IC15: 74HC373; IC4: 74HC00.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 13 V1.3 - Dec 22, 2006
2.3 Position Detecting
Since commutate timing of BLDC depends on rotor position which determines the next excited phase, it is important to detect the current rotor position for driving BLDC. This application selects the BLDC integrated with Hall sensor as shown in Figure 2-7.
Q182N3904
2
13
C850.1uF
+5V
R131
2.2K
R122
3.3K
C820.1uF
+5V
MHALL-W
+5V
Q192N3904
2
13
MHALL-V
R117
3.3K
Q172N3904
2
13
R118
2.2K
R129
3.3K
+5V
MHALL-U
CON6
HALL SENSOR
12345
C790.1uF
R123
2.2K
Figure 2-7 Hall Sensor
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 14 V1.3 - Dec 22, 2006
3 PID Controller
The PID controller is commonly used to adjust speed. It receives signals from sensors and computes corrective action to the actuators from a computation based on the error (Proportion), the sum of all previous errors (Integral) and the rate of change of the error (Derivative). The mathematical model of the PID controller can be represented as:
])()(1)([)(u0 dt
tdeTddtteTi
teKptt
++= ∫ (Formula 3-1)
Where:
u(t) Output of PID controller
e(t) Input of PID controller, which is the error between the desired input value and the actual output value, so called error signal.
Kp Proportional gain
Ti Integral time, also called integral gain
Td Derivative time, also called derivative gain
The mathematical model of the PID controller consists of Proportional Response, Integral Response and Derivative Response which are described as follows:
1. Proportional Response
The proportional component can be expressed as Kp*e(t).
In PID controller, the effect of controlling error depends on the proportional gain (Kp). In general, increasing the proportional gain will increase the speed of the control system response and reduce the steady-state error. However, if the proportional gain is too large, the system will begin to oscillate and become unstable. Thus, Kp must be suitably selected to keep the system stable and reduce the rise time and steady-state error.
2. Integral Response
The integral component can be expressed as∫t
dtteTiKp
0)(
.
From the expression shown above, we can see that the integral component sums the error term over time. The result is that even a small error term will cause the integral component to increase slowly. The integral response will continually increase over time unless the error is zero, so the effect is to drive the Steady-State error to zero.
But the integral control will reduce the speed of the overall control system response and increase the overshoot. Increasing the integral gain (Ti) will cause the integral component to accumulate weakly and reduce the overshoot, thus it will make system not oscillate during the rising time, therefore improve its stability. However, it will slow the
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 15 V1.3 - Dec 22, 2006
process of eliminating Steady-State error. Reducing Ti will strengthen the accumulation of integral component and shorten the time of eliminating error, but it will make the system oscillate. So Ti should be selected according to the practical needs.
3. Derivative Response
The derivative component can be expressed as dttdeTdKp )(*
.
The effect of derivative component depends on the derivative time constant (Td). In general, the larger Td, the better the effect to restrain the change of e(t) and vice versa. Thus, to select Td properly can make the derivative component better meets the system requirement.
The appearance of computer makes it easy to perform PID control by software to realize the control of Formula 3-1 is called digital PID control.
Since software control method uses sampling, which calculates the control signals based on the error at the sampling point, the signal cannot be output serially as analog control method does. Therefore, the integral and derivative components must be discrete.
])1()()()([)(1 T
kekeTdjeTiTkeKpku
k
j
−−++= ∑
=
(Formula 3-2)
Where:
K Sampling number, k=0, 1, 2 …
Uk Output value sampling at the K times
ek Error sampling at the K times
∑=
k
j
je1
)( Accumulative error sampling from the first time to the k times
T Sampling period
In Formula 3-2, make )1()()( −−=∆ kekeke
Thus:
)]()()([)k(u1
keTTdje
TiTkeKp
k
j
∆++= ∑=
(Formula 3-3)
In the above formula, let TiKpKi /= , TdKpKd *=
Thus:
)()(*K)(*)(1
keTKdjeTikeKpku
k
j
∆++= ∑=
(Formula 3-4)
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 16 V1.3 - Dec 22, 2006
To avoid calculating ∑ (the sum of errors), the recursion formula ( ) of
increment PID algorithm is instead in practice where=
k
j
je1
)( )(u t∆
)1(u)(u)(u −−=∆ kkk .
Since
)1()(*K)1(*)1-k(u1
1
−∆++−= ∑−
=
keTKdjeTikeKp
k
j
(Formula 3-5)
And
)1()()( −−=∆ kekeke
)2()1()1( −−−=−∆ kekeke
Thus:
)]2()1(2)([)(**K)]1()([)k(u −+−−++−−=∆ kekekeTKdkeTikekeKp
(Formula 3-6)
Formula 3-6 can also be transformed as:
)]2()1(2)([)()]1()([)k(u −+−−++−−=∆ kekekeTTdke
TiTkekeKp
(Formula 3-7)
A closed loop control system puts the regulator under pure proportion function, then changes the proportional gain from small to large to make the system oscillate continuously. The current proportional gain is called the critical gain Ku and the time interval between two neighboring peaks is called critical oscillation period Tu.
Based on Z-N tuning method:
TuT 1.0=
TuTi 5.0=
TuTd 125.0=
Thus:
)]2(25.1)1(5.3)(45.2[)k(u −+−−=∆ kekekeKp (Formula 3-8)
Obviously, the constant Kp is easy to be corrected using above formula.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 17 V1.3 - Dec 22, 2006
4 Software Design
4.1 Software Description
This application is designed for driving BLDC using 120-degree upper phase PWM waveform via hall sensor and adjusting motor speed by PID controller. Here we use SPMC75F2413A as an example for demonstration purpose.
4.2 Source File
File Name Function Type
Main Initialize parameters for driving BLDC, monitor BLDC running status (which is also performed in interrupt subroutine)
C
ISR Start up, run, protect BLDC and adjust its speed C
Spmc75 _BLDC_V100 Functions for driving BLDC lib
Spmc75_dmc_lib_V100.lib DMC communication program lib
4.3 DMC Interface
Speed1_Cmd: Set the rotate speed of motor
Speed1_Now: Feedback the current rotate speed of motor
User_R0: Current value in P_TMR3_TGRA
User_R1: Error between the desired speed and the actual speed
Motor 1 Start and Motor 1 Stop: Start/Stop the motor
4.4 Subroutines
Spmc75_System_Init ( )
Prototype void Spmc75_System_Init(void)
Description Initializations for I/O, PDC, MCP, CMT, Fault, PID and DMC
Input Arguments None
Output Arguments None
Head File Spmc75_BLDC.h
Library File Spmc75_BLDC_V100
Note Initialize the resources occupied:
PDC: Timer0; MCP, Fault: Timer3; CMT: CMT0; I/O enable: IOB14; DMC communication interface: UART2 (IOC0-RXD/IOC1-TXD)
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 18 V1.3 - Dec 22, 2006
Example Spmc75_System_Init();
BLDC_Motor_Startup ( )
Prototype void BLDC_Motor_Startup (void)
Description BLDC start-up ISR
Input Arguments None
Output Arguments None
Head File Spmc75_BLDC.h
Library File Spmc75_BLDC_V100
Note Call this subroutine when BLDC starts up or runs at quite a lower speed. It is recommended to call it in TCV interrupt of IRQ1
Example BLDC_Motor_Startup();
BLDC_Motor_Normalrun ( )
Prototype void BLDC_Motor_Normalrun (void)
Description BLDC running ISR
Input Arguments None
Output Arguments None
Head File Spmc75_BLDC.h
Library File Spmc75_BLDC_V100
Note Call this subroutine in PDC interrupt of IRQ1 to keep BLDC run normally (including position detection, commutation and speed calculation).
Example BLDC_Motor_Normalrun ();
BLDC_Motor_Actiyator ( )
Prototype void BLDC_Motor_Actiyator(void)
Description BLDC speed control including charging IPM, moving filter, PID adjustment and PWM amplitude limiting.
Input Arguments None
Output Arguments None
Head File Spmc75_BLDC.h
Library File Spmc75_BLDC_V100
Note This subroutine is critical to adjust BLDC speed. It is recommended to call this subroutine periodically using timer interrupt (512Hz). The calling frequency is determined by the highest speed of motor.
Example BLDC_Motor_Actiyator ();
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 19 V1.3 - Dec 22, 2006
BLDC_Run_Service ( )
Prototype void BLDC_Run_Service(void)
Description Monitor BLDC running status
Input Arguments None
Output Arguments None
Head File Spmc75_BLDC.h
Library File Spmc75_BLDC_V100
Note This subroutine responds for detecting and receiving the start-up/stop command, which can be called in main loop or timer interrupt within 10KHz.
Example BLDC_Run_Service();
IPM_Fault_Protect ( )
Prototype void IPM_Fault_Protect(void)
Description External fault protection
Input Arguments None
Output Arguments None
Head File Spmc75_BLDC.h
Library File Spmc75_BLDC_V100
Note This subroutine which must be called by IRQ0, is designed for protecting BLDC. Once an external fault input signal occurs, interrupt will generate when the output pins are set to high-resistance state.
Example IPM_Fault_Protect();
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 20 V1.3 - Dec 22, 2006
5 Demo Listing
5.1 Demo
/*=============================================*/ // Application Note /*=============================================*/ #include "Spmc75_regs.h" #include "Spmc_typedef.h" #include "unspmacro.h" #include "Spmc75_BLDC.h" main() P_IOA_SPE->W = 0x0000; P_IOB_SPE->W = 0x0000; P_IOC_SPE->W = 0x0000; Spmc75_System_Init(); // Spmc75 system initialization while(1) BLDC_Run_Service(); // Status Monitor NOP(); //================================================================= // Description: IRQ0 interrupt source is XXX,used to XXX // Notes: Error Protection //================================================================= void IRQ0(void) __attribute__ ((ISR)); void IRQ0(void) IPM_Fault_Protect(); //================================================================= // Description: IRQ1 interrupt source is XXX,used to XXX // Notes: BLDC start up and running service //================================================================= void IRQ1(void) __attribute__ ((ISR)); void IRQ1(void) /*=============================================================*/ // Position detection change interrupt /*=============================================================*/ if(P_TMR0_Status->B.PDCIF && P_TMR0_INT->B.PDCIE) BLDC_Motor_Normalrun(); /*=============================================================*/ // Timer Counter Overflow
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 21 V1.3 - Dec 22, 2006
/*=============================================================*/ if(P_TMR0_Status->B.TCVIF && P_TMR0_INT->B.TCVIE) BLDC_Motor_Startup(); P_TMR0_Status->W = P_TMR0_Status->W; //================================================================= // Description: IRQ6 interrupt source is XXX,used to XXX // Notes: DMC receives ISR //================================================================= void IRQ6(void) __attribute__ ((ISR)); void IRQ6(void) if(P_INT_Status->B.UARTIF) if(P_UART_Status->B.RXIF) MC75_DMC_RcvStream(); if(P_UART_Status->B.TXIF && P_UART_Ctrl->B.TXIE); /*==================================================================== Description: IRQ7 interrupt source is XXX,used to XXX Notes: 512Hz timing interrupt for adjusting speed by PID controller ====================================================================*/ void IRQ7(void) __attribute__ ((ISR)); void IRQ7(void) if(P_INT_Status->B.CMTIF) if(P_CMT_Ctrl->B.CM0IF && P_CMT_Ctrl->B.CM0IE) BLDC_Motor_Actiyator(); P_CMT_Ctrl->W = P_CMT_Ctrl->W;
5.2 Main Process Description
Main program performs the system initializations, and ISR routines respond for the real time motor operations. The ISR include: input/output error interrupt (IRQ0), PDC and TCV interrupt (IRQ1), UART RXD interrupt (IRQ6) and CMT0 timer interrupt. Figure 5-1 flow charts the main loop.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 22 V1.3 - Dec 22, 2006
Figure 5-1 BLDC Main Process
5.3 ISR Description
Fault input, output short circuit, PDC, TCV, RXD and CMT0 interrupt routines help to control BLDC starting, working, speed adjusting and fault protection. These interrupt sources have been configured in the system initialization routines. Figure 5-2 shows the interrupt operation process of PDC and TCV for your reference.
Figure 5-2 PDC and TCV Interrupt
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 23 V1.3 - Dec 22, 2006
6 MCU Resource
CPU Type SPMC75F2413A Package QFP80-1.0
crystal Frequency 6MHz Oscillator
external Input frequency
WATCHDOG Enable Disable
IOB[0-5] MCP3: BLDC control
IOB6 Motor drive external fault input
IOB[8-10] Hall sensor interface for position detection
IOC[0-1] UART RXD2, TXD2
IO
Other IOs Main control /GND
PDC0 Motor position detection
MCP3 Generate waveform by driving BLDC motor Timer
CMT0 System clock
FTIN1(IRQ0) External fault protection
PDC0(IRQ1) Motor start-up and running normal control
MCP3(IRQ3) Motor driving waveform control
UART(IRQ6) DMC controls UART communication
Interrupt
CMT0(IRQ7) BLDC speed adjustment
ROM 6.15K Words
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 24 V1.3 - Dec 22, 2006
7 Test
This test is aimed to use 120-degree upper phase PWM waveform to drive BLDC with hall sensor and adjust motor speed by PID controller.
Test contents:
Six phase output signals
WN2: IOB0/W1N
VN6: IOB1/V1N
UN4: IOB2/U1N
W5: IOB3/W1
V3: IOB4/V1
U1: IOB5/U1
Three phase hall input signals
H3: IOB8/TIO0C
H2: IOB9/TIO0B
H1: IOB10/TIO0A
7.1 Control Signals
The relationship between control signal and position feedback signal is available through theoretical analysis and practical operation. Figure 7-1 shows the 120-degree upper phase PWM waveform when the motor is driven in forward direction and Figure 7-2 shows that in backward direction.
Figure 7-1 120-degree Upper Phase PWM Waveforms When the Motor Is Driven in Forward Direction
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 25 V1.3 - Dec 22, 2006
From the waveform, we can see that when the motor is driven in forward direction, the corresponding relationship between position detection and control signals can be obtained as: 010 (H3 H2 H1) V6-V1, 011 (H3 H2 H1) V5-V6, 001 (H3 H2 H1) V4-V5, 101 (H3 H2 H1) V3-V4, 100 (H3 H2 H1) V2-V3, 110 (H3 H2 H1) V1-V2.
Figure 7-2 120-degree Upper Phase PWM Waveform When the Motor Is Driven in Backward Direction
From the waveform, we can see that when the motor is driven in backward direction, the corresponding relationship between position detection and control signals can be obtained as: 001 (H3 H2 H1) V1-V2, 011 (H3 H2 H1) V2-V3, 010 (H3 H2 H1) V3-V4, 110 (H3 H2 H1) V4-V5, 100 (H3 H2 H1) V5-V6, 101 (H3 H2 H1) V6-V1.
The SPMC75F2413A chip is dedicated to drive motor which can generate various driving signals such as pre-sixty degree PWM waveform shown in Figure 7-3. Here we simply demonstrate a possible design idea and give a reference for user’s further application.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 26 V1.3 - Dec 22, 2006
Figure 7-3 Pre-sixty Degree PWM Waveform
7.2 Speed Adjustment
As mentioned above, BLDC speed is adjusted by PID controller which can vary the output voltage fundamental with different PWM duty, thus to control the motor speed. Figure 7-4 and Figure 7-6 respectively depict the waveforms when BLDC runs at 1000rpm and 3200rpm.
Figure 7-4 PWM Waveform (1000rpm)
From the waveform, we can see that when BLDC runs at 1000rpm: Hpwm=22us, Lpwm=102us. Thus PWM duty can be calculated as: Dpwm=Hpwm/ (Hpwm+Lpwm)*100%=22us/124us*100%=17.74%.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 27 V1.3 - Dec 22, 2006
Figure 7-5 PWM Waveform (3200rpm)
From the waveform, we can see that when BLDC runs at 3200rpm: Hpwm=94us, Lpwm=32us. Thus PWM duty can be calculated as: Dpwm=Hpwm/ (Hpwm+Lpwm)*100%=94us/126us*100%=74.6%.
7.3 Current Waveform
Figure 7-6 is current waveform tested via current probe during BLDC running. The test conditions are: small load, low current, and 6 KHz PWM carrier waveform.
Figure 7-6 Current Waveform
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 28 V1.3 - Dec 22, 2006
7.4 System Response
As described in Chapter 3, in order to correct system response, the only thing to do is to chang Kp. Following depicts the system response curves when Kp is set as different values.
Figure 7-7 shows the steady-state characteristic test curve at Kp= 0.385. Obviously, the system oscillates when the rotate speed is low (1000rpm) and has a long duration during rising time (1000rpm ~1500rpm).
Figure 7-7 Steady-State Characteristic Test
Figure 7-8 shows the step response curve at Kp= 0.225 when the rotate speed ranges from 0rpm to 2000rpm.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 29 V1.3 - Dec 22, 2006
Figure 7-8 Step Response(0rpm ~ 2000rpm)
From above, we can estimate the overshoot using the formula: σ= (Cmax-C∞) / C∞ * 100%, here σ=230rpm/2000rpm * 100% =11.5%.
Figure 7-9 shows the step response curve at Kp= 0.225 when the rotate speed ranges from 2000rpm to 3500rpm.
Figure 7-9 Step Response (2000rpm ~ 3500rpm)
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 30 V1.3 - Dec 22, 2006
Additionally, steady-state error must be considered into the speed feedback system. Figure 7-10 shows the steady-state error curve when the rotate speed is 1000rpm, where steady-state errorδ=(C (t)-C∞) / C∞ * 100% < ±10/1000 * 100%=1%.
Figure 7-10 Steady-State Error when the Rotate Speed is 1000rpm
Figure 7-11 shows the steady-state error curve when the rotate speed is 3000rpm, where steady-state error δ=(C (t)-C∞) / C∞ * 100% < ±12/3000 * 100%=0.4%.
Figure 7-11 Steady-State Error when the Rotate Speed is 3000rpm
Figure 7-12 shows the step response curve at Kp=0.225 when the rotate speed ranges from 1000rpm to 3000rpm. We can see that the overshoot is always zero and no oscillation occurs. But the error (C (t)-C∞) is always higher than 150rpm irrespective of whether the rotate speed is lower or higher.
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 31 V1.3 - Dec 22, 2006
Figure 7-12 Step Response (1000rpm ~ 3000rpm)
3-Phase BLDC Motor Control with Hall Sensor
© Sunplus Technology Co., Ltd. PAGE 32 V1.3 - Dec 22, 2006
8 Reference
【1】SUNPLUS. SPMC75F2413A Programming Guide V1.0. Oct 12 2004.
【2】 Zhang Chen. BLDC Fundamentals and Applications (Version 2). China Machine Press.
【3】Yu Yongquan, Zeng Bi. Fuzzy Logic Control Based on MCU. Beijing University of Aeronautics and Astronautics Press.
top related