Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Micro to tell when its night time?

Status
Not open for further replies.

cupoftea

Advanced Member level 6
Advanced Member level 6
Joined
Jun 13, 2021
Messages
3,057
Helped
62
Reputation
124
Reaction score
139
Trophy points
63
Activity points
15,948
We want to light up our house name by LEDs. Obviously only at night. So we need to sense when its day and night. Now, all light sensors available are horrifically bad in terms of tolerance. -And we don’t want to calibrate every light sensor. So the only way (would you agree?) is to use a light change algorithm. That is, read the light level every 10 minutes. What you find, is a massive change in light level from dawn/dusk/dawn. Then, with some extra coding…..you can pretty well say when its day and when its night.

Would you agree that this is the best way to distinguish day and night?
 

You can always get time off internet with a ESP8266 or ESP32 and use that to
control leds.




Regards, Dana.
 
I do it by keeping a 'time server' running at home. An ESP32 and DS3231 to give a back-up clock run continuously and send an MQTT packet every second. The data is JSON formatted and gives hours, minutes, seconds, date, month, year, day of the week, GMT/DST and finally a 1 or 0 to indicate daytime or night. It checks for connection to NTP at start up and every few hours and syncs if necessary. The DST and daytime calculation is dynamic so it updates every day. The day/night triggers at sunrise and sunset so it needs to be programmed for your latitude and longitude.
It controls all kinds of equipment, including wall clock displays, time overlay into CCTV pictures and of course the lighting. Sounds like what you need.

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top