Temperature compensated

Temperature Controlled DC Fan using Microcontroller

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. 

Outline

  • Output Video
  • Circuit 1 Temperature Controlled DC Fan using 8051
    • Circuit Diagram
    • Principle
    • Components
    • Configuring ADC0804 for this Project
    • Circuit Design
    • Working
  • DOWNLOAD PROJECT CODE
  • Circuit 2 Temperature Controlled DC Fan using ATmega8
    • Circuit Diagram 
    • Circuit Principle
    • Components
    • Component Description
      • Declaring of internal ADC Registers
    • Temperature Controlled DC Fan Circuit Design
    • Temperature Controlling DC Motor – Circuit Simulation Video
    • How Temperature Controlled DC Fan Circuit using Microcontroller Works?
  • Temperature Controlled DC Motor Project Output Video
  • Applications

Output Video

Circuit 1 Temperature Controlled DC Fan using 8051

Temperature Controlled DC Fan

Principle

The project operates based on the principle of Analog to Digital Conversion (ADC). The LM35 temperature sensor provides analog data, which is then input into the ADC0804 analog to digital converter.

The analog output of the temperature sensor exhibits a variation of 10mV per degree Celsius.

The ADC0804 is an 8-bit ADC, and when used with a 5V reference voltage, it offers a resolution of 5V/28, resulting in a resolution of 20mV. In other words, this is the smallest change in the analog value from the sensor that the ADC IC can detect.

Temperature fluctuations induce changes in the ADC’s output. This digital output from the ADC is directed to the microcontroller, which employs it to ascertain the temperature and subsequently control the fan based on this temperature data.

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

Let’s go through the configuration of the ADC0804 step by step. Initially, we should provide a 5V regulated power supply to the Vcc pin (Pin 20). Then, connect the analog and digital ground pins (Pins 8 and 10) to the common ground (GND).

To utilize the internal clock, we connect a 10KΩ resistor between CLK IN (Pin 4) and CLK R (Pin 19). Additionally, connect a 150pF capacitor between pins 4 and GND to complete the oscillator circuit.

The CS pin (Pin 1) is connected to GND to enable the ADC.

To enable the microcontroller to continuously read data from the ADC, the RD pin (Pin 2) is connected to GND.

For the ADC to continually acquire analog data from the sensor, we link the Write pin (Pin 3) with the Interrupt pin (Pin 5).

The analog output from the LM35 sensor is linked to Vin+ (Pin 6) on the ADC. The negative analog input, Vin-, of the ADC is connected to GND.

The converted digital data, which is an 8-bit value, will be accessible 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.

Let’s outline the fundamental connections regarding the microcontroller. These connections include clock, reset, and EA (External Access) pins. The clock configuration involves employing an 11.0592 MHz crystal and two 33pF capacitors. For the reset circuit, a combination of a 10µF capacitor, a 10KΩ resistor, and a push button is utilized. To pull up the EA pin, a 10KΩ resistor is connected to it.

Now, let’s delve into the connections with regards to other components.

To accommodate the LCD display, a 10KΩ potentiometer is linked to the contrast adjustment pin. The three control pins of the LCD are connected to microcontroller pins P3.6, GND, and P3.7.

The 8 data pins of the LCD are interlinked with PORT1 on the microcontroller.

The basic connections related to the ADC are elucidated in its configuration. The 8 digital outputs originating from the ADC should be linked to PORT2 on the microcontroller.

Moving on to the LM35 component, you should establish a connection from the LM35’s data pin to the analog input pin, namely Pin 6 of the ADC.

Lastly, we need to establish the connection for the relay circuit, which includes a resistor, a transistor, and a relay. Connect this circuit to PORT0 of the microcontroller while externally pulling up PORT0. The input of the relay, i.e., the base of the transistor, should be connected to microcontroller pin P0.0.

Working

The objective of this project is to create an automated temperature-controlled fan system using the 8051 microcontroller. This system operates by automatically switching the fan on or off in response to changes in temperature. Here’s an explanation of how the project functions:

Within this circuit, the LM35 temperature sensor provides a continuous analog output that corresponds to the temperature it detects. This analog signal is then directed to an ADC (Analog-to-Digital Converter), which transforms these analog values into digital ones.

The digital output from the ADC directly correlates to the analog voltage it sensed. To obtain the temperature reading from the analog voltage, specific calculations are necessary, which are programmed into the microcontroller.

Once the microcontroller processes the calculations based on its programmed logic, it proceeds to display the temperature reading on the connected LCD screen. The microcontroller then continuously monitors the temperature.

In accordance with the programmed code, if the temperature surpasses 50 degrees Celsius, the microcontroller activates the relay to initiate the fan. Conversely, if the temperature falls below 40 degrees Celsius, as dictated by the code, the microcontroller takes the appropriate action.

Circuit 2 Temperature Controlled DC Fan using ATmega8

Diagram 

Circuit Principle

The core concept of the circuit is to activate the fan, which is connected to the DC motor, once the temperature surpasses a specific threshold.

Continuous temperature monitoring of its environment is performed by the microcontroller. The temperature sensor acts as a transducer, converting the sensed temperature into an electrical signal. This signal is analog in nature and is directed to one of the microcontroller’s ADC (Analog-to-Digital Converter) pins.

The ATmega8 microcontroller is equipped with six multiplexed ADC channels, each offering a 10-bit resolution. One of these ADC input pins receives the analog signal. Consequently, internal conversion takes place using the successive approximation method.

To carry out ADC conversion, internal registers need to be configured. The ADC pin generates a digital value as its output. The microcontroller then compares this digital value with a predefined threshold. If the value exceeds the threshold, the microcontroller triggers the fan to turn on.

Components

  • Atmega8
  • L293D
  • Lm35
  • DC motor

Component Description

LM35

The LM35, an integrated circuit, serves as a temperature sensor. This sensor provides an output voltage directly proportional to the temperature measured in degrees Celsius. The output voltage of the LM35 changes by 10mV for each degree Celsius of temperature variation.

Typically, the LM35 temperature sensor has a temperature range spanning from -55 to +150 degrees Celsius. To cover this entire range and measure temperatures both below and above freezing, an additional resistor needs to be connected between the data pin and a negative supply (Vcc). However, for the purpose of this project, we will focus on the positive temperature range only, specifically measuring temperatures between +2 degrees Celsius and +40 degrees Celsius during normal operation.

ADC

Natural phenomena are primarily characterized by analog parameters, implying that the majority of real-world data is in analog form. For instance, consider the recording of room temperature.

Room temperature varies continuously over time, creating an analog signal that changes gradually, such as at 1 second, 1.1 seconds, 1.2 seconds, and so forth.

When employing a microprocessor or microcontroller to process real-world data, it is necessary to convert analog signals into digital signals. This conversion allows the processor or controller to read, analyze, and manipulate the data effectively.

The Atmega8 microcontroller is equipped with a built-in A/D converter for this purpose.

Declaring of internal ADC Registers

  1. The ATmega8 microcontroller internally has three register namely ADMUX , ADCSRA, ADC data registers. Analog to digital converter is of 10 bit resolution.
  2. Initially, select the reference voltage to the ADC using ADCMUX register.
  3. Select REFS0 and REFS1 values in ADMUX register to set the reference voltage.
  4. 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.
  1. 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.
  2. 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.
  3. The following bits decide the division factor between XTAL frequency and input clock of ADC
Division factor deciding table

8. Now enable start conversion bit that is ADCSC in ADCSRA register

9. After  the conversion of the value, an interrupt bit is enabled by the  hardware

10. 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 primary components of the circuit include the ATmega8 microcontroller, a temperature sensor, a DC motor, and a driver IC. The temperature sensor is interfaced with the microcontroller’s ADC0 pin, serving as the ADC input.

The temperature sensor possesses three input pins, namely VCC, ground, and the sensor itself. The output pin is positioned in the middle, while the ground and VCC pins are situated on the other two edges. External connections are made for the microcontroller’s VREF and AVCC, which supply power to the ADC. AREF and AVCC pins 20 and 21 are linked to a 5V power source.

The motors are attached to Port B of the microcontroller through a motor driver IC known as the L293D. The input pins of the motor driver are connected to the microcontroller. Specifically, input 3 and input 4 of the motor driver are linked to PB0 and PB1.

Additionally, PB2 and PB3 pins are associated with the input1 and input2 of the motor driver IC. The output pins of the driver IC are connected to the motor. Since the motor comprises two terminals, they 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?

  1. Initially switch the power supply.
  2. Microcontroller starts reading the temperature of the surroundings.
  3. The analog value of temperature is given by the temperature sensor.
  4. This analog value is applied to the analog to digital converter pin of the micro controller.
  5. This analog value is converted to the digital value by the microcontroller using successive approximation method internally.
  6. When the temperature is greater than the threshold value, microcontroller sends a command to the controller to switch the motor.
  7. 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.

 

Tags

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button
Close
Close