A Temperature Controlled DC Fan is a system which automatically turns on a DC Fan when the ambient temperature increases above a certain limit.
Generally, electronic devices produce more heat. So this heat should be reduced in order to protect the device. There are many ways to reduce this heat. One way is to switch on the fan spontaneously.
This article describes two such circuits that automatically, switches the fan when it detects the temperature inside the device greater than its threshold value.
Table of Contents
- Output Video
- Circuit 1 Temperature Controlled DC Fan using 8051
- DOWNLOAD PROJECT CODE
- Circuit 2 Temperature Controlled DC Fan using ATmega8
- Temperature Controlled DC Motor Project Output Video
- Applications
Output Video
Circuit 1 Temperature Controlled DC Fan using 8051
Circuit Diagram
Principle
The project works on the principle of Analog to Digital Conversion. The Analog data from the LM35 temperature sensor is given to the analog to digital converter ADC0804.
The analog output of the temperature sensor will vary at 10mV per degree Celsius.
ADC0804 is an 8-bit ADC. For a reference voltage of 5V, we’ll get a resolution of 5V/28 = 20mV. Which means, this is the minimum change in the analog value from the sensor which is recognisable by the ADC IC.
As per the changes in the temperature, the output of the ADC is generated. The digital output of the ADC is given to Microcontroller to calculate the temperature and control the fan accordingly.
Components
Microcontroller Section
- AT89C51 Microcontroller
- AT89C51 Programmer Board
- 11.0592 MHz Quartz Crystal
- 33pF Ceramic Capacitor
- 2 x 10KΩ Resistor
- 10µF Electrolytic Capacitor
- Push Button
- 16 X 2 LCD Display
- 10KΩ POT
Temperature Sensor Section
- LM35
- ADC0804
- 10KΩ Resistor
- 150pF Ceramic Capacitor
- 1KΩ x 8 Resistor Pack
Load Section
- 2N2222 NPN Transistor
- 1N4007 Diode
- 12V Relay
- 1KΩ Resistor
- Fan
Configuring ADC0804 for this Project
The configuration of the ADC0804 is explained here. First, we need to connect the 5V regulated power supply to the Vcc pin (Pin 20). Then, connect the analog and digital ground pins (Pins 8 and 10) to the GND.
In order to use the internal clock, we need to connect a 10KΩ resistor between CLK IN (Pin 4 and CLK R (Pin 19) and then, connect a 150pF cap between pins 4 and GND to complete the oscillator circuit.
The CS pin (Pin 1) is connected to GND to enable the ADC.
In order to read the data from the ADC continuously by the microcontroller, we need to connect the RD pin (Pin 2) to the GND.
For the ADC to continuously read the analog data from the sensor, we need to short the Write pin (Pin 3) with the Interrupt pin (Pin 5).
The analog output of the sensor (LM35) is connected to the Vin+ (Pin 6) of the ADC. The negative analog input pin i.e. Vin- of the ADC is connected to the GND.
The converted digital data which is an 8-bit data will be available at DB0 to DB7 (Pins 18 to 11).
Circuit Design
The main components of the project are 8051 Microcontroller, 16×2 LCD Display, LM35 Temperature Sensor, ADC0804, Relay and Fan.
The basic connections with respect to microcontroller include clock, reset and EA. Clock consists of an 11.0592 MHz crystal and two 33pF capacitors. The reset circuit consists of a 10µF capacitor, 10KΩ resistor and a push button. The EA pin is pulled high with a 10KΩ resistor.
Now we’ll see the connections with respect to other components.
For the LCD display, a 10KΩ pot is connected to contrast adjust pin. The three control pins of the LCD are connected to the pins P3.6, GND and P3.7.
The 8 data pins of the LCD are connected to PORT1 of the microcontroller.
The basic connections with respect to ADC are explained in its configuration. The 8 digital outputs of the ADC must be connected to PORT 2 of the microcontroller.
The next component we are going to connect is LM35. Connect the data pin of the LM35 to the analog input pin i.e. Pin 6 of ADC.
Finally, we need to connect the Relay circuit consisting of resistor, transistor and relay to the PORT0 of the microcontroller with PORT 0 pulled-up externally.
Connect the input of relay i.e. base of the transistor to P0.0 pin of the microcontroller.
Working
The aim of this project is to design a temperature controlled fan using 8051 microcontroller, in which the fan is automatically turned ON or OFF according to the temperature. The working of the project is explained here.
In this circuit, the LM35 temperature sensor will give continuous analog output corresponding to the temperature sensed by it. This analog signal is given to the ADC, which converts the analog values to digital values.
The digital output of the ADC is equivalent to sensed analog voltage.
In order to get the temperature from the sensed analog voltage, we need to perform some calculations in the programming for the microcontroller.
Once the calculations are done by the microcontroller according to the logic, the temperature is displayed on the LCD. Like this, the microcontroller will continuously monitor the temperature.
If the temperature exceeds more than 50 deg Celsius (as per the code), the microcontroller will turn on the relay to start the fan. If the temperature drops below 40 deg Celsius (as per the code).
Circuit 2 Temperature Controlled DC Fan using ATmega8
Circuit Diagram
Principle of Circuit
The main principle of the circuit is to switch on the fan connected to DC motor when the temperature is greater than a threshold value.
The microcontroller continuously reads temperature from its surroundings. The temperature sensor acts as a transducer and converts the sensed temperature to electrical value. This is analog value which is applied to the ADC pin of the microcontroller.
The ATmega8 microcontroller has six multiplexed ADC channels with 10 bit resolution. The analog value is applied to one of the input ADC pins. Thus conversion occurs internally using successive approximation method.
For ADC conversion, internal registers should be declared. The ADC pin outputs a digital value. This is compared with the threshold value by the controller which switches the fan if value is greater than threshold.
Do you know about The Working of Stepper Motor Control Circuit using 8051 Microcontroller?
Components
- Atmega8
- L293D
- Lm35
- DC motor
Component Description
LM35
The LM35 is an integrated circuit sensor that can be used to measure temperature. The output voltage of this sensor is proportional to the temperature in degree Centigrade. The output voltage of the LM35 will vary at a rate of 10mV per degree Celsius.
Usually, the range of the LM35 temperature sensor is from -55 deg C to +150 deg C. To measure this full range of temperatures i.e. from negative range to positive range, we need to connect an external resistor between the data pin and a negative supply of Vcc.
Any way, we are not going to consider the negative temperature range in this project. So, under normal operating conditions, we can measure the temperature in the range from +2 deg C to +150 deg C.
ADC
All the parameters of nature are of analog i.e. most of the data in the real world is characterised by analog signals. For instance, if the temperature of the room is measured.
The room temperature varies with time continuously. This measured signal, which continuously changes with time say from 1sec , 1.1sec , 1.2 sec and so on is called Analog signal.
In order to manipulate the real world data using a microprocessor or a microcontroller, we need to convert the analog signals to the digital signals, so that the processor or controller will be able to read, understand and manipulate the data.
Atmega8 has internal Analog to digital converter.
Declaring of internal ADC Registers
- The ATmega8 microcontroller internally has three register namely ADMUX , ADCSRA, ADC data registers. Analog to digital converter is of 10 bit resolution.
- Initially, select the reference voltage to the ADC using ADCMUX register.
- Select REFS0 and REFS1 values in ADMUX register to set the reference voltage.
- Now select the ADC channel using MUX0-MUX3 bits in ADMUX register. Below given table shows the binary value to be placed in the MUX0-MUX3 bits to select a channel.
- If the sensor is connected to ADC0 channel with AVCC with external capacitor at AREF pin, then the binary value to be assigned to the ADMUX register is ADMUX=0b01000000.
- Now select the pre scalar value using ADPS0, ADPS1 and ADPS2 bits of ADCSRA register and also enable ADC using ADEN bit in ADSCRA register.
- The following bits decide the division factor between XTAL frequency and input clock of ADC:
- Now enable start conversion bit that is ADCSC in ADCSRA register.
- After the conversion of the value, an interrupt bit is enabled by the hardware
- Wait until interrupt bit ADIF is set to 1.
The result is stored in two data register of ADC that is ADCL and ADCH. Now read the digital value from these registers
Temperature Controlled DC Fan Circuit Design
The circuit mainly consists of ATmega8 microcontroller, temperature sensor, DC motor, driver IC. Temperature sensor is connected to the input of the ADC pin i.e. ADC0 pin of the microcontroller.
Temperature sensor has three input pins, VCC, ground. Middle one is output and the other two pins are ground and VCC. VREF and AVCC for the ADC are applied externally to the microcontroller. Pin 20 and 21 are AREF and AVCC pins connected to the supply voltage of 5v.
Port B of the microcontroller is connected to the motors through a motor driver IC i.e. L293D. Input pins of the motor driver are connected to the microcontroller. PB0 and PB1 are connected to the input 3 and input 4 of the motor driver IC.
PB2 and PB3 pins are connected to the input1 and input2 of the motor driver IC. Output pins are connected to the motor. As the motor has two pins, these are connected to the output pins of the driver IC.
Temperature Controlling DC Motor – Circuit Simulation Video
How Temperature Controlled DC Fan Circuit using Microcontroller Works?
- Initially switch the power supply.
- Microcontroller starts reading the temperature of the surroundings.
- The analog value of temperature is given by the temperature sensor.
- This analog value is applied to the analog to digital converter pin of the micro controller.
- This analog value is converted to the digital value by the microcontroller using successive approximation method internally.
- When the temperature is greater than the threshold value, microcontroller sends a command to the controller to switch the motor.
- Thus fan starts rotating.
Temperature Controlled DC Motor Project Output Video
Applications
- Temperature Controlled DC Fan can be used to control the temperature of devices, rooms, electronic components etc. by monitoring the temperature.
- Can be extended to PWM based output, where the speed of the fan can be varied according to the duty cycle of the PWM signal.
- The circuit can be used in CPU to reduce the heat.
Source: Temperature Controlled DC Fan using Microcontroller