I have designed and built this circuit myself, with help from various people and I thought it was all going well until I was running some long tests and found a problem. Below is my circuit, please excuse my bad design as I learnt how to use Eagle as I did this and it probably isn't drawn the way it should be.
I have a transformer supplying 12.6VAC connected to IN_PW1 and IN_PW2.
**broken link removed**
Basically I have an Atmega16 with an HD44780 compatible LCD screen. On the diagram it just shows a connector to the LCD screen. The backlight on the LCD is controlled by the AVR. I have 2 momentary switches that are connected to interrupt pins on the AVR. I have an LDR for measuring light. And I have a 2N2222A transistor switching a 240V relay with a 12v coil. There is also an external oscillator to give me accurate timing. The switches are used to set an On Time and an Off Time and then it just switches the relay on and off continually from that point. The time is shown counting down on the LCD screen. The On Time and Off Time are held in EEPROM too. What I have found is that after running it for quite a few hours of running very short cycles, 5 seconds on and 10 seconds off, the LCD screen was blank and the relay was stuck on. The AVR did not register any switches either, like it has frozen. When I turn off the power and turn it back on it starts again OK, but some time later it freezes again. I am switching a fan in my tests.
I know my circuit can probably be designed much better than my attempts but I was wondering if anyone can see any obvious faults in the design that could cause the Atmega16 to freeze after running OK for quite a few hours?
I have a transformer supplying 12.6VAC connected to IN_PW1 and IN_PW2.
**broken link removed**
Basically I have an Atmega16 with an HD44780 compatible LCD screen. On the diagram it just shows a connector to the LCD screen. The backlight on the LCD is controlled by the AVR. I have 2 momentary switches that are connected to interrupt pins on the AVR. I have an LDR for measuring light. And I have a 2N2222A transistor switching a 240V relay with a 12v coil. There is also an external oscillator to give me accurate timing. The switches are used to set an On Time and an Off Time and then it just switches the relay on and off continually from that point. The time is shown counting down on the LCD screen. The On Time and Off Time are held in EEPROM too. What I have found is that after running it for quite a few hours of running very short cycles, 5 seconds on and 10 seconds off, the LCD screen was blank and the relay was stuck on. The AVR did not register any switches either, like it has frozen. When I turn off the power and turn it back on it starts again OK, but some time later it freezes again. I am switching a fan in my tests.
I know my circuit can probably be designed much better than my attempts but I was wondering if anyone can see any obvious faults in the design that could cause the Atmega16 to freeze after running OK for quite a few hours?
Last edited: