This project was actually designed to automatically switch on & switch off the  garden sprinklers. This is basically a clock with control over the duration of alarm(on & off time) so it doubles as a timer too. The on and off time of the alarm can be set using the push buttons .When the clock reaches the ‘alarm on’ time the relay gets activated and it is deactivated when the clock reaches the ‘alarm off’ time. The device has also a temperature sensor attached and the room temperature is displayed in the LCD along with the time.


Note : power supply pins are not shown in the diagram(connect pin 8 & pin 22 to ground , connect pin 7 to Vcc).use l7805 to provide regulated 5v DC.X1 is 16Mhz crystal

The timer1 is configured in such a way to call the compare match ISR every 1ms . This is used to update the seconds , minute & hour count. The user can set time & alarm using micro switches S1 to S5.
S1      =     alarm on set
S2      =    alarm off set
S3      =    time set
S4      =    hour
S5      =    minute

To set time :
     Press S3 & S4 together for hours
     Press S3 & S5 together for minutes

To set alarm on time:
     Press S1 & S4 together for hour
     Press S1 & S5 together for minutes

To set alarm off time :
   Press S2 & S4 together for hour
   Press S2 & S5 together for minute

To activate/deactivate alarm:
    Press and hold S4 & S5 together

The temperature sensor used is LM35 ,its output voltage changes linearly with temperature . The ADC of the microcontroller reads this value , then suitable scaling is done & the value is displayed onto the LCD. The temperature is displayed in celsius scale.
Note : for more information about this refer to atmega8(topic-ADC) & LM35 datasheet.  

    above is the image of the timer installed near a hoarding


  1. hello
    when i build the project an error happened
    multiple definition of 'lcd_init'
    what can i do ?

  2. sa, sorry , but we know good company in this called asecomisr

  3. hai sandeep please clarify how to burn hex file and fuse setting