In the beginning, humans coexisted with nature. Then, we fought to overpower nature. Then, having conquered nature, we sought to bring it back.
Here's how this applies specifically to my sleep:
- Waking up to the sun is nice.
- The time of sunrise and sunset fluctuate as the seasons change, and are almost never in line with my unvarying and semi-nocturnal sleep schedule. So, I use curtains (and specifically, really thick blackout curtains) to prevent the sun from waking me up too early, and an alarm to wake me up when I want to be woken.
- Being jolted awake by an alarm isn't exactly a pleasant experience--I always wake up somewhat panicked because the sudden sound makes me feel like I woke up to some emergency. So, I began looking for ways to emulate the experience of waking up to the sun rising, but with the simulated "sunrise" happening at the time I set it to.
I guess these are thoughts quite a few people have, because there are already numerous so-called "sunrise alarm clocks" on the market. However, many of them, especially the ones that mimic the changes in color temperature associated with sunrise, are quite pricy ($100 or so). In an attempt to get something with greater capabilities for the same price, I decided to build my own.
I don't have all the parts yet, but here's how I plan for things to be hooked up:
The LED strip is powered by the H801 controller, which uses PWM to control the brightnesses of each channel. This is a pretty standard, plug-and-play interface; pretty much any LED controller will drive any LED strip this way as long as they're the same voltage. The trickier thing was finding a way for the Android app I wrote on my tablet to communicate with the LED controller. All the controllers I found on Aliexpress used IR remotes or proprietary smartphone apps to communicate with the controller. Since I needed my own app to talk to the controller, I needed a controller with a simple and well-documented communication protocol. Many of the controllers I found could be flashed to use the open-source Sonoff-Tasmota or Espurna firmwares, which would then allow me to use the MQTT protocol to control the LEDs. However, I would have needed to do some soldering in order to flash the controller, and the process overall seemed rather brittle. In the end I settled with the H801, which can be flashed to use the open-source firmwares but also whose proprietary, built-in firmware has a very simple protocol that was reverse engineered and documented here.
The actual sunrise alarm app is something I wrote in Kotlin using Android Studio. In addition to functioning as an alarm, the app also allows for the user to control the LED color directly and to set the LEDs to change color to the beat of music. Screenshots below:
The LED controller and LED strip haven't arrived yet, but hopefully when they do I'll have a brighter, more capable (RGB, beat-syncable) setup than what I could've bought off-the-shelf.
Or maybe I'll encounter an endless stream of problems to debug, as one tends to with hardware.