|Finished unit mounted on the wall, in use.|
This project, like others before, has started out of need: our 30+ year old mechanical timer for the central heater of the house has finally given it up. It would have been faster and cheaper to get a replacement from the local hardware store, but I decided to learn something new and I set out to create a digital version of it.
I wanted to create something simple, something that anybody can use without any experience in electronics – i.e. not a geeky device that could only be used by me, but something that anyone living in the building could set up properly, given a User’s manual.
I did a quick research asking people in the building (mostly relatives) about what functions they would like to see in the new timer. As much as I wanted to cram as many features in the device as I possibly could I had to leave most of my ideas for another project – the consensus was to be able to set up periods of time (from now on: time slots) within a day when the heating is on. Period.
However, with some modifications in the firmware new features, like time slots set up for any day of the week or month, could be easily added.
With minor modifications of the hardware this could be extended to several channels, i.e. more than one “item” could be programmed to be switched on/off in a given time slot.
This timer is currently used as a timer switch for the central heating of the house, but it can switch pretty much anything you attach to it. I will still refer to the output as heater for the rest of the article.
As usual, this project is available as kits or fully built units – for details, please drop me a line.
I based the circuit around a Microchip PIC18F4550 microcontroller, because I had been experimenting with them for a while and want to learn them. I have both TTH and SMT versions of the chip, so I can use one for prototyping and the other for the final PCB.
Timekeeping is done by a Maxim/Dallas DS1307 real time clock chip which communicates with the micro controller using I2C. Operation is backed up with a battery so that after a power break time is not lost.
The user interface is nothing fancy – it consists of a 16*2 LCD and 6 momentary switches (pushbuttons). Using the buttons the device can be configured and the LCD display provides feedback. An LED is also used – it shows if the heater is currently on. This is needed, because the layout of the house is such that the heater is far away from this control device, so there is no visual/audio feedback for the user to know if the heater is on or off.
|The circuit is very simple, made up of only a handful of blocks.|
The heater is switched on and off using a small 12V relay. There are no high currents to switch, so using a small, PCB mounted relay makes the device compact.
|Front side of PCB. PCB size is about 100mm * 75mm.|
|Back side of PCB.|
The unit is powered with a common 12VDC wall adapter.
One of the reasons for using a 18F4550 is that I wanted to start learning C programming on PIC microcontrollers. I found this PIC to be ideal for learning C on PICs as it is optimized for C, has plenty of program memory and it has a wealth of supporting material on the internet.
Timeslot settings are saved in the PIC’s EEPROM, so after a power break the settings are intact.
The firmware is written in C18, compiled with the free version of Microchip’s C18 (v3.41) compiler.
To get a copy of the firmware, please drop me a line.
I used SMT parts for most of the parts to keep PCB size minimal. The final PCB size is 10cm * 7.5cm (4″*3″). The PCB is not very densely populated, because there are a few relatively large parts that dictated a sort of “comfortable” size.
The LCD is the most demanding part: it’s big and it should also be placed in a location where it looks good. I decided to put it in the centre, slightly towards the top. I placed the buttons on the side – 3 on either side of the LCD. The LED (that shows if the heater is on) is placed under the right hand side buttons.
The 12VDC connector is in the lower left area of the PCB while the switched output of the relay is placed in the lower right corner to be far away from anything else on the PCB. I used SMK sockets as switched output connectors.
An “always on” function can be set up by creating a time slot 00:00->23:59.
An “always off” function can be set up by deactivating all the time slots.
Overlapping time slots can also be set up.
By activating/deactivating specific time slots we can accommodate a wide range of heating policies for different kinds of cold days in the winter.
|This is the default screen.|
|Menu item #1.|
|Menu item #2.|
|Menu item #3.|
Once the desired menu is selected the values can be changed by the Up/Down buttons. When there are multiple values to be changed (i.e. hours and minutes), the Right button loops through them.
The user can accept and store the new values using the Enter button or abort changes using the Cancel button.
|Whenever new values are stored this confirmation is displayed as user feedback.|
In any menu, if there is no button pressed for a few seconds the menu is aborted and the screen returns to displaying date and time.
The Boost button can be used any time to start the heater for 60 minutes. This is independent of any timeslot setting. Pressing the Boost button while it is already in boost mode will switch it off.
|Pressing the boost button causes the timer to switch on immediately for 60 minutes.|
|Pressing it again ends the “boost period” immediately.|
To illustrate usage I took a few “screenshots” of the different modes (WOW, on these close-ups you can really see the dust settled on the prototype!):
|The flashing underscore means that the Up and Down arrows have effect on this element.|
|A timeslot is about to be edited|
|The “*” symbol means that this timeslot is active. When entering edit mode, this is the default item to change, for ease of use.|
This project is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.