Temperature Controller

Description

This project works as a temperature controller (proof of concept). An ATmega16 microcontroller reads the temperature from two sensors and regulates the speed of a fan accordingly.

Work objective. Increase the knowledge of programming of serial interfaces on the ATmega16 microcontroller in the field of embedded systems.

Parts used

  • ATmega16
  • TC74 temperature sensor (TWI)
  • LM35 temperature sensor (analog)
  • Push buttons
  • LCD screen
  • DC motor
  • L293D motor driver

Tasks

  1. The temperature, which was recorded with the TC74 digital temperature sensor, should be transmitted to the microcontroller through the TWI serial interface and displayed on the LCD screen in the first line.
  2. The temperature, which was recorded with the LM35 analog temperature sensor, should be transmitted to the microcontroller and displayed on the LCD screen in the second line.
  3. It must be possible to control the speed of the DC fan motor in manual mode with two buttons. You can choose the step between different speeds independently. The fan motor should work at least in three different speeds.
  4. The DC fan motor should also have an automatic control mode. Button No. 3 should allow changing the DC fan motor control mode: manual or automatic. The selected control mode should be displayed on the LCD screen (the LCD screen may contain just the first letter: M for manual, A for automatic).
  5. The DC fan motor has to work in two different speeds in automatic mode depending on the temperature of the TC74 sensor: 0–10 °C the motor does not rotate; 11–20 °C the first speed; > 20 °C the second speed.
  6. Temperatures of the LM35 and TC74 sensors should be compared all the time. When the temperatures from both sensors vary by more than 5 °C, the "System Error" message should be displayed on the LCD screen. When the difference is reduced to less than 5 °C, the LCD should show the parameters from tasks 1–5 again.

Source and schematic

The source and the schematic are available on GitHub.

Circuit schematic: ATmega16 wired to a TC74 and an LM35 sensor, a 16x2 LCD, three push buttons and an L293D driving a DC fan
Schematic.
Simulation with the LCD showing TC74: 6 and LM35: 6 in automatic mode (A), fan stopped
Automatic mode.
Simulation in manual mode (M) with the fan running
Manual mode.
Simulation with the LCD showing System Error because the two sensors disagree
Sensors disagree by more than 5 °C.

Back to all projects