Temperature Controlled Fan

Project summary:

A simple project using micro-controller AT89S51 to control the speed of 12V fan according to the surrounding temperature. In this project we use the concept of PWM(pulse width modulation) to increase or decrease the speed of fan. We also interface 2*16 character LCD which shows the outside  temperature through the temperature sensor. Followings are the details of the project

Working Criteria

The Temperature controlled Fan circuit will automatically control the speed of fan according to the temperature. A temperature sensor is used to sense the temperature. The speed of fan increases with the increase in temperature and vice versa. And the temperature sensed by temperature sensor is displayed on the LCD. We programmed the micro-controller to operate the fan above 25oC.

Components Used

  • Microcontroller AT89S51
  • ADC 0804 LCN
  • Opt coupler ILD 74
  • Temperature Sensor LM 35
  • 16×2 LCD display
  • Voltage Regulator L7805
  • Resistors
  • Variable Resistor
  • Capacitors
  • Diodes
  • Transistor TIP120
  • Crystal clock 12MHz
  • Resistance arrays
  • Voltage Supply
  • Electrical Fan 12V

Components Description

Microcontroller AT89S51

The AT89S51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer.

The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, two 16-bit timer/counters, a fivevector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry.

ADC 0804 LCN

The ADC converter is used to convert analog signal to digital signal. The ADC0803 family is a series of three CMOS 8-bit successive approximation A/D converters using a resistive ladder and capacitive array together with an auto-zero comparator. These converters are designed to operate with microprocessor-controlled buses using a minimum of external circuitry. The 3-State output data lines can be connected directly to the data bus.

Opt coupler ILD 74

The IL74 is an optically coupled pair with a Gallium Arsenide infrared LED and a silicon NPN phototransistor. Signal information, including a DC level, can be transmitted by the device while maintaining a high degree of electrical isolation between input and output. The IL74 is especially designed for driving medium-speed logic, where it may be used to eliminate troublesome gound loop and noise problems. Also it can be used to replace relays and transformers in many digital interface applications.The ILD74 has two isolated channels in a single DIP package.

Temperature Sensor LM 35

The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies.

16×2 LCD display

An LCD is a small low cost display. It is easy to interface with a micro-controller because of an embedded controller(the black blob on the back of the board). This controller is standard across many displays (HD 44780) which means many Micro-controllers (including the Arduino) have libraries that make displaying messages as easy as a single line of code.

Voltage Regulator L7805

The L7805 is a three-terminal positive regulator at fixed output voltage, making it useful in a wide range of applications. This regulator can provide local on-card regulation, eliminating the distribution problems associated with single point regulation. It employs internal current limiting, thermal shut-down and safe area protection, making it essentially indestructible. If adequate heat sinking is provided, it can deliver over 1A output current. Although designed primarily as Fixed voltage regulator, this device can be used with external components to obtain adjustable voltage and currents.

Transistor TIP120

The TIP12 is a silicon Epitaxial-Base NPN power transistors. They are intented for use in power linear and switching applications. The complementary PNP types are TIP125, TIP126 and TIP127, respectively.


First of all L7805 voltage regulator is used which converts 12V supply to 5V positive ripple free dc voltage. And capacitors are used to remove AC ripples. The temperature sensor LM35 then senses the temperature from atmosphere. It produces voltage of 10mV for 1oC rise in temperature. Ultimately its provides its voltage produced by temperature to the ADC, which converts its analogue temperature value to digital binary value and it provides this digital binary temperature value to the micro-controller. We programmed micro-controller AT89S51 in such a way, as follows:

•    Temperature < 25oC        , FAN would be OFF
•    25oC < Temperature < 30oC    , FAN would be ON in SLOW speed
•    Temperature > 30oC        , FAN would be ON in HIGH speed

The programming of micro-controller is in assembly language, which is given below. And micro-controller is interfacing with several devices.
•    Interfacing with LCD to display Temperature.
•    Interfacing with ADC to get Temperature’s instruction.
•    Interfacing with opt-coupler to control the FAN.

Resistance arrays (9-pin) are used in interfacing, to pull-up the network. And crystal clock of 12MHz, with capacitors is used between pin-18 & pin-19 of AT8951. And a capacitor (10µF) and a resistance is attached with pin-9.
And pin-6 of micro-controller is programmed to control speed of Fan by varying frequency. Pin-6 output is given to the optocoupler. Transistor TIP120 is used here. A capacitor is attached to run the Fan at startup, as shown in circuit diagram. The block schematic of circuit is something like as follows:


The working video of the project:

Download attachment

0 0 votes
Notify of

Inline Feedbacks
View all comments
11 years ago

i have selected this project and now i am done with all the components …will u please tell me the values of VCC of all the components….and please tell me the voltage rating of your fan which u used above..

11 years ago

The circuit which i hardwired….is not working..!!
I am not able to figure out the problem.Can you plz tell me the possible problems that would have occured with it..?