Because I tend to be more focused and productive at late night, I usually stay up late working on some stuff that needs to be done.
Most of the time these stuff involves using my PC, and staying up late in front of a screen messes up with our sleep, as it lowers our bodies melatonin production. So unless I worked until I felt exhausted, there was no way I could fall asleep within 30 minutes of going to bed.
That was before I discovered F.lux a software that adapts your screen to the time of the day. Basically it decreases your screen color temperature at night, and becomes warmer the later at night it is. On their website they even have more information and a collection of links to research documents about light exposure effects on sleeping.
[F.lux]((http://justgetflux.com) solves my watching the screen in the dark troubles, but when I needed to do stuff at my desk and not on the screen, all I had was my cool white desk lamp.
Inspired by F.lux, I decided to make my own light system that changes the color temperature according to the time of the day.
I cut a strip with 7 LEDs, which was enough to cover a fairly small area just below a bunkbed, where my desk is. Because I haven’t bought a case for my Arduino, I built one with some old Lego pieces I found few weeks ago, and used some plastic coated wire to hang it to the ceiling.
Controlling the light
The light color temperature can be set automatically according to the current time of your device, manually setting the color temperature from 1000K to 4000K, or manually setting the individual RGB values from the iOS app.
The communication between the iOS app and the Arduino works between the mobile device’s Bluetooth and the Arduino’s BLE shield.
The temperature to RGB conversion was made based on Tanner Helland’s algorithm and the daytime based temperature algorithm was made based on my own preference, with three stages of temperature color change:
- 6:00 AM to 8:00 AM
- 6:00 PM to 8:00 PM
- 8:00 PM to 10:00 PM
Wrapping it up
With the stuff I mentioned and a few wires, you can have your own Dagr, time-of-the -day based lighting at your home or office.
You can find the complete code of Dagr for both the iOS app and Arduino are at my repository: https://github.com/deivuh/dagr.
Pull requests for functionality, success stories and comments are all welcome :)
Update: More about sleep quality
Besides screen / light exposure before bedtime, there are a few other factors caused by technology that may affect our sleep quality. A reader made a research about this and wanted to share with us an interesting article he wrote that covers this topic.