You are on page 1of 23

Motor Control - Brushless DC Motor Control

AN2227
Author: Andrey Magarita
Associated Project: Yes
Associated Part Family: CY8C27xxx
GET FREE SAMPLES HERE
Software Version: PSoC Designer™ 4.2
Associated Application Notes: AN2170

Application Note Abstract


The Application Note demonstrates a PSoC® implementation of brushless direct current (BLDC) motor control using sensor-
less, back-EMF technology.

The motor driver has the following features:


Introduction Reliable motor start with and without load;
BLDC motors are widely used in industrial applications,
home appliances, and vehicle systems. Such motors Stable operation when the load on the drive shaft
consist of a multi-pole permanent magnet placed on the changes;
rotor and several windings [1].
Rotation speed stabilization with power supply and
Various methods can be employed to control the BLDC
load fluctuations;
motor. The simplest way is to use rotor position sensors.
The sensors can be optical, magnetic (Hall effect or
Overload protection;
magneto-resistance, effect-based) or inductive. However,
sensors increase cost and add reliability problems in Runtime rotation speed control using preset speed
motors operating in harsh environments where demands tables;
for sensor robustness are high. The increasing power of
embedded computing, coupled with lower prices for power Error diagnostics and recovery after failures.
semiconductors and microcontrollers, has allowed for
more sophisticated methods of motor control. One popular A distinctive feature of this driver is its use of three
technique is to use a back-electromagnetic force (back- PSoC™ mixed-signal array low-pass filters (LPFs), built
EMF) signal, which is induced by revolving the rotor around PSoC’s switched capacitor (SC) blocks. These
permanent magnet around the drive coils. filters are second-order Bessel filters and used for phase
delay in the drive phase switching mechanism, generating
This Application Note describes how a BLDC motor driver the optimal torque on the motor shaft.
can be built using back-EMF sensing.
The proposed project uses a 75W BLDC motor with a
nominal 220V power supply. However, the project can be
adapted to motors with 12-, 24-, 48- or 120-volt power
supplies; only the phase voltage resistive divider and the
motor coil level translators (frequently named coil drivers)
must be adapted to specific motors. Table 1 lists the main
characteristics of a motor driver.

October 14, 2004 Document No. 001-33760 Rev. ** 1

[+] Feedback
AN2227

Table 1. Driver Specifications For simplification, the driver status display LEDs and
speed setting switches are omitted.
Parameter Value Only a detailed view of the driver is provided in Figure 1.
Number Phases 3
Power modules are fairly simple and not examined here.
The driver consists of a bridge chip driver for the IGBT
Input Voltage 220V AC ±20% transistors and a current sense resistor for measuring
current, which is proportional to the total bridge-arms
Output Power 100W current. The IGBT level translator converts the logic level
signals from the PSoC (control bridge bus), into levels
Max Output Current 3.5A
suitable for driving the IGBT bridges’ low and high sides.
Output Signal Frequency: The International Rectifier IR2130 chip is used as the
Minimum 50 Hz IGBT driver. This chip has elements to protect the bridge
Maximum 120 Hz transistors from overcurrent conditions, a low-power
voltage output stage, and internal dead time control. Such
BLDC, Sensor- features let the PSoC concentrate its resources on motor
Motor
less
control and react only when a complex DriverFault event is
Motor Pole Pairs 4 raised by the IR2130. Lower cost drivers can be used by
integrating these features into the PSoC device.

Driver Flowchart
The driver flowchart is shown in Figure 1. The power
circuit includes:

AC input line noise filter,

AC line LC filter,

AC mains rectifier,

A step-down regulator to produce regulated 15V and


5V electronic supplies (not shown on the flowchart),

A three-phase power bridge with a level translator to


control the bridge using low-power digital signals.

October 14, 2004 Document No. 001-33760 Rev. ** 2

[+] Feedback
AN2227

Figure 1. BLDC Motor Driver Flowchart


3-phase Power Bridge

BLDC
Motor

AC Bus DC Filter DC Bus N


Input Filter
and Rectifier S

Control Bridge Bus

Driver Fault

AGND

Comp phase A LPF phase A

CPU Core MUX

Comp phase B LPF phase B

MUX

Comp phase C LPF phase C

MUX
PWM Generator
COMP
1.5 - 5 kHz
+
- Internal Ref

