Hi ya'll,
I want to tackle a project for a LED light that comes on at a given light level and then will stays on for 'nn' number of hours (or better shuts off at a given time of the day).
e.g. comes on at dusk and shuts off at 1am.
Using an Arduino Uno.
I'm wondering is that possible?
Any ideas about this goal?
Perhaps there is already a tutorial about this subject.
Any suggestion is much appreciated.
TIA
Yes. Google ‘Arduino Dusk to Dawn circuit’
To make it stay on for x hours is just a question of few lines of code. To make it shut off at specific time means that arduino needs to know the time. So you need some additional steps/hardware to update the actual time.
- Do you know what an RTC is ?
I know and that what I intended to utilize.
- An LDR could be used for light level detection level.
The RTC used for time of day light goes OFF.
In case of RTC, in minimalistic setup LDR could be skipped and dusk could be calculated.
I like your suggestion.
I could use the LDR to customize the light at the specific location instead of using the Dusk2Dawn library with the original sunset time.
Considering it could be very cloudy and the LDR should response accordingly instead of using a calculated time.
I think I will go down this road.
Thank you
- You could add a delay to confirm you get a certain number of trigger readings before the light turns ON.
On at sunset and off at 1a.m can easilly be done with an ESP(32) board.
It can get the time off the internet (assuming you have WiFi near), and calculate daily sunset from your entered location.
An Uno and RTC is a clumsy way. It needs to be set regularely and adjusted for daylight savings. An ESP(32) will do all of that automatically.
Leo..
Since Esp came out, using arduino+RTC module makes sense only if internet is not available.
Another minimal approach, just LDR and arduino time counting can give good estimation of real time. For example if you have darkness for 14 hours, you know it's full winter. Dawn at 5pm. The time for illumination could be calculated from that.
Yes, that would be an option for me (ESP32).
This look like a nice playground to come up with a slick solution.
Thanks guys.
I use this jpb10 solar library (install through library manager).
Comes with sunset example.
Can give you a simple NTP (time) example when I know your location (country/city/town).
Leo..