This new digital timer is a very flexible project. We can think of many uses for it but we are sure there are a lot more that we haven’t even considered.
We’ve done lots of timers before but this one has the convenience of remote control. Its timing period can be programmed using the numerical keypad button on the remote, while the remote’s Power/Standby button provides a Reset function.
The simplest way to use it is like a kitchen timer. In this mode, it can count up or down for the timing period, as entered via the keypad on the remote. Pressing the remote’s Channel Up button make the unit count up to the programmed time, while pressing the Channel Down button makes it count down.
When the time runs out, the LED display flashes and a buzzer sounds for a preset period (the default is one minute) or until the reset button is pressed. You can either use the Power/Standby button on the remote to reset the unit or an external reset button.
The internal relay also switches at the end of the timing interval. This relay can directly control a DC device (30V DC or 24V AC max.) or it can indirectly control a mains-powered device via a separate external mains-rated relay (see panel). Note, however, that this unit is definitely NOT RATED to directly switch mains devices.
By default, the relay is energised while the timer is running. As such, the timer could be used to run an oven for the programmed timing period, expose a PC board to UV light, or run a fan or light for a fixed period, etc.
The trigger and reset inputs can be used to automatically start and stop the timer when certain events occur, eg, when a door opens, an external button is pressed or a PIR (passive infrared) sensor is triggered by motion, etc. This means that you could set it up to turn on a light or fan when a door is opened and then subsequently switch the device off when the door is shut or after the programmed period expires.
It could even be used as the basis of a very simple alarm system. All you have to do is connect a PIR sensor to the trigger input, a key-switch to the reset input and a siren to the relay. You then set the timer to a short period (say 30 seconds) and the alarm period to a value that’s longer than the default (say three minutes) and voila! . . . you have a basic motion-triggered alarm with key deactivation.
By the way, the unit will work with virtually any universal remote control that’s capable of transmitting Philips RC5 codes (nearly all do). So if you have a spare universal remote control, it will do the job quite nicely.
Take a look now at Fig.1 for the full circuit details. It’s based on microcontroller IC1 plus three dual 7-segment LED readouts. However, instead of using a PIC micro as in most other projects, this time we’ve opted for an Atmel ATTiny2313 with 2048 bytes of flash memory.
The micro normally runs at 8MHz, as set by an internal 8MHz oscillator and crystal X1. This clock frequency is reduced to 1MHz (via a clock divider) when the micro is in standby mode.
Note that although the micro actually has an internal 8MHz oscillator, the crystal is necessary for accurate timekeeping. Typical crystal error is less than 100ppm or 0.01%, giving a maximum timing error is one second per three hours although it will normally be well under half that.
The unusual part of this circuit is the way in which the six 7-segment LED digits (DISP1-3) are driven. Just 10 of IC1’s 20 pins are used to drive the 48 segments (seven per digit plus the six decimal points). What’s more, we have not used any discrete transistors or current limiting resistors in the LED drive circuit. This makes the project smaller, cheaper and easier to build but how do we get away with it?
First, we are using a “charlieplexing” system (popularised by Charlie Allen at Maxim) which cuts down on the number of pins required to drive the LEDs. This is a special form of multiplexing and to understand how it works, first consider display DISP1. This contains two of the digits and has 10 pins – two common anodes and eight shared cathodes.