PSoC

Duty Cycle Conpensation

The device handles the following signals from the power LPFs serve two functions. The first is to generate the
driver circuit: necessary phase delay for the motor phase voltages.
Thirty degrees is optimum for motor operation in this
Three voltage signals that are proportional to the application. The second function is to filter the phase
output phase voltage of the IGBT driver. voltage from the PWM frequency to generate a signal
wave, which is close to sinusoidal. When the filtered signal
The voltage signal, which is relative to the DC bus crosses AGND, the internal comparator triggers and a
voltage. This signal is the PSoC analog ground falling or rising edge signal is determined. At runtime, the
(AGND). The resistive divider attenuates this signal to awaiting edge type and queried phase channel are
double the phase signals. determined in firmware. The comparator toggle initiates
the interrupt, which is handled in the firmware.
Driver fault signal, which indicates that at least one
fault event has occurred. The PWM generator forms the pulse-with modulated
signal for high side bridge. The low side is controlled by
The phase voltage signals enter the LPFs. Their cutoff constant, clear logic levels.
frequency is three times higher than the phase switching
frequency generated by the motor driver.
The PSoC analog blocks process the phase voltages.
As mentioned above, PSoC's AGND is floating and
proportional to half the DC bus voltage, which is the
rectified and filtered AC main voltage.

October 14, 2004 Document No. 001-33760 Rev. ** 3

[+] Feedback
AN2227

The bridge high side PWM signal-routing is routed through The main tasks of PSoC are to detect the position of the
an internal, firmware-controlled de-multiplexer. Note that rotor using the generated voltage and to perform the
the divided phase voltages are non-symmetric relative to phase switching in such a way that the new driving phase
AGND. This results in a strong influence when a small assists rotor revolution in the desired direction. This is the
PWM duty cycle is set. To resolve this, a single main condition of motor rotation stability.
compensation voltage is added simultaneously to the three
phase signals. This voltage is inversely proportional to the At first glance, a simple comparator on each phase is
PWM duty cycle and is generated by inverting and filtering enough for proper operation. But back-EMF voltage has a
the PWM output signal. more complex waveform, as shown in Figure 6 in
Appendix D. In Figure 6, the PWM induced noise from
DC bus voltage monitoring is implemented using the neighboring windings can clearly be seen because the
programmable voltage window comparator. If the voltage back-EMF winding is not loaded.
value on the DC bus (which powers the bridge high side)
is above or below preset values, an interrupt is generated. There are a couple of ways to separate the back-EMF
This stops the motor, prohibiting operation in unsafe signal from unwanted noise. The first way is to use low-
regions. If necessary, the analog-to-digital converter pass filtering to suppress the PWM-induced noise. The
(ADC) can be used to monitor the DC bus voltage. second method is to perform the phase voltage analysis
when the PWM signal is inactive and the transient process
of the winding is complete. This method is suitable for low
Device Schematic PWM duty cycle values or for low-power motors, where
Device schematics are shown in Appendix A. inductive/capacitance cross coupling between coils is
weak. The first method for noise suppression works well
The device has three elements. The power element when it is implemented using PSoC LPFs. After filtering,
includes: the signal can easily be compared to a reference signal.

Supply-Line Filter All filters have phase delay. This delay depends on the
signal frequency. Thus, the moment of windings
Rectifier commutation is changed at the same time as rotor
revolution frequency. This can cause a loss of back-EMF
DC Bus Filter signal synchronization or large torque ripples. Two
solutions for this problem are:
IGBT Transistor Bridge 1. Use the phase correction filter, analog or digital, to
provide near-constant phase delay in the operational
Voltage Converter for Low-Voltage Parts Supply frequency range.
The second element includes the IR2130 driver and 2. Apply the tunable conventional switched capacitor-
dividers for the phase voltages. The third element contains based filter.
the PSoC chip and speed selector. The speed selector is
made with opto-couplers (which perform the galvanic The first approach requires using complicated analog
isolation and are connected in parallel with DIPswitches circuits or a more expensive DSP core for multi-channel
for manual speed control) for external speed control. The signal processing. Such firmware must continuously read
three LED indicators display alarm events. These three and process triple ADC conversions in real-time. There are
parts are presented as three different circuit boards to other tasks for the drive controller, such as speed control.
provide better flexibility for specific motor applications. This makes the first approach difficult to implement with
low-cost microcontrollers. The second approach requires
external reconfigurable filters when conventional
Device Operation Details microcontrollers are used. This increases the driver price
As mentioned above, the motor control system uses the and complicates the circuit. However, PSoC has many
sensor-less back-EMF technique. The motor winding firmware-controlled filters inside. Therefore, the best
functions operate as position sensors during rotor rotation. solution is to use the tunable LPF approach. This gives the
To accomplish this, the winding, working in sensor-position optimal combination of price, quality, and complexity.
mode, is disconnected from the line supply. An Induced
voltage is generated on the winding by the revolving
magnet on the motor rotor. The sign and direction of the
voltage change indicates the rotor pole location relative to
fixed stator windings.

