Artificial sun (with quirks) or an overengineered way to turn a lamp on and off at a given time.
This project uses 220 volts. Be smart and follow safety rules. It's not production-grade and could be dangerous for you or those around you. Use it at your own risk.
It's not even guaranteed to work after all – currently, there is no hardware available to validate it.
Controlled via relay attached to Arduino, lamp goes on and off at specific time to simulate sunrise and sunset.
Every midnight, the setupTodayAlarms event fires, fills the sunrise and sunset variables with corresponding values, and attaches single-use alarms to turn the lamp on or off.
Sunrise data is powered by SunriseSunset.io
- In
fetch_data.pymodifyreq_paramsfor adjust location - Call
python3 fetch_data.py(requestspackage is needed)
Approximate diagram
For wiring see source code.
- Ardunio (Uno)
- DS1307-based RTC
- HC-05 for Bluetooth
- Push button
- Relay module
There is a single LED that is normally off and lights up only if it fails to find the real-time clock.
The button allows manually turning the lamp on and off but does not affect the alarms.
Both hardware and software serial operate at 9600 baud.
List of commands:
off– turns the lamp offon– turns the lamp onstatus– prints the current status of the lamp, mostly for debuggingtime– prints the current time inYYYY-MM-DDTHH:MM:SSformatalarms– prints two lines with the scheduled on and off alarm times
