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.
10w Led x 2 (vf=7-10V, I=900-1000mA)
TIP122 NPN transistor x 2 (as switch)
BH1750FVI (light intensity sensor)
the referrence code: http://zhongbest.com/2016/08/31/光强度传感器/
Ds3231 (real time clock)
The libraby i use: DS3231 - Rinky-Dink Electronics
The schematic is attached below.
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.