October 14, 2004 Document No. 001-33760 Rev. ** 4

[+] Feedback
AN2227

The phase-delay filters can be placed in three PSoC are the bridge branch control voltages. UP is the upper
columns and the built-in comparators can be used for (high side) branch. DOWN is the lower (low side) branch.
output signal-crossing detection. Bessel filters are A high level denotes the “on” state and a low level denotes
preferred since they provide linear phase delay versus the “off” state). INT is the interrupt signal on the phases.
frequency up-to-a cutoff point. The filter phase delay at the А30, В30, and С30 are delayed 30 degrees from the
cutoff frequency is 90 degrees. The SC filter cutoff filtered voltages phase.
frequency is directly proportional to the filter clock rate,
which allows stable phase delay in the full input frequency One peculiarity of this architecture is that the control PWM
range by properly adjusting the filter clock frequency. This voltage is supplied only at the upper bridge branch (high
delay corresponds to a constant angle between the rotor side). This produces an asymmetrical signal relative to half
poles and the stator windings in commutation moment. of the supply DC bus voltage.
The phase delay angle is kept to 30 degrees in this At low PWM duty cycles, the filtered phase voltage is
application. The clock rate for the filters can be generated much smaller than half the supply voltage. This, together
using the 16-bit counter with a programmable period, with ripple on the DC bus (which is in the filter’s pass-
which can be allocated in the PSoC digital resources. band), can cause false triggers on the comparators at
Each SC filter has an output comparator that compares motor start. To prevent this, the compensation network
the filter output signal to AGND. The comparator output uses an inversed PWM signal and biases the three filters
drives the comparator bus, which can be polled in software together. This raises the filter’s DC component to half of
or trigger the interrupts. The built-in look-up table (LUT) DC supply voltage throughout the whole PWM duty cycle
allows triggering the interrupts on the rising or falling edge range.
of the comparator bus, as pre-configured in the firmware. For this purpose, the inversed main PWM signal is routed
This feature is used to detect the back-EMF signals’ zero- to an external pin and filtered using an RC filter with a
crossing events and to generate signals for motor winding voltage divider (R4, C5, and R5 on the driver schematic).
commutation. Each filter triggers interrupts which are As a result, the C1 DC voltage is inversely proportional to
handled in the firmware using a dedicated state machine the main PWM DC component. The divided voltage from
to determine the next phase switching order and adjust the C1 is summed with the back-EMF signal relative to PSoC
next interrupt polarity in runtime by modifying the content digital ground and compensates the DC component
of the LUT control register. relative to the divided "DC bus in" signal. Figure 12
Note For every motor phase change, the next expected illustrates the compensation voltages for minimum and
back-EMF signal polarity change direction is opposite the maximum rotation speeds and minimum and maximum
previous. Therefore, the comparator bus signal is inversed PWM duty cycle values. Channel_1 displays the inversed
using the LUT in the triggered interrupt service routine PWM signal and Channel_2 displays the compensation
(ISR) just after it starts. This provides hysteresis and voltage.
additional noise immunity with regard to triggering multiple
interrupts.
Figures 2 and 3 illustrate key principles of driver and motor
operation. A, B, and C are the voltages on motor phases.
UP_A, DOWN_A, UP_B, DOWN_B, UP_C, and DOWN_C

October 14, 2004 Document No. 001-33760 Rev. ** 5

[+] Feedback
AN2227

Figure 2. Driver Phase Signals


Phase Angle
180 240 300 0 60 120 180 240 300 0 60 120

A
B

B
C

C
A
30o
Delay
A

Up_A PWM PWM

Down_A

Up_B PWM PWM

Down_B

Up_C PWM

Down_C

Int A

Int B

Int C

A30

B30
AGND
C30

Table State Outputs 0 0 1 1 2 2 3 3 4 4 5 5

October 14, 2004 Document No. 001-33760 Rev. ** 6

[+] Feedback
AN2227

Figure 3. Rotor Positions for Various Phase Drive Signals*

+
A A A

0
C B C B C B
_
_ + _ _ +
_
Alignment State A A

1
C B C B
+ +
_ _
A A

2
C B C B
+ +
A A

3
C B C B
+ _ + _
+ +
A A

4
C B C B
_ _
+ +
A A

5
C B C B
_ _
* See Figure 2 for Voltage Diagrams

October 14, 2004 Document No. 001-33760 Rev. ** 7

[+] Feedback
AN2227

Driver operation contains the following stages: 4. Binding Stage


1. Stop Stage There are two actions in the binding stage. First, the rotor
is set at a predetermined start position by applying the
The events register marks which event triggered the stop drive voltage to two windings. Second, the maximum
stage. If the counter does not exceed the preset threshold, possible startup duty cycle is determined. This duty cycle
the PSoC reads the speed-setting switches. In this state, is proportional to the motor start-up current. Rotor position,
all bridge drivers are switched off and the PSoC polls the set during the binding stage, is shown in Figure 3 on the
speed-setting switches. This stage is exited by setting a left. The necessary windings are commutated in
non-zero speed value. See Table 3 for possible speed accordance with the jump table. The PWM generator
values. frequency is set to 1.5 kHz during this stage. The duty
2. Full Stop Stage cycle is then incremented every 0.8 ms. After each PWM
duty cycle increment, the DriverFault output is queried. If
The driver enters full stop stage after a preset number of DriverFault equals zero, the motor winding current
failed motor start attempts. LED D2 indicates this stage. exceeds the maximum possible value. In the example
Only power-on-reset can reinitialize the driver from this project, this maximum value is set to 3.5A. The PWM duty
stage. cycle increment is finished as soon as a zero value at the
3. Driver Preparation Stage Driverfault output is received.

The IR2130 driver has a bootstrap capacitor feature. The The amplitude of the AC ripple voltage also depends on
bootstrap capacitor must be charged to 10V before it can DC filter parameters. If this measured duty cycle is directly
be used. Otherwise, high side outputs are turned off selected as the maximum PWM pulse width, the
regardless of control signals. It is necessary to hold the overcurrent protection can prematurely turn off the motor.
bridge low-side power transistors on during this stage. Therefore, the maximum measurable duty cycle ratio must
be slightly decreased to prevent a false overcurrent
To precharge the bootstrap capacitor, the low side protection trigger. The measured duty cycle is decreased
transistors are switched on and the IR2130 output by 25% and used to start the PWM duty cycle value in the
DriverFault is interrogated. If this signal is low, the low-side example project.
power transistors are turned off and the cycle is repeated.
Transistor on/off switching is necessary to clear the error 5. Free Running Stage
flag of the internal IR2130 driver. In this stage, the rotor begins rotation and is synchronized
The driver preparation stage is illustrated in Figure 10. with a back-EMF signal. The stage the PWM operational
Channel_1 shows the voltage of the motor coil windings’ frequency is set to is 5 kHz (it is possible to increase to
current sense resistor during initial PWM duty cycle 8 kHz). The timeout for every winding combination is
determination. Channel_2 shows the "Fault driver" signal, determined using Table 4 in Appendix B, where units are
which triggers when the current reaches 3.5A. The falling PWM periods (200 us). This time is controlled by using
edge of this signal turns off bridge drivers inside the reprogrammable 16-bit timer interrupts. The PSoC's
IR2130 and stores this state in the driver internal trigger. CycleCounter is used for this purpose.
To make the IGBT driver operational, this trigger should be The time intervals between phase switching events during
cleared. This trigger is cleared after a preset timeout by motor start-up are much longer than during normal motor
applying a falling edge on any low-side bridge control operation. As a result, the motor coils accumulate more
input. In the project associated with this Application Note, energy during the driving stage. Considerable time is
the trigger is reset by applying pulses to the phase C lower required to dissipate this energy though the IGBT's
switch and polling the "Fault driver" in the software. If the transistors’ reverse current protection diodes when the coil
"Fault driver" signal cannot be cleared (trigger cannot be driving stops. The back-EMF signal can be received only
reset) within 2 ms, motor start attempts are aborted and a when all stored energy is dissipated and the diodes are
motor start error flag is set. closed. This limits the time interval during which the back-
EMF signal can be sensed. The dedicated 16-bit counter
is used to set the delay proportional to the current phase
switching period. This determines the interval during which
a valid back-EMF signal should be sensed. This counter is
used for other purposes later, thanks to PSoC’s dynamic
re-configuration capabilities.

October 14, 2004 Document No. 001-33760 Rev. ** 8

[+] Feedback
AN2227

The LPF cut-off frequency has a fixed value at this driver Since this project is intended to demonstrate PSoC in
stage and is set by using the dedicated 16-bit counter, control of a sensor-less BLDC motor, the PI regulator is
Filt_Counter16, in the PSoC configuration. implemented using a simple approach. As mentioned
above, the speed control is induced once every motor
The back-EMF signal is sensed after each phase switch electrical period. The rotation period is determined by
event (starting from the second switch event). If the using the measuring counter. The regulator input signal is
expected event is well received, the driver exits from free obtained as the difference between the reference (Tref) and
running stage and switches to the synchronous rotation measured (Tmes) periods. The new PWM value is
state. calculated by using the formulae:
Figure 13 illustrates the motor start-up procedure and the
switch to back-EMF control mode. For motor start-up the ti = T ref − Ti mea
Equation 1
rotor is accelerated in the free-running stage by
decreasing the step-by-step coil switching time intervals.
These intervals are longer than normal phase switching
intervals. During these intervals, the rotor can reach
Pi PWM =
( Kint -1) DiPWM
−1 + Kint ti
+K ti
equilibrium position where the shaft torque drops. To get Kint
prg

maximum starting torque, the coil switching can be


implemented by analyzing the back-EMF signal. The back- ⎡ ⎛ 17 PWM ⎞ 15 PWM ⎤
DiPWM = max ⎢ min ⎜ DiPWM
−1 , Pi ⎟ , Di −1 ⎥
EMF signal is analyzed during the free running stage. This ⎣ ⎝ 16 ⎠ 16 ⎦ Equation 2
is after the second windings commutation and the first
valid back-EMF signal transition across AGND level
finishes the free-running stage and switches to the back-
EMF sensored stage. The back-EMF signal is analyzed by The proportion term:
the comparator bus control register software polling in the
loop, unlike the interrupt-driven operation of the sensored K prp = 1/ 32
state. Using the back-EMF signal analysis during motor
was selected empirically for the motor used with this
start-up allows a reduction in the motor current overload
example project. The integration term was selected to be:
by eliminating redundant free-running stage operation
time, which is characterized by larger winding currents. K int = 1/ 32
6. Sensored Rotation Stage
This value is the same as the proportional term. The end
Phase switching is initiated by the back-EMF signal, which user can adjust the regulator coefficients according to load
is delayed at the phase plane by the LPF. This is the specifications.
primary motor operation stage. The period between
winding commutations is measured by a cycle counter with The maximum PWM change speed value is limited in
accuracy equal to 1/32 of the PWM period. This value is effort to prevent large PWM duty cycle changes over time.
used to adjust the rotor rotation frequency with the PI The regulator coefficients were chosen to be powers of 2
regulator. in the example project. However, the PSoC power is
enough (due to a built-in MAC) to run the regulator with
The counter terminal count interrupts are used to generate other coefficients.
the timeout to wait for the proper back-EMF signal.
The falling edge of the IR2130 DriverFault triggers an
If the timeout has expired and no back-EMF received, the interrupt, which turns off all the bridge transistors, exits the
control state machine leaves the sensored rotation state current state, enters the stop state, and turns on the LED
and switches to the stop state and increases maximum D1 (see schematics). As described above, the motor
driver start attempts counter. When this counter reaches makes several attempts to restart from the stop state after
the threshold value, the driver switches to the full stop a several-second delay.
stage and powers on an error LED.
The nominal time to reach speed is checked in the
The PI regulator calculates the PWM duty cycle to sensored state as well. If motor rotation speed does not
maintain constant rotation speed and is activated every reach 7/8 of the nominal value during a predefined
sixth commutation cycle phase. This corresponds to one timeout, the driver leaves the sensored state and switches
electric motor period. The speed-setting switches are to the stop state. The time is measured in motor rotation
queried in this loop and, if a new value is read, the new periods. LED D3 displays that the nominal rotation speed
LPF’s clock frequency and new PI regulator reference exceeds the timeout.
values are set.
The following characteristics should be known in order to
design an optimal rotation speed control PI regulator:

Loaded and unloaded motor transfer function;

Regulation control parameters such as suitable


control overshoot and maximum speed-setting time.

October 14, 2004 Document No. 001-33760 Rev. ** 9

[+] Feedback
AN2227

Conclusion
This Application Note demonstrates a PSoC sensor-less
BLDC motor driver. With minimal hardware and software
modifications, this driver can be used to control BLDC.

References
1. “Handbook of small electric motors”, William H.
Yeadon, Alan W. Yeadon, McGraw-Hill, 2001.

October 14, 2004 Document No. 001-33760 Rev. ** 10

[+] Feedback
AN2227

Appendix A. Driver Schematics


DC_BUS
D1 D2 D3
1N4148 R1 22R 1N4148 R2 22R 1N4148 R3 22R C1

10nF 630V

R4 100R Q1 R5 100R Q2 R6 100R Q3


HO1 HO2 HO3
R7 R8 R9
HO1
47K 47K 47K 1
D4
1 2 3
1N4148 D5 D6
R10 22R 1N4148 R11 22R 1N4148 R12 22R
HO2
LO2 LO3 2
R15
Q4 Q5 100R Q6
LO1 HO3
3
R13 100R R16 R14 100R R17 R18
47K 47K 47K R19 0.1
LO1
Non
F1 Inductive
LO2

2
D7
~220V2 C3 C4
C5 1nF 1nF
3

FUSE 10nF_Y1 R22


+
T1 C6 4 - 1
EARLY DC_OUT LO3
47nF 275V 220R
L1 sf
I_SENSE
1

C7
10nF_Y1 C8 BR805D C9 C2
~200V1 1nF 1nF 10nF

3
2mH

~200V1
EARLY
D9
~220V2
T2 VDD
DC_BUS
1 3
DC_BUS
R23 2R R24
R27 100R
DC_OUT
2 4 C13
0.33uF 1
510k
U1 2
+ R25 C12
3
C15 1000uF 25V
C10 300k 100pF 1kV 5
330uF_400V Drain C14
DC_BUS_IN
1 10nF D10
R26 ByPass 8 12V VDD
C11 Source 7
5.1k 10nF Source 6 Q7
4 Source 3 BC547
EN Source 2
J8 C16 Source
1 0.1 TNY255 R20 R28
DC_BUS_IN
2 20R 100
3
I_SENSE
4
5

CON5

The Driver Power Schematic

October 14, 2004 Document No. 001-33760 Rev. ** 11

[+] Feedback
AN2227

U1 C1 VDD J1
0.1 D1 UF4007 R1 10R CON2
5 28 1
HO1_IN LIN1 VB1 HO1
6 2
HO2_IN LIN2 1
7 27 + C2
HO3_IN LIN3 HO1 HO1 10uF 25V R2 47R J2
2 26 CON2
LO1_IN HIN1 VS1 1
3 24 1
LO2_IN HIN2 VB2 HO2
4 D2 2
LO3_IN HIN3 2
23 C3 + C4 UF4007
HO2 HO2 10uF 25V
0.1 R3 47R J3
22 CON2
VS2 2
11 20 1
CA- VB3 HO3
R15 2
3
12k R14 9 19 + C6
ITRIP HO3 HO3 10uF 25V
5.1k D3 UF4007 J4
18 CON2
VS3 3
10 1
I_SENSE CAO C5 LO1
R4 47R 2
16 0.1
LO1 LO1
J5
15 CON2
LO2 LO2
13 D4 D6 1
VS0 LO2
VDD 14 UF4007 UF4007 2
LO3 LO3
1
VCC 8 J6
FAULT FAULT
CON2
D5 1
LO3
IR2130 UF4007 2

