ESP8266 based project to slowly light a 12v LED strip or any other PWM controlled source of light to simulate sunrise light.
Control using Telegram bot / MQTT (good for home assistant) / local network web dashboard.
I always appreciate waking up when the room is lit, but a big tree covers my single window and no light enters through it.
Introducing - my own private sunrise.
Also good if you wake up after/before sunrise and want to have your own sunrise.
- Set a time for a target brightness and total durations
- Control using local webpage
- OTA updates over WiFi
- Find way to avoid soldering and 12v power supply (maybe 5V LED strip?)
- Add smart switch mode - just start a sunrise as soon as powered on
- Push button integration to turn lights completely on and off, as god intended for a light
- Add indication of currently set alarm if set
- ESP8266 (NodeMCU preferably)
- P-Channel MOSFET
- 12v Power Supply
- 12v to 5v Converter
- Alternatively use another 5V source with a common ground with the 12v power supply
- Soldering capabilities
- 12V LED Strip (3528/5050 Warm White is a good choice)
- ESP8266/32 (NodeMCU preferably) to connect to run the code, connect to WiFi and generate a relevant PWM signal
- 12V LED Strip that is dimmed by the 12V PWM Signal
- P-Channel MOSFET to "convert" the 3.3V PWM to 12V PWM
- Get a fixed format message from various sources -
- Local webpage
- Telegram channel with a bot / conversation with a bot to control
- MQTT
- Create a single-time alarm for a specific time to initiate the sunrise routine
- Increment PWM duty cycle until full @ the right time
This is the "electrical schematics"
Default GPIO is 2
I used IRF9540N P-Channel MOSFET and cut a breadboard with a box opener
- Clone the project and open a PlatformIO Workspace
- If you are using Arduino IDE, just copy the main.cpp and config_example.h
- Rename config_example.h to config.h and update configuration
- Comment out upload_port = XX.XX.XX.XX to make sure you can upload through USB, change the ip address and uncomment later for OTA
In every method (Dashboard/MQTT/Telegram) you control these parameters -
- Current brightness - ...
- Max brightness - the target brightness that the sunrise will reach
- Sunrise Duration (minutes) - how many minutes will the sunrise take - meaning the sunrise will start from [Sunrise Duration] minutes before [Sunrise Time]
- Sunrise time - when will the LEDs reach FULL brightness
- Locate your ESP IP address using router admin dashboard or other methods
- Type it in your web browser
- Create a bot and get your token and chat id
- Edit the configuration
- /settime HH:MM - to set the sunrise time and activate it
- /setduration MINUTES - to set the Sunrise Duration (minutes)
- /setbrightness BRIGHTNESS - to set the current brightness
- /setmaxbrightness - to set the target sunrise brightness
- /reboot
- Configure publisher IP and topic in the config
- Publish same messages as above
You can 3D print a box that has:
- Standoffs for an upside down ESP8266 NodeMCU to be mounted using self-tapping screws
- Holes for barrel jack panel connector
- A lid and holes for screws
Download "box_and_lid.stl", slice it and go ahead