I m recently doing a project of a lighting system. Which the leds will on and off with a 15 minutes interval at mid night, and turn on or off according to the surrounding light intensity in the rest of time.
The arduino works fine for the first 3-4 hours, then it stop working until I replug the power supply of arduino. (I use a dc power supply to provide 12v to vin pin as power source of arduino).This problem is also exist when the power source of arduino is pc usb port.
The logic flow of my code :
While 0000 - 0800, the leds on and off in 15 minutes interval
For the rest of the time, the leds turn off when the light intensity below 100 lx, else the leds turn on.
Besides there is a timer1 interrupt initialize with 1s to serial print the timestring in order to check if the time is right.
Hardware list:
10w Led x 2 (vf=7-10V, I=900-1000mA)
I tired so many way to solve this problem, and the problem still exist. I m not sure what can I do now, any sugguestion or information are appreciated. Thanks for help.
Nick_Pyner:
I see your code is a model of perfection and utterly blameless. Why not post it then - just as an inspiration to others.
Thanks for remind, here is my code.
I m now trying to use different supply to power my arduino, and the arduino is freeze after running for 30mins to 90 mins. Power arduino through usb cable run longer than power it through vin pin with 12V. And it works fine until I replug it.
I m not sure wt is the problem, is there any suggestion? Thank you for reply.
A good quality power supply is essential for cheap electronics parts.
Try using a good 5V regulated power supply with more than enough amps for your project. Smoothing capacitors may also help. Could power problems from the electricity supply company be an issue?
As another aside, shouldn't 12V be put into raw and not vin? Just wondering.....
V-in is sometimes called raw.
It's the input of the onboard voltage regulator.
Some Arduinos can handle 12volt (without sensors on the 5volt or 3.3volt pin) better than others.
12volt is borderline for the 5volt regulator. It might get hot over time, and shut down.
The Arduino will restart (if you're lucky).
Tell us whiich Arduino (and supply) you have, so we can give better advice.
Leo..