Ceska verze

Digital thermostat with AVR

     Introduction:
This universal digital thermostat allows you to control heating and cooling systems - heaters, heat pumps, air conditioning, refrigerators, freezers, etc. It can be also used as thermal protection switch or adjustable ventilation to prevent overheating of a machine. Desired temperature of cooling, heating and a hysteresis can be digitally set. This setting is retained in EEPROM memory even when power is disconnected. It can operate in cooling mode, heating mode and also in combined mode (automatic temperature regulation using both cooling and heating). Outputs can control power elements such as relays or optotriacs.
     Schemtic:
The heart of the circuit is a microprocessor IO1 - Atmel AVR ATmega8A / ATmega8 / ATmega8L. To sense the temperature sensor IO2 (MCP9700A) is used. Its output voltage is proportional to temperature (10mV/°C + 500mV). The output is evaluated by AD converter, which is part of the AVR. For more accurate measurement, external voltage reference IO3 - TL431 is used. P1 trimmer is set so that the AREF (pin 21) voltage is 2.048V. To display the menu, a superbright 4-digit LED display and two LEDs are used.
     Description:
Pin 19 (Blue dot) = cooling output.
Pin 18 (Red dot) = heating output.

Jumper DP1 - Hardware heating disable (system used only for cooling. Omit LED1. Heating output not used.)
Jumper DP2 - Hardware cooling disable (system used only for heating. Omit LED2. Cooling output not used.)
(Connect one or no jumper. Connecting both jumpers turns the thermostat into ordinary thermometer.)

LED1 shining = Heating enabled, LED1 blinking = Heating active.
LED2 shining = Cooling enabled, LED2 blinking = Cooling active.

TL1 - disabling / enabling heating (basic screen) or "+" (in setup mode)
TL2 - disabling / enabling cooling (basic screen) or "-" (in setup mode)
TL3 - setup. Switching between the actual temperature display (1 decimal digit) and the temperature of heating and cooling (Note: What is disabled is not displayed).
Long press of TL3 = set hysteresis. Displays "H" symbol and hysteresis value. Set hysteresis using + and - buttons.

Cooling temperature is automatically set at least 1° C above the heating temperature, so that heating and air conditioning can't be running both simultaneously or alternately. In case of more significant temperature overshoots however, the temperature difference has to be set even larger manually.
-Desired temperature can be set in increments of 1°C, range is -40 ... +150 °C, displayed without decimal digit.

Example: Hysteresis is set to 2°C. Heating temperature is set to 20°C. Thus, heating starts at 19°C and stops at 21°C. Cooling temperature is set to 28°C. Thus, cooling starts at 29°C and stops at 27°C.

The program for free download:
Source code in assembler (ASM)
Compiled HEX file (1724 Bytes)
How to write the program into the AVR is described here.

I can send you the programmed microcontroller. For more info click here.


Schematic of the simple AVR digital thermostat with ATmega8(A)(L).


Configuration bits setting


Testing in breadboard.


Video - testing the thermostat (used for heating only).



Added: 1. 10. 2012
home