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 5
Joined
Jun 13, 2021
Messages
1,696
Helped
42
Reputation
84
Reaction score
87
Trophy points
48
Activity points
8,953
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?
 

danadakk

Advanced Member level 5
Joined
Mar 26, 2018
Messages
2,219
Helped
344
Reputation
706
Reaction score
513
Trophy points
113
Activity points
9,807
You can always get time off internet with a ESP8266 or ESP32 and use that to
control leds.




Regards, Dana.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,731
Helped
5,069
Reputation
10,163
Reaction score
4,924
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
133,221
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top