Upload
vutu
View
217
Download
0
Embed Size (px)
Citation preview
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 1
11081 DIFIntelligent Motor Control:
A Fan Application
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 2
Class objectiveWhen you finish this class you will:− Describe how PIC® microcontrollers can
be used to control and monitor brushless DC fans
− Discuss different control loop techniques and their associated tradeoffs
− Provide information on fully utilizing the available microcontroller peripherals
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 3
Agenda
Brushless motor basics (hardware background)
Interpreting inputs
Generating outputs
Control software
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 4
Brushless MotorBasics
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 5
Inside The FanFan
Windings
Magnetic Core
Hall-Effect Position Sensor
Permanent Ring
Magnet
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 6
Two PhaseSupply Voltage
Current Always Flows in the Same
Direction
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 7
Two Phase
N
N
S
S
N
N
S
S
Hall DeviceDetects Pole
Change
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 8
Two Phase
N N
S
SHall Device
Detects PoleChange
N NSS
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 9
Single PhaseSupply Voltage
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 10
Single Phase
N
N
S
S
N
N
S
S
NS N S
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 11
Single Phase
N N
S
SS
S
N
N
SN S N
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 12
What Are Intelligent Fans?
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 13
Why Use Intelligent Fans?Allow the fan to control its own speed
Incorporate other safety features
Can compensate for dynamic load conditions
Desire non-audible control loop
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 14
Intelligent Fan Block Diagram
Controller
Position Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 15
Introducing…PIC12F615 PIC12HV615
PIC16F616 PIC16HV616
Program Memory
Data Memory
Comparators
ECCP PWM
Package
Timers
1024 words
64 bytes
Single
Half-bridge
8 pin
2 8-bit / 1 16-bit
2048 words
128 bytes
Dual
Full-Bridge
14 pin
2 8-bit / 1 16-bit
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 16
Position SensePosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 17
Hall Element
Power
Power
Output Output
Symmetrical deviceUn-buffered outputUsed with a current sourceOutput voltage
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 18
Hall-Element Schematic
CxINx+
1k
Supply Voltage
CxINx-
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 19
Hall Element
time
Voltage
Comp.Output
No Hysteresis
Comp.Output
Hysteresis
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 20
Hall Sensor
Digital deviceSeveral output types:− Logic level / open collector− Latching / non-latchingIntegrated power supplyIntegrated signal conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 21
Hall Sensor Diagram
+-
+V Output
Ground
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 22
Hall Device Mounting
Above Board On Board
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 23
Position Sense Resources
Hall element: Requires a comparator (CxINx- pin and CxINx+ pin)
Digital hall sensor: Any available interrupt-on-change pin
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 24
Voltage RegulatorPosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 25
Integrated Shunt RegulatorCan operate from almost any voltage
Supply regulated voltage to other components
Much cheaper than other types of regulators
CPU
+12V
PIC MCU
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 26
Considerations
More difficult to accommodate…− Wide input voltage ranges (i.e. 12V –
96V)− Wide required current ranges (4mA –
50mA)
Some cases are impossible to accommodate without additional effort
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 27
Shunt Regulator Resources
External resistor
Need to choose a microcontroller with the HV option
Application note AN1035
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 28
Speed InputPosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
Speed Input
Signal Conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 29
Speed Input Choices
Commanded speed PWM− kHz range (Intel and AMD specs use
25kHz)
Analog− RC filtered PWM− Thermistor
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 30
Timer1 Gate
Timer1 will increment when gate is active
Timer1Clock Source
Timer1Counter
Gate source can be an I/O or a comparator output
Timer 1 Gate
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 31
Timer1 Gate
Timer1 will increment when gate is active
Timer1Clock Source
Timer1Counter
Timer1 Gate can be active-high or active-low
PWM Input
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 32
Duty Cycle Measurement
Measurement period = (low + high)Duty cycle = high / (low + high)Math is performed as unsigned 24-bit by 16-bit division
Measure Low Measure High
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 33
Considerations…
Measurement period needs to be much larger than period of signal− Higher input PWM frequency means less
time to measure
Possible to approximate:− Measurement Period = (Low + High)
Timer1 can not overflow
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 34
Slow PWM Inputs
Possible to measure directly using interrupt-on-change pins
Need to account for the extremes: 0% and 100%
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 35
Analog Speed Choices
Why use analog filtered PWM?− PWM frequency range too wide for
direct measurement− Incoming PWM at a lower voltageTemperature control using a thermistorDirect analog input control
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 36
Speed Input Resources
Digital measurement: need a microcontroller with Timer1 Gate (use the T1G pin)
Analog measurement: any available ADC channel
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 37
PWM DrivePosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
Speed Input
Signal Conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 38
Full Bridge ForwardSupply Voltage
H
L
H
LH
L
H
L
P1B
P1A
P1D
P1C
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 39
Full Bridge ReverseSupply Voltage
H
L
H
LH
L
H
L
P1B
P1A
P1D
P1C
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 40
Two Phase DriveSupply Voltage
P1B P1DH
L
H
L
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 41
Other ECCP Pins
Enhanced Capture Compare PWM (ECCP)
P1A, P1C− Free tachometer output− Pin can be configured as an input
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 42
Using Single PWM Output
Pin steering− Steer a single PWM output to
multiple pinsNeed to ensure idle pin is in idle state
VDDP1A(1)P1B(1)GP3
VSSP1BGP1P1A
PIC12HV615
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 43
Extending PWM Resolution
Software dithering:
Based off of TMR2 interrupts (can use the post-scaler)
Dither Offset + Accumulator
OverflowFlag
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 44
Dithering Considerations
System needs to act in a low-pass manner
Dither frequency may be audible
Resource intensive
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 45
PWM Drive Resources
Timer2 used as the ECCP time base
ECCP in full-bridge mode, or a CCP with pin steering
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 46
PWM DrivePosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
Speed Input
Signal Conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 47
Speed Feedback
Tachometer signal− Generated using the ECCP module− Toggling an output pin
Alarm output− Generated if the fan speed is too low
for too long
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 48
Alarm Signal
Commanded Speed +
Scaling Factor
Threshold
Clear Counter
YesIncrement Counter
Counter Maxed?
No
No
Alarm!Yes
Current Speed >
Threshold
ExitRoutine
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 49
Speed Feedback Resources
Any available I/O pin
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 50
Current SensePosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
Speed Input
Signal Conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 51
Current Sense
Protect fan / host from drawing too much current
Hardware feature – no software required
Cycle-by-cycle
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 52
Current Limiting
+ 0.6 VoltReference
ShutdownEvent
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 53
Current Limiting
Current
PWM
0.6 Volt
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 54
Current Sense Resources
Inverting input of available comparator (can use the internal reference)
ECCP with auto-shutdown capability
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 55
Actual Speed MonitoringPosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
Speed Input
Signal Conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 56
Measuring Actual Speed
Can measure hall period
Need output from 0 to 255 corresponding to minimum and maximum speed
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 57
How to Monitor Actual Speed
y = 76117x-0.9977
R2 = 0.9998
0
50
100
150
200
250
300
0 200 400 600 800 1000 1200 1400Hall Period (in counts)
Rou
tine
Out
put
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 58
Speed Monitoring Equation
From Excel:
Better written as:
Constant:
9977.076117 −⋅ period
176117 −⋅ period
(Full Scale Value) Rotations 60 seconds(MaxRPM) (Tcount) (# Hall Periods) minute
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 59
Division NecessaryPerform division as unsigned 24-bit by 16-bit division, use lower byte out of output
periodoutput 76117
=
Three byte result:00 00 (0 – 255)
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 60
Consideration…
What if fan spins above the “maximum” speed?
Fan will attempt to speed up
periodoutput 76117
=
Three byte result:00 01 (small)
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 61
Resources Required
Time base− Possible to use Timer0 or Timer2
Reuse same division routine from duty cycle measurement
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 62
Control SoftwarePosition Sense
Signal Conditioning
Voltage Regulator
Speed Input
Signal Conditioning
Speed Feedback
PWM Drives for Coils
Current Sense
Controller
Speed Input
Signal Conditioning
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 63
Fan SoftwareHardware
initializationSet point
measurement
Measure actual speed
Controlroutine
Set new duty cycle
TimingControl
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 64
Control Routine
PID Controller− Existing routines− MASTERs class
Limitations− Single set of control parameters
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 65
Control Routine
Integral Controller− Multiple control constants− Inherently stable to “DC” input
commands
Limitations− Slow response time
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 66
Multiple Control Constants
Control ConstantSpeed << set point
Speed close to set point
Speed >> set point
Large KI
Normal KI
Small KI
Condition
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 67
Transient Response
0
500
1,000
1,500
2,000
2,500
3,000
0 100 200 300 400 500
Sample
RPM
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 68
Demonstration
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 69
Quantifyingthe Results
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 70
Closed Loop Response
0500
1000150020002500300035004000
0.0% 20.0% 40.0% 60.0% 80.0% 100.0%Duty Cycle
RPM
Specification Limits
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 71
Transient Response
-500
0
500
1000
1500
2000
2500
3000
3500
0 100 200 300 400 500 600
Sample
RPM
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 72
PotentialPin-out Configurations
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 73
PIC12F615 – Hall Element
4-Wire Input
1234
0.1uF
100
+12
P1A
PIC12HV615
VddP1A-2GP4T1G
VssCIN+CIN-P1A
+12+5
10k10k
10k
2.2uF
100
100
+12
1.2k
+5
P1A
P1A-2
470
P1A-2 Hall Element
2.2uF
+5
1k
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 74
PIC12F615 – Hall Sensor
10k
0.1uF
+12
Hall Sensor
100
100
PIC12HV615
VddP1A-2GP4T1G
VssCIN+CIN-P1A
+5
10k
2
100
2.2uF
470
10k
P1A-2P1A
+5
2.2uF
P1A-2
+12
1k
+5
4-Wire Input
1234
+12
P1A
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 75
PIC16F616
2.2uF
+5
100
1004-Wire Input
1234
10k
1.2kPIC16F616
VddRA5T1G/AN3RA3P1AP1BP1C
VssC1IN+
C12IN0-RA2RC0
C12IN1-P1D
P1B100
+5
2
1k
+12
Hall Element
10k
+12
P1D
P1D
10k
2.2uF
P1B
0.1uF
+12
+5470
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 76
Intelligent Fan Overview
Controller is built directly into the fan
Closed loop control with good audible properties
Additional safety features
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 77
Summary
Brushless motor basics (hardware background)
Interpreting inputs
Generating outputs
Control software
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 78
ReferencesApplication Note:− AN1035 – Designing with HV
Microcontrollers
© 2007 Microchip Technology Incorporated. All Rights Reserved. 11081 DIF Slide 79
TrademarksThe Microchip name and logo, the Microchip logo, Accuron, dsPIC,
KeeLoq, KeeLoq logo, microID, MPLAB, PIC, PICmicro, PICSTART, PRO MATE, rfPIC and SmartShunt are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
AmpLab, FilterLab, Linear Active Thermistor, Migratable Memory, MXDEV, MXLAB, SEEVAL, SmartSensor and The Embedded Control Solutions Company are registered trademarks of Microchip Technology Incorporated in the U.S.A.
Analog-for-the-Digital Age, Application Maestro, CodeGuard, dsPICDEM, dsPICDEM.net, dsPICworks, ECAN, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB, In-Circuit Serial Programming, ICSP, ICEPIC, Mindi, MiWi, MPASM, MPLAB Certified logo, MPLIB, MPLINK, PICkit, PICDEM, PICDEM.net, PICLAB, PICtail, PowerCal, PowerInfo, PowerMate, PowerTool, REAL ICE, rfLAB, Select Mode, Smart Serial, SmartTel, Total Endurance, UNI/O, WiperLock and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their respective companies.