Temperature Based Fan Speed Control And Monitoring Using Arduino

By Biswajit Das


This project is a standalone automatic fan speed controller that controls the speed of an electric fan according to the requirement. Use of embedded technology makes this closed-loop feedback-control system efficient and reliable. The microcontroller (MCU) ATMega8/168/328 allows dynamic and faster control and the LCD makes the system user-friendly. Sensed temperature and fan speed levels are simultaneously displayed on the LCD panel.

The project is very compact and uses a few components only. It can be implemented for several applications including air-conditioners, water-heaters, snow-melters, ovens, heat-exchangers, mixers, furnaces, incubators, thermal baths and veterinary operating tables. The project will help save energy/electricity.

Circuit and working

Fig. 1: Circuit diagram of the temperature-based fan speed control and monitoring using Arduino
Fig. 1: Circuit diagram of the temperature-based fan speed control and monitoring using Arduino

Circuit diagram of the temperature fan speed control and monitoring is shown in Fig. 1. It is built around Arduino Uno board (Board1), 16×2 LCD (LCD1), temperature sensor LM35 (IC1) and a few other components.

Arduino is at the heart of the circuit as it controls all functions. LM35 is a precision integrated circuit whose output voltage is linearly proportional to Celsius (Centigrade) temperature. It is rated to operate over a -55°C to 150°C temperature range. It has +10.0mV/Celsius linear-scale factor.

Screenshot of the source code on Arduino IDE
Fig. 2: Screenshot of the source code on Arduino IDE

Temperature sensor LM35 senses the temperature and converts it into an electrical (analogue) signal, which is applied to the MCU through an analogue-to-digital converter (ADC). The analogue signal is converted into digital format by the ADC. Sensed values of the temperature and speed of the fan are displayed on the LCD. Temperature and monitoring using Arduino The MCU on Arduino drive the motor driver to control fan speed.

Fan speed control technique

A low-frequency pulse-width modulation (PWM) signal, usually in the range of about 30Hz, whose duty cycle is varied to adjust the fan’s speed is used. An inexpensive, single, small pass transistor can be used here. It is efficient because the pass transistor is used as a switch.

One disadvantage of this approach, however, is that it can make the fan noisy because of the pulsed nature of the signal. The PWM waveform’s sharp edges cause the fan’s mechanical structure to move (like a badly-designed loudspeaker), which can easily be audible.

Construction and testing

Actual-size PCB pattern of the temperature-based fan speed control and monitoring circuit using Arduino
Fig. 3: Actual-size PCB pattern of the temperature-based fan speed control and monitoring circuit using Arduino

A single-side PCB for the temperature-based fan speed control and monitoring circuit is shown in Fig. 3 and its component layout in Fig. 4. Assemble the circuit on the PCB.

Component layout of the temperature-based fan speed control and monitoring circuit using Arduino PCB
Fig. 4: Component layout of the PCB

CON2 and CON3 are used to connect Board1 (Arduino UNO board) through external connectors. A 12V battery is used to drive the 12V DC-operated fan.

Download PCB and Component Layout PDFs: click here


Software for the automatic temperature controller and monitor circuit is written in Arduino programming language. Arduino Uno is programmed using Arduino IDE software.

ATmega328P on Arduino Uno comes with a pre-programmed bootloader that allows users to upload a new code to it without using an external hardware programmer.

Connect Arduino board to the PC and select the correct COM port in Arduino IDE. Compile the program (sketch). Then select the correct board from Tools Board menu in Arduino IDE and upload the sketch (abfc.ino) to Arduino through standard USB port.

Download the source code: click here

Biswajit Das was manager – R&D, EFY Labs till recently.

This article was first published on 16 December 2016 and was updated on 20 August 2019.



  1. Couldn’t understand the relation between fan speed and temperature. Can you plz explain
    “fan speed=temp;
    fan speed=1.5*fan speed” ?

  2. what if I dont want to use the lcd?? Do I just need to erase all the lcd thing in the coding or I need to do a new coding?

  3. hello Sir need to use this techknowledge in radiator cooling fan.
    We need some information about this. could you please call on 8983767988

  4. I feel BD139 is not suit in this circuit . Because Bd 139 require 500mA at base to work in its maximum efficiency . but here arduino has only 40 mA out and i suspect the current hitting at base after the resistance 1K. i think N channel mosfet is more suit on this circuit to deliver maximum amount of current to DC motor

  5. My request is, Please re calculate the collector current by multiplying the base current with DC current gain of transistor. i feel this motor driving circuit require multiple transistors so that it can deliver higher current when the fan is in high speed mode

  6. Could you please share some more details, how to control celing fan with this.. ? Which component need to change or Add ?
    Thanks in advance..

  7. PCB has a problem. Pin 5 of lcd is ground and it is connected to digital pin 6 of arduino. Instead digital pin 6 should be connected lcd pin 6 according to circuit diagram. It is better to use an non power transistor to drive the motor. Programme needs lot of corrections


Please enter your comment!
Please enter your name here