Long Duration Timer using ATtiny2313 Schematic Circuit Diagram
This timer circuit is designed to switch on a 12 V load in a solar-powered installation for a preset period at the press of a button. When the period has expired a latching relay disconnects both the load and the controller circuit from the 12 V supply. The length of the period can be configured by making suitable changes to the microcontroller’s source code. When button S1 is pressed a voltage appears across relay coil L1, and the relay switches the load on. Since the relay is a latching type, it remains in this state when the button is released. There is now a supply to the 78L05 voltage regulator (a low-dropout type such as the LP2950CZ-5.0 may also be used) and the microcontroller is powered up.
In the microcontroller the timer program runs until the configured time interval has elapsed. Around 90 % of the way through the time period LED D2 lights as a warning that the load will shortly be switched off, and this time can also of course be configured by changing the software. When the full time interval has elapsed the microcontroller sets an output (pin 7) high, which triggers the CNY 17-3 optocoupler and in turn drives relay coil L2. The relay returns to its initial state, disconnecting the load as well as the controller (which is also powered via the relay contact) from the 12 V supply.
The author used a miniature 16-by-2 LCD panel type HMC16223SG in his prototype, measuring just 52 mm by 20 mm. It is of course possible to use any standard LCD module that uses an HD44780-compatible controller. Note that P1 is used to adjust the contrast of the LCD: if the display appears blank it is worth checking the contrast setting before suspecting a more serious problem! If desired, the LCD can be dispensed with, along with the corresponding parts of the source code. The upper line of the LCD shows the total time period, in seconds, for which the software is configured, while the lower line shows the time, in seconds, since the button was pressed. The screendump shows the LCD settings under BASCOM-AVR. The source code for the program is available for download at .