I have learned about the pic microcontroler for a period of time and have a reasonable amount of knowledge about handling digital electronics. I have worked on basic electronic projects and now I need to work on some commercial applications.
My question is about how to design and build reliable and long lasting circuits. I built a automatic light controller circuit which takes the input from a LDR and displays the value of the analogue reading on a seven segment panel. Then it does some calculations and controls a light through a relay. This circuit needs to be switched on permanently(24 hours a day). The first few months the circuit worked perfectly ,but after about 6 months it started malfunctioning. It showed senseless things on the 7 segment display(it showed just parts of numbers), then it lights the bulb on the indicator LED but it's not switching on the relay.This is not the expected behaviour. The thing is it won't always work that way. Sometimes it works perfectly. Then it starts again to malfunction. There is no exact order in which it works.
Now my question is why do these circuits behave this way. I assume this may be because it works all day without any intervals.This kind of application needs to work all the day. I use PIC because I know about pic only. Is atmal more reliable than pic? (I asked because atmal is used in most of automation applications,more frequently than the pic is used) I need some advice from an expert in digital electronics. How is this kind of industrial applications built? Are there any special rules to follow? How to design more reliable circuits? Any advice or guidance from an expert will be highly appreciated. Thank you...
As it's suggested in the answers,I'll edit my answer by providing additional resources to help figure out the bugs in the design.
Below is an image describing how the circuit looks like after it was built. It's a 12V center tapped transformer which supplies power to the circuit.It's rectified using a half wave rectifier, then regulated using a 7805 IC.
Below is the schematic design.
If any additional information is needed I will provide everything needed. If the program is needed I'll add it. The program is somewhat long.It uses interrupts.