C7 + C8
100uF 25V 0.1

DC_BUS_IN

I_SENSE

R5 1.5M R6 1.5M R7 1.5M


1 2 3
J7
R8 R9 R10
300k 300k 300k 1 2
HO3_IN DC_BUS_IN
3 4
HO2_IN IN3
5 6
HO1_IN IN2
7 8
IN1 IN2 IN3 LO3_IN IN1
9 10
LO2_IN
R11 R12 R13 11 12
LO1_IN
C9 27k C10 27k C11 27k 13 14
FAULT
680pF 680pF 680pF

CON14A VDD

IGBT Driver Schematic

October 14, 2004 Document No. 001-33760 Rev. ** 12

[+] Feedback
AN2227

U7 PC817
1 3
SW1
R7 750R
J1 2 4

1 U5 PC817
2 1 3
3
4 R8 750R SW DIP-3
2 4
SW1
CON4 U6 PC817
SW2
1 3
SW3
R9 750R
2 4

Remote speed select VCC


U3
28
R4 VCC
1 27 C2
2 P0[7] P0[6] 26 0.1
IN3 P0[5] P0[4]
4.3k 3 25
4 P0[3] P0[2] 24
IN2 P0[1] P0[0] IN1
R5 5 23
SW3 P2[7] P2[6] SW2
C1 1.1k 6 22
SW1 P2[5] P2[4] DC_BUS_IN
0.47 7 21
IndSpeedFault P2[3] P2[2] IndSpeedFault
8 20
LO2_IN P2[1] P2[0] HO3_IN
IndStartFault
9 19
SMP XRES
10 18
FAULT P1[7] P1[6]
11 17
LO3_IN P1[5] P1[4] HO2_IN
12 16 D1 D2 D3
IndStartFault P1[3] P1[2]
13 15 LED
LO1_IN P1[1] P1[0] HO1_IN LED LED
14 I/U_FAULT START_FAULT SPEED_FAULT
Vss
CY8C27443
R1 R2 R3
510R 510R 510R

J7 VCC
U4
1 2 R6
HO3_IN DC_BUS_IN
3 4 1
HO2_IN IN3 VDD VIN VO
5 6
HO1_IN IN2
7 8 75R 0.5W +
LO3_IN IN1
9 10 C2 C6
LO2_IN 0.1
11 12 22uF 25V 78L05
LO1_IN
13 14
FAULT

CON14A VDD

CPU Module Schematic

October 14, 2004 Document No. 001-33760 Rev. ** 13

[+] Feedback
AN2227

Appendix B. Referenced Tables

Table 2. IGBT Bridge Control Table


# Phase Up A Up B Up C Down A Down B Down C
0. 0 1 0 1 0 0
1. 0 0 1 1 0 0
2. 0 0 1 0 1 0
3. 1 0 0 0 1 0
4. 1 0 0 0 0 1
5. 0 1 0 0 0 1

Table 3. Speed-Setting Switches and Nominal Speeds


Setting Speed RPM Electrical Frequency Hz Filter Frequency Hz Period in Counter Units*
b000 Stop 0 0 0
b001 2200 73.3 220 2182
b010 2400 80.0 240 2000
b011 2600 86.6 260 1846
b100 2800 93.3 280 1714
b101 3000 100.0 300 1600
b110 3200 106.6 320 1500
b111 3400 113.3 340 1412

* Counter unit = PWM_period*32*6


The following items were selected in this driver:
Freq_mechanical = RPM / 60, where RPM – revolutions per minute
Freq_electrical = Freq_mechanical*p
Freq_interrupt = Freq_electrical*6 (rising and falling edges)
RisingEdge_interrupt_Freq = Freq_electrical*3
p = motor pairs poles number

Table 4. Phase Commutation Duration During Motor Free-Running Starting


Cycle 0 1 2 3 4 5 and More
Duration in PWM 125 113 100 88 75 63
Period Units
(200uS)

October 14, 2004 Document No. 001-33760 Rev. ** 14

[+] Feedback
AN2227

Appendix C. Firmware Flowcharts


Figure 4. Driver Initialization and Determination of Maximum PWM Value

Device
initialization

Loop
display stall event
StallCounter+1

Yes
StallFlags==1

No
StallCounterOver StallFlags = 0
No

Yes
Switch read Wait 3s
Stop

No
Speed set

Yes

Charging the IR 2130


bootstrap capacitor

Set minimal Dutycycle PWM


Set frequency PWM 1.5kHz

Turn on the high


switch of phase A
and low switch of
phase B

Current is more No Increase the PWM


maximum value on one

Yes

Reduce the PWM duty


cycle on 25%

Get to memory max Dutycycle


PWM
Set frequency PWM 5kHz

October 14, 2004 Document No. 001-33760 Rev. ** 15

[+] Feedback
AN2227

Figure 5. Motor Operational

Set FreeRunCycles
Set FreeRunTimeOut

Commutation of next
phase

No
FreeRunTimeOut Over ?

Yes

Yes
Zerro Cross detect

No

No
FreeRunCycles Over ?

Yes

No
FreeRunBreak

Yes

SET MAX_PULSE_TIME

Yes MAX_PULSE_TIME
Over ?

No

Yes
Fault Driver ?

StallFlags =1 No

No
Zerro Cross Enable ?

Loop
Yes

Routing the PWM signals


for next stage

Speed calculate

Yes Yes Speed control No PI control time No Switch read and


Speed fault ?
time ? ? set new speed

Yes
No
Calculate and Set
new DutyCycle

October 14, 2004 Document No. 001-33760 Rev. ** 16

[+] Feedback
AN2227

Appendix D. Scope Images


Figure 6. Back-EMF Signal (a) and Filtered Signal (b)

Back EMF
Voltage

(a)

Delay 30°

(b)

October 14, 2004 Document No. 001-33760 Rev. ** 17

[+] Feedback
AN2227

Figure 7. Motor Phase Signals

Figure 8. Filter Output Signals

October 14, 2004 Document No. 001-33760 Rev. ** 18

[+] Feedback
AN2227

Figure 9. Motor Start Procedure for Varied Loads

October 14, 2004 Document No. 001-33760 Rev. ** 19

[+] Feedback
AN2227

Figure 10. Scope Image for Initial Duty Cycle Determination (Driver Preparation)

Figure 11. Scope Images for the Compensation Voltage for Two Different PWM Values

(a) (b)

October 14, 2004 Document No. 001-33760 Rev. ** 20

[+] Feedback
AN2227

Figure 12. Unfiltered Back-EMF Signal (a) and Signal After LPF
(b) When Driver Switches from Free-Running Stage to Sensored Stage
First Back EMF
commutate for CH1

(a) (b)

October 14, 2004 Document No. 001-33760 Rev. ** 21

[+] Feedback
AN2227

Appendix E. Driver Photograph

Figure 13. Assembled Driver Photograph

Note Driver components are mounted on three separate PCBs to simplify future upgrades and modifications.

Figure 14. Driver Photograph with 75W Motor

October 14, 2004 Document No. 001-33760 Rev. ** 22

[+] Feedback
AN2227

About the Author


Name: Andrey Magarita
Title: Sr. Application Engineer
Background: Andrey graduated from National
University “Lvivska Polytechnika”
(Lviv, Ukraine) in 1989 and presently
works as a Senior Application
Engineer at “Zuvs,” a private
company. He has more than 15
years experience in embedded
systems design.
Contact: You can contact him at
makar@ltf.lviv.net

In March of 2007, Cypress recataloged all of its Application Notes using a new documentation number and revision code. This new documentation
number and revision code (001-xxxxx, beginning with rev. **), located in the footer of the document, will be used in all subsequent revisions.
PSoC is a registered trademark of Cypress Semiconductor Corp. "Programmable System-on-Chip," PSoC Designer, and PSoC Express are trademarks
of Cypress Semiconductor Corp. All other trademarks or registered trademarks referenced herein are the property of their respective owners.

Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone: 408-943-2600
Fax: 408-943-4730
http://www.cypress.com/

© Cypress Semiconductor Corporation, 2004-2007. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any
license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or
safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as
critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies
Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide
patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a
personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative
works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress
integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source
Code except as specified above is prohibited without the express written permission of Cypress.
Disclaimer: CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS MATERIAL, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress reserves the
right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or
use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems
application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.

October 14, 2004 Document No. 001-33760 Rev. ** 23

[+] Feedback

You might also like