Fan and temperature controller in rack box
Fan and temperature controller, showing temperature and set points for fan and alarm on the LCD. Temperature sensor LM35 can be seen sticking out.

The module uses an LM35 sensor for measuring the temperature, it is a pre-calibrated IC with output voltage linearly-proportional to the Centigrade temperature. This is read directly by the internal AVR ADC, and turned into actual degrees with a simple calculation. The fan is powered by an PWM output, giving it variable speed. Set points for the fan and alarm can be adjusted and is saved to EEPROM.

Table of content


When the temperature reaches the setpoint; the fan will start on speed 1. After 30 seconds the speed is increased to level 2, unless the temperature has dropped below the setpoint. If the temperature rises above the setpoint speed is set to level 3, which is the maximum. The alarm is triggered if the temperature is equal to the alarm set point for more than 30 seconds. It is possible to override the fan with the override switch, or with an external signal. When overridden the fan speed is increased by 2, meaning if 0 then 2, or if 1 or 2 then 3.


Two values are stored in EEPROM; fan and alarm setpoint. These are non-volatile, meaning that they are not lost if the module is without power. Setpoints are saved to the EEPROM about five minutes after they have been changed, to avoid unnecessary writes. When values are changed but not yet saved, a E is displayed in the right corner if the LCD. The setpoints is adjusted using the (on)-off-(on) switches, one degree at the time.

Formula to calculate temperature

Value * 5
--------- = 'C (+- 0.5)


Input pins

  1. PB3 Fan setpoint +
  2. PB4 Fan setpoint -
  3. PB6 Alarm setpoint +
  4. PB7 Alarm setpoint -
  5. PB5 Override fan switch
  6. PC0 Temperature (Analog)

Output pins

  1. PD0 LCD1
  2. PD1 LCD2
  3. PD2 LCD3
  4. PD3 LCD4
  5. PD6 LCD5
  6. PD7 LCD6
  7. PB0 Heartbeat signal
  8. PB1 Fan (PWM)
  9. PB2 Temp alarm

D-Sub 9-pin connector

  1. 0V
  2. +5V
  3. Heartbeat signal
  4. Fan
  5. Temp alarm
  6. LCD background light switch
  7. Override fan switch

Front panel

Fan and temperature controller in rack box
Fan and temperature controller, with LCD back light on. Temperature sensor LM35 can be seen sticking out.


  • (on)-off-(on), fan temp +/-
  • (on)-off-(on), alarm temp +/-
  • on-off, override fan
  • on-off, background light LCD


  • Green, CPU running
  • Green with lens, fan active
  • Red with lens, temp alarm


Fan and temperature controller LCD simulation
Simulating LCD output while programming.

Below are the different messages and statuses shown on the LCD display.

25C F:30C A:30C*
Fan & Temp Unit!
SW v.2.0
System start =)

Please leave a comment or tweet if you have any questions or feedback on this project.


Schematic drawing

Fan and temperature controller circuit
Schematic drawing for fan and temperature controller; with AVR ATmega8, LM35 and LCD.

Source code


Reads temperature and controls a fan using a PWM output, written with BASCOM-AVR.

Master Releases

0 0 0 v2.0 Visual Basic 4 months ago

Image gallery

Parts list

Project: Fan and temperature controller with LCD by Thomas Jensen is licensed under CC BY-SA 4.0 with attribution required.

Similar projects

  •   Created Jul 14, 2006
  •   Last modified 5 days ago
  •   Project status: Scrapped