Programmable House Thermostat
Contents Overview
OverviewThis webpage describes a microcontroller-based house thermostat which I have built to replace the old one in my house. This is an ongoing project, the documentation is not complete. Feel free to contact me over the email (see at the top of the webpage). DISLAIMER: The device operates with high voltages, so there is a risk of electric shock. Please use all necessary precautions. The device is capable of maintaining convenient temperature when I am home and keep the house from freezing while I am away. A temperature mode is chosen according to the predefined time schedule or manually from the console. The thermostat switches the pump (230V AC) on and off to maintain house temperature within desired limits. The device features a transformer-based power supply and optoinsulated triac driver. Therefore the microcontroller and user interface is galvanically insolated from mains. The device based on Microchip 18F1320 microcontroller and DS1820 digital thermometer. My goal was to build a flexible device which I could eventually improve and add more functionality. So it is most probably not really cost-effective. However, it seems to keep my house warm and it was a lot of fun to build. User interfaceThe user interface is pretty handicapped at the moment:
Yes, to reach the menu I need a laptop and a cable. Green LED indicates power supply working ok. Yellow LED lits when the heater is on. The buzzer makes an annoying sound in case of repeatable failures of the temperature sensor or after power blackout. Main menu looks like this: SCHED 19 08:53:15 1. ON/SCHED/AWAY/OFF 2. Set schedule 3. Set HOME temp 4. Set AWAY temp 5. Set clock 6. Clear alarmThe top line indicates mode, current temperature (in degrees C), and a wall time. Digits 1-6 gives access to the corresponding functions.
Hardware description and schematicsPower moduleThe power supply is a standard regulated one. It consists of:
![]() MicrocontrollerThe device is based on Microchip PIC18F1320 microcontroller. Internal 8MHz internal oscillator is used as a system clock and an external 32 kHz watch quartz crystal for precise timekeeping. For microcontroller programming (upload software into the microcontroller) I use tinybld bootloader. The microcontroller connections:
Software description and source codeThe software is written in C, compiled with CCS C compiler. See Downloads section for the source code, the main program is tempcontroller.c DownloadsThe source code is available here. Draft Eagle schematics and board layout is available here. (C) Alex Bezroutchko, 2005 | ||||||||||||||