IP14_Application Note

Power Management - Multi-Channel Fan Speed
Control System
AN2357
Author: Volodymyr Sokil
Associated Project: Yes
Associated Part Family: CY8C2xxxx
GET FREE SAMPLES HERE
Software Version: PSoC® Designer™ 4.2
Associated Application Notes: AN2180, AN2246, AN2249, AN2314
PSoC Application Notes Index
Application Notes Abstract
This Application Note describes the implementation of a multi-channel fan speed control system. The proposed
implementation shows how to use low-cost, two-wire fans in different temperature control systems.
Introduction
Increasing the performance of electronic systems causes an
increase in power consumption and, consequently, heat
dissipation. The most popular solution to thermal problems
is the use of air-cooling, provided by multiple fans.
Traditionally in such systems, three- or four-wire fans with
separate tachometer outputs are used. There are many
different low-cost models of fans without separate
tachometer outputs. This Application Note demonstrates
how to extract the rotation speed of a two-wire fan by
processing its supply current ripple.
The flowchart of a typical temperature control system is
shown in Figure 1. The actual temperature and fan speed
values are used as input parameters for the regulation
system. This regulator provides the desired fan speed by
changing the output of the PWM duty cycle signal. The
number of independent channels and regulator type can
change according to the task specification.
Figure 1. General Temperature Assurance System Flowchart
Control System
Thermistor
Temperature
Measuring
Tachometer
Hall Sensor
DC-DC
Converter
November 26, 2007
Speed
Regulator
? fan= f(T)
Table of
Desired Values
PWM
Document No. 001-15235 Rev. *A
1
[+] Feedback
AN2357
Fans Speed Control System Implementation
A fan motor has several windings that are commutated by
an IC during fan revolution. These commutations cause the
fan’s current consumption to fluctuate. If the frequency of
the fluctuations and the number of permanent magnetic
poles of the rotor is known, the mechanical rotation speed of
the fan can be easily calculated.
The flowchart of a measuring system for one separate fan
control channel is shown in Figure 2. Such a scheme
provides a temperature measuring circuit and a tachometer
connection circuit via the same single analog input port. The
measuring mode is selected by switching the open-drain
digital output, Sw. Let’s briefly consider these modes
separately.
The circuit consists of a voltage divider, built on Rref, Rt,
and Rsh, and a decoupling capacitor, Cf. The temperature
measuring mode requires the switch, Sw, to be closed. The
decoupling capacitor, Cf, removes the DC component of
current sense resistor, Rcs, signal. Temperature is
measured by the resistance divider, which consists of four
resistors, Rc (constrain resistor), Rt (thermistor), Rsh (shunt
resistor), and Rref (reference resistor). The shunt resistor,
Rsh, prevents the divider coefficient from increasing when
the thermistor, Rt, resistance is high (temperature is low).
The constrain resistor, Rc, in turn prevents the divider
coefficient from decreasing when the thermistor, Rt,
resistance is low (temperature is high). The PGA only
buffers the input signal, so its gain is set to 1. This
temperature measuring technique is similar to the technique
described in AN2314, “Thermistor-Based Temperature
Measurement in Battery Packs.” This technique applies two
different voltages to the thermistor and measures the
difference.
Figure 2. One Channel Measuring Circuit Flowchart
Rc
POWER
REFHI
REFMUX
AGND
FAN
M
Rt
Cf
CLK
Rsh
Rref
PGA
CMP
ONE
SHOT
TIMER
Software
Capture
Rcs
Sw
ADC
Gain
Control
When switch Sw is open, the external circuit works in
tachometer mode. The signal from the current sense
resistor, Rcs, via the differentiator, built on Cf.Rt Rsh Rref, is
fed to the PGA. The PGA gain is set to 24. It provides the
necessary signal level for normal threshold comparator CMP
operation. The CMP forms a digital signal from the amplified
signal. The one-shot module suppresses possible signal
bounce. More detailed information about one-shot modules
can be found in AN2249, “User Module as a One-Shot Pulse
Width Discriminator and Debouncer.” Using the one-shot
output signal as the capture signal for the timer gives the
time period between two pulses, and, therefore, the fan
motor speed. The oscilloscope waveforms of the tachometer
function are shown in Figure 3.
Figure 3. Tachometer Operation Waveforms
CH1 – Fan current consumption
CH2 – PGA output
CH3 – CMP output
CH4 – One-shot output
November 26, 2007
Document No. 001-15235 Rev. *A
2
[+] Feedback
AN2357
This technique has a very useful feature. If the environment
temperature increases, the voltage of the fan power supply
is increased by a control loop. This, in turn, causes an
increase in the amplitude of the measured current signal.
This increase is compensated by a simultaneous decrease
in thermistor resistance, and vice versa. So, the signal from
current sense resistor, Rcs, would have approximately the
same amplitude in a wide range of temperatures and fan
power supply voltages. This has a positive influence on the
operational reliability of the tachometer.
Since the fan motor uses a 12V power supply, the output
PWM signal of the control system cannot be used directly. A
step-up switching regulator is used to control the fan drive
voltage. A high-frequency (1-1.5 MHz) PWM signal must be
used so the regulator coil can be small. This reduces both
the resulting inductance and the cost of the regulator.
The 8-bit PWM User Module can be used as the signal. It
has a maximum frequency of 48 MHz. When using a 1-MHz
output signal, a theoretical maximum of 48 steps of control
are available. But the fan starts operation from some
threshold power supply voltage (not zero). Moreover, the fan
speed does not increase linearly as the power supply
voltage is increased. These factors reduce the step count to
approximately 20.
Software sigma-delta modulation is used to increase the
resolution of the output voltage. The periodic change of the
least significant bit of the PWM duty cycle register gives an
intermediate (fractional) value between two neighboring
whole values. The buck converter filter smothers the ripples
(see Reference [2]). More detailed information about sigmadelta modulation can be found in AN2246, “PWM Source High Frequency, High Resolution” and Reference [1].
The firmware of this modulator is easy to understand. The
resolution of the PWM is extended up to 13 bits (5 bits
hardware plus 8 bits software) in the firmware. The duty
cycle of the PWM output signal is set with a 2-byte variable.
The most significant byte (PWM MSB) defines the duty cycle
of the output PWM signal. The least significant byte (PWM
LSB) is used to manipulate the least significant bit of the
PWM MSB. The frequency of these updates is defined by
the system counter VC3 interrupt frequency and is equal to
10 kHz in this project.
Code 1. Software Sigma-Delta Modulator
push A
mov A, [bCH0_Tmp_mod]
add A, [_wCH0_PWM_value + 1] // LSB value
mov [bCH0_Tmp_mod], A
mov A, [_wCH0_PWM_value]
// MSB value
adc A, 0
mov REG[PWM_FAN0_COMPARE_REG], A
pop A
November 26, 2007
Implementation of each fan control channel needs three
PSoC pins (analog input, mode switch and PWM output)
and one digital block for an 8-bit PWM. Shared resources for
the system are:
ƒ
ƒ
ƒ
ƒ
ƒ
Two pins for the I2C bus
One analog output pin for AGND/REFHI
Two digital blocks for the ADC and One-Shot modules
Three analog CT blocks for the CMP, PGA, and
RefMux user modules
One or two analog SC blocks for the ADC
The system counter, VC3, is used as the tachometer timer.
Depending on channel demands, different PSoC device
families can be used to implement the control system. Table
1 contains information about the maximum number of
channels for all PSoC device families.
Table 1. Number of Channels Depending on PSoC Family
Recommended Part
CY8C21xxx
Maximum Number of Channels
Not Applicable
CY8C24x23A
2
CY8C27x43
6
CY8C29x66
7 (14 )
1
1 Since only eight analog inputs are available, seven of 14 fans must have
separate tachometer output.
The schematic of a six channel fan control system based on
CY8C27443-24PXI is shown in Appendix A on page 5. Note
that the buck DC-DC converter in continuous conductivity
mode operates as a voltage regulator. The output voltage,
Vout in this case, is the uniform function of input voltage Vin
and PWM signal duty cycle D:
Vout = Vin ⋅ D
Equation 1
This decreases the ripples due to load changes. More
detailed information about DC-DC converter creation and
operation can be found in AN2180, “Switch Mode Pump in a
Step-Down Converter Using PSoC,” and Reference [2].
Note that the converter can easily be modified to support
fans with different operating voltages. Recommended values
of DC-DC converter components for different power supply
voltages and fan power values are shown in Appendix B on
page 6.
The firmware “brain” of the control system is the regulator
module. The goal of regulator module is to provide the
desired fan speed depending on environment temperature.
An example of user-defined dependence between
temperature and desired fan speed is shown in Figure 4.
Desired fan speed values are manually defined in table form
by the user.
Document No. 001-15235 Rev. *A
3
[+] Feedback
AN2357
Figure 4. Desired Fan Speed vs. Temperature
9000
Tachometer value, RPM
8000
The I2C interface allows you to change the table of fan
2
speed values and temperatures at runtime. The I C interface
memory buffer contains the command register and area for
the table of fan speed values vs. temperature. Table 2
contains a list of commands for this purpose.
2
Figure 6. I C Memory Buffer Format
7000
6000
5000
4000
3000
2000
1000
0
30
40
50
60
Temperature value, C
70
80
There are several types of regulators. In this project the
proportional-integral (PI) regulator is used. More detailed
information about PI regulator operation, implementation
and tuning can be found in Reference [3]. Time diagrams
that demonstrate regulator operation are shown in Figure 5.
An I2C to USB bus bridge is used to debug the system and
tune the regulator, as described in AN2352, “I2C-USB
Bridge Usage.” A quick start guide is presented in Appendix
C on page 7.
Note The regulator must be tuned according to the fan type,
defined by task specification. Once tuned, the regulator
must be tested for operability and stability.
Figure 5. Fan Transient Process After Manual Stop
Description
Write table to RAM
0x02
Write table to FLASH
0x03
Read table from RAM
0x04
Read table from FLASH
0x05
Reload table from FLASH to RAM
This Application Note describes a multi-channel fan speed
control system. The system uses low-cost, two-wire fans
without separate tachometer outputs.
5000
Fan speed, RPM
Command
0x01
Conclusion
6000
4000
A demonstration project on a CY8C27443-24PXI was
developed to test the system. The project contained six fan
control channels. The system demonstrated excellent
operational stability on all six channels.
3000
2000
References
1000
0
2
Table 2. I C Commands
2000
4000
6000
Time, ms
8000
All necessary information about the current state of the fan
(temperature, speed, and PWM value) is stored in a memory
buffer. This can be sent to the host through the I2C bus. The
EzI2Cs Hardware User Module is used For I2C slave
operation. Figure 6 depicts the memory buffer format.
November 26, 2007
1.
Tim Wescott “Sigma-delta Techniques Extend DAC
Resolution”
2.
Abraham I. Pressman “Switching Power Supply
nd
Design”, McGraw-Hill Professional; 2 edition, 1997.
3.
C. Hernandez-Rosales, R. Femat-Flores, and G.
Quiroz-Compean “Make a PI Controller On an 8 Bit
Micro”
10000
Document No. 001-15235 Rev. *A
4
[+] Feedback
AN2357
Appendix A. Schematics
Figure 7. Schematic of the Six Channel Fan Control System
CH_FAN4
CH_FAN5
REF_MUX
Ref Mux_in
FAN4_VDD
FAN_VDD_in
CH4_MODE
MODE_SW
CH4_FAN
FAN_out
REF_MUX
Ref Mux_in
FAN5_VDD
FAN_VDD_in
CH5_MODE
MODE_SW
CH4_FAN_sch
CH_FAN3
FAN_out
CH5_FAN
Ref Mux_in
FAN2_VDD
FAN_VDD_in
CH2_MODE
MODE_SW
CH_FAN1
FAN_VDD_in
CH1_MODE
MODE_SW
1
2
3
4
CH1_FAN
FAN_out
5
6
7
8
CH4_MODE
CH2_MODE
CH1_MODE
CH1_FAN_sch
9
CH_REG3
FAN3_VDD
FAN_VDD_out
CH3_PWM
PWM_in
10
11
12
13
I2CSCL
I2CSDA
CH1_PWM
CH_REG_sch
FAN0_VDD
P0[7]
P0[5]
P0[3]
P0[1]
P0[6]
P0[4]
P0[2]
P0[0]
P2[7]
P2[5]
P2[3]
P2[1]
P2[6]
P2[4]
P2[2]
P2[0]
SMP
Xres
P1[7]
P1[5]
P1[3]
P1[1]
P1[6]
P1[4]
P1[2]
P1[0]
REF_MUX
Ref Mux_in
28
REF_MUX
CH0_FAN_sch
27
26
25
24
CH_REG5
CH1_FAN
23
22
21
20
CH5_MODE
CH3_MODE
PWM_in
CH0_MODE
CH_REG_sch
19
XRES
CH_REG4
CH5_PWM
CH4_PWM
18
17
16
15
PWM_in
FAN_VDD_out
FAN_VDD_out
FAN5_VDD
FAN4_VDD
Vss
CH_REG2
CY 8C27443_DIP28
CH2_PWM
FAN_VDD_out
PWM_in
PWM_in
FAN2_VDD
CH_REG_sch
1
2
3
4
5
CH_REG_sch
1
2
FAN_VDD_out
5V
J1
J2
CH0_MODE
CH_REG_sch
14
CH_REG1
FAN1_VDD
MODE_SW
FAN_VDD_in
CH_FAN0
FAN_out
5V
Vcc
Ref Mux_in
REF_MUX
CH3_FAN_sch
CH1_FAN
U1
FAN1_VDD
FAN3_VDD
Ref Mux_in
CH2_FAN
FAN_out
CH2_FAN_sch
REF_MUX
CH3_MODE
CH0_FAN_sch
CH_FAN2
REF_MUX
MODE_SW
FAN_VDD_in
FAN_out
I2CSDA
I2CSCL
CH_REG0
XRES
CH1_PWM
CH0_PWM
PWM_in
CH0_PWM
ISSP
FAN_VDD_out
FAN0_VDD
CH_REG_sch
I2C connector
12V
U2
LM78L05
5V
C1
100u
C2
0.33u
VOUT
CY8C
1
C3
0.01u
2
+
VIN
GND
ISSP
3
+
C4
100u
C5
0.1u
C6
0.1u
D1
5V
Figure 8. Schematic of CH_FAN Module
Ref Mux
FAN_VDD_in
RT1
MODE_SW
10K@25C
J1
1
2
FAN connection
C1
R2
4.7n
4.7K
t
R1
10K
FAN_out
R3
1R
Figure 9. Schematic of the CH_REG Module (Buck Converter)
C8
FAN_VDD_out
BAT54C/SOT
D2
0.22u
12V
Q1
BC817
+
C9
100u
R4
3.3K
L1
10uH
D3
MBR360
+
C10
0.1u
C11
100u
R5
Q2
BC817
PWM_in
200R
November 26, 2007
Document No. 001-15235 Rev. *A
5
[+] Feedback
AN2357
Appendix B. Recommended Values of DC-DC Converter Components for
Different Fan Powers and Power Supply Voltages
Fan Voltage, V
12
24
30
48
1
Fan Power, W
R5
1
D3
2
1
2
1.5K
750
1N5817
5
330
MBR120
1
5.6K
1N5818
2
3.3K
SR103
5
1.5K
11DQ03
10
750
MBR130
10JQ030
1
7.2K
1N5819
2
4.3K
SR104
5
2K
11DQ04
10
820
11JQ04
MBR140
1
2
11K
6.8K
MBR160
5
3K
11DQ06
10
1.3K
11JQ06
SR102
SR106
L1
3
Q1
4
Q2
LPO6013-153K
DO1605T-333M
2N4401
MMBT4401
MPS 2222A
MBT2222ADW
BC847
2N3904A
MMBT3904A
DO1605T-473M
DO1605T-104M
MMBTA05
BC489B
BC846
Resistance value is calculated with the following equation:
R5 =
VFAN
,
I L1max
⎛
⎞
2⋅⎜
⎟
hFE min ⎠
⎝
where hEFmin is the minimum DC current gain of Q1.
Repetitive reverse voltage value VRRM must be less then VFAN.
3
Maximum current value of inductor is calculated with the following equation:
2
D (1 − D ) ⎤
⎡ D
I L1max = VFAN ⋅ ⎢
+
⎥;
⎣ RFAN 2 FPWM L ⎦ ,
V2
RFAN = FAN
PFAN
where D=0.9.
FPWM is PWM signal frequency.
L is inductance value.
IL1max value must be less then coil saturation current, ISATUR.
Inductors are selected from the Coilcraft Inc. catalog.
4
The main constraints for selecting Q1 are:
•
collector-emitter voltage VCEO > 1.25*VFAN;
•
collector DC current IC > IFAN;
•
switching time < 250 ns (for PWM signal frequency 1 MHz)
November 26, 2007
Document No. 001-15235 Rev. *A
6
[+] Feedback
AN2357
Appendix C. I2C-USB Bridge Settings Quick Start Guide
An I2C-USB bridge can be used to tune and debug the fan controller, as described in AN2352. To set up the I2C-USB bridge:
1.
Connect the test fan to the fan control demonstration board.
2.
Connect the power supply to the fan control demonstration board.
3.
Connect the I2C–USB bridge board via the I2C connector to the fan control demonstration board.
4.
Connect the I2C–USB bridge board via the USB connector to the PC.
5.
Run the I2C–USB bridge software.
6.
2
Set the I C bus speed to 100K. From the Tools menu, select IIC Speed – 100K.
7.
On the Chat menu, click Data settings and declare your variables.
Figure 10. Variable Settings Window
1.
Click the List button and check the I2C–USB bridge address. It must be 0x00.
2.
Click the Editor tab. On the File menu, click Open File. Locate the file, fan_control_data.iic, and open it. This loads the
command file into the Command Window:
November 26, 2007
Document No. 001-15235 Rev. *A
7
[+] Feedback
AN2357
Figure 11. Command Line Example
1.
Select the Send all strings check box.
2.
Click the Send button to start data transmission.
3.
Select the Chart, Table, or File tab to display realtime data.
Figure 12. Operation Profile Example
You can download your own table of desired fan speed vs. temperature to, or read the existing table from, RAM or FLASH
memory.
To download a table or read an existing table, select the appropriate command file:
1.
Click the Editor tab.
2.
On the File menu, click Open File.
November 26, 2007
Document No. 001-15235 Rev. *A
8
[+] Feedback
AN2357
3.
Click the command file that wish to use:
‰
write_table_to_ram.iic
‰
write_table_to_flash.iic
‰
read_table_from_ram.iic
‰
read_table_from_flash.iic
4.
Verify that the Send all strings check box is selected. This option must be enabled.
5.
Click the Send button to start data transmission.
Figure 13. Setting Custom Fan Speed vs. Temperature Table Script Example
November 26, 2007
Document No. 001-15235 Rev. *A
9
[+] Feedback
AN2357
About the Author
Name:
Title:
Background:
Contact:
Volodymyr Sokil
Post-Graduate Student
Volodymyr earned a diploma in computerengineering in 2001 from National
University "Lvivska Polytechnika" (Lviv,
Ukraine), and is currently a post-graduate
student at this University. His interests
include embedded systems design and
information security.
[email protected]
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, 2006-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.
November 26, 2007
Document No. 001-15235 Rev. *A
10
[+] Feedback