AN2680
Application note
Fan speed controller based on STDS75 or STLM75 digital temperature sensor and ST72651AR6 MCU
Introduction
This application note describes the method of defining the system for regulating the speed of the 5 Vdc fan using an ST72651AR6 microcontroller and digital temperature sensor STDS75 or STLM75.
The sensor measures the temperature data and communicates this data to the microcontroller. Based on this temperature data, the microcontroller issues a PWM signal with varying duty cycle to the fan for regulating its speed.
The key features of the system are:
●Microcontroller with I2C interface and PWM peripheral to communicate with the sensor and for regulating the fan speed
●Digital temperature sensor to measure the ambient temperature
●5 Vdc fan to show the speed regulation
Section 1 highlights the features of the STDS75 or STLM75 sensor and explains its interfacing with the microcontroller. Section 2 explains BLDC fan management and PWM signal control to regulate the fan speed. Section 3 focuses on the hardware setup and in Section 4 the application flow of the system is defined.
February 2008 |
Rev 1 |
1/15 |
www.st.com
Contents |
AN2680 |
|
|
Contents
1 |
Digital temperature sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
3 |
|
|
1.1 |
Theory of operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
3 |
|
1.2 |
Interfacing of sensor with the microcontroller . . . . . . . . . . . . . . . . . . . . . . . |
4 |
|
1.3 |
Configuring the sensor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
4 |
|
1.4 |
Alarm signal behavior . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
4 |
2 |
BLDC fan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
5 |
|
|
2.1 |
Principle used for fan speed control using PWM . . . . . . . . . . . . . . . . . . . . |
5 |
|
2.2 |
Method of fan speed control using a power MOSFET . . . . . . . . . . . . . . . . |
5 |
|
|
2.2.1 PWM control using transistor at low side drive . . . . . . . . . . . . . . . . . . . . |
5 |
3 |
Hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
7 |
3.1 Description of the hardware setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.1 Sensor - microcontroller connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1.2 Microcontroller - fan connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4 |
Software flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
. 9 |
|
|
4.1 |
Description of fan control logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
9 |
|
4.2 |
Description of alarm control logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
11 |
5 |
Firmware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
12 |
|
6 |
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
13 |
|
7 |
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . |
14 |
2/15
AN2680 |
Digital temperature sensor |
|
|
The STDS75 and STLM75 are digital temperature sensors that measure the ambient temperature and give the digital output. Both the STDS75 and STLM75 are 8-pin ICs available in two packages, SO-8 and TSSOP-8. The measurable temperature range of the sensors is -55 °C to 125 °C.
The STLM75 and STDS75 differ only in terms of the resolution of the temperature data. The STLM75 has a fixed 9-bit resolution whereas the STDS75 has configurable resolution starting from 9 to 12 bits. In the present application, we move with the default resolution settings of the sensor that is 9 bits and thus both the STDS75 and STLM75 are dealt with in the same manner.
Table 1. |
Pin description |
|
|
Name |
Description |
|
|
|
|
SDA |
Serial data input output pin |
|
|
|
|
SCL |
Serial clock input pin |
|
|
|
|
Alarm |
Alarm output pin |
|
|
|
|
GND |
DC ground |
|
|
|
|
A0,A1,A2 |
Address lines |
|
|
|
|
VCC |
Supply voltage (2.7 V- 5.5 V) |
|
|
|
This temperature sensor is a high-precision CMOS IC with a delta-sigma analog-to-digital converter (ADC) and I2C compatible serial digital interface. The on board delta-sigma ADC converts the measured temperature to a digital value that is calibrated in degree Celsius.
Negative temperature is shown in two's compliment form. The sensor also has an alarm output signal.
3/15
Digital temperature sensor |
AN2680 |
|
|
The sensor supports the I2C communication protocol. It has 3 configurable address lines, thus can support up to 8 different addresses. All 3 address lines are grounded in the present application and hence the address of sensor is made 0x90.
The sensor is connected to the microcontroller through 2 communication lines of I2C interface (SDA and SCL).
The sensor has 3 internal registers which are used to configure its behavior:
1.Configuration register: Tconfig (8-bit)
2.Oversaturation register: Tos (16-bit)
3.Hysteresis register: Thys (16-bit)
Based on the value configured in the configuration register the behavior of sensor is achieved. In our application these settings are made as 0x40. This setting configures the mode of operation of the sensor and the nature of the output alarm signal. For details, please refer to the STDS75 datasheet.
The value set in the oversaturation register defines the threshold value at which fan starts. In our application the fan starts as the temperature rises above 29 degrees Celsius. Thus the setting for this register is made as 0x1D00. Also as the temperature rises above this oversaturation value the alarm signal turns ON. This alarm is shown as an LED in the system.
A setting in the hysteresis register is used to control the output of the alarm output signal of sensor. It is set at 27 degrees Celsius in our application which means that as the temperature falls below 27 degrees Celsius the alarm goes OFF. Thus the settings for this register are made 0x1B00.
The alarm signal of the sensor is configured to go ON when the measured temperature exceeds 29 degrees Celsius and goes OFF when the temperature falls below 27 degrees Celsius.
4/15
AN2680 |
BLDC fan |
|
|
The basic DC brushless fan is a 2-wire device over which a DC voltage is applied. Brushless DC fans are called "brushless" because the electric motor is commutated electronically.
The basic brushless DC motor consists of two main parts:
a)the rotor
b)the stator
a)Rotor: As the name implies, the rotor is the part that rotates. The rotor houses the permanent magnets, and in the case of the fan, the fan blades are also attached to the rotor. The number of poles in the permanent magnet varies according to the characteristics of the motor.
b)Stator: The stator is the stationary part of the motor. It consists of the motor coil number which varies according to the characteristics of the motor. The stator for the 2-phase motor consists of four coils.
The speed of the DC fan can be modified by varying the DC voltage across the two terminals of the fan motor. However if we take a DC fan and switch on the DC supply across it, the fan motor takes some time to speed up.This is because the fan motor has an inductive coil so it does not respond immediately to the applied voltage. If we switch the power off before the motor reaches full speed, the motor starts to slow down. If we switch the power on and off quickly enough the fan motor and hence the fan run at some speed between the zero and full speed. This is what is achieved through the PWM signal. The fan speed can be modified with the variation in the duty cycle of the PWM signal.
To control the speed of the DC fan using the PWM signal, we need to use a switch which can be switched on and off at PWM frequency and hence control the supply voltage across the motor of the DC fan. This switch can be made by using a high switching speed power MOSFET. The action of switch is to connect and disconnect the power across the fan at PWM frequency.
In low side drive connection, the fan positive terminal is kept at constant DC voltage (5 V for 5 V fan) while the negative terminal of the fan is connected to the drain of power MOSFET. The source of the power MOSFET is connected to ground. The PWM signal is applied to the gate terminal of the power MOSFET, thus the power MOSFET switches between on and off condition at the rate of the PWM signal. When the power MOSFET is ON, the current builds up in the coil of the fan motor and the fan starts to attain speed, whereas when the power MOSFET is off, the fan starts losing speed. Figure 2 illustrates the low side drive transistor.
5/15