Computing Magazine

Wake up Gently to Gradually Increasing Light

Posted on the 16 January 2015 by Iqjar @iqjar

The problem

No alarm clocks!

Don’t you just hate it when you’re in a deep, relaxing sleep, dreaming of beautiful things… resting… not even remotely close to waking up… and then suddenly, without any preparation or warning, the alarm clock (or phone or whatever other device) starts buzzing, singing, screaming, making an awful racket, and, like a hand reaching after you into the depth of your sleep, drags you out of it instantly and makes you resent the day from the moment it begins? Well, God knows I hate it. It’s a brutal, merciless, sadistic way of waking somebody up. And yet we do it to ourselves on a regular basis. It has even been proven scientifically that when you wake up instantly from a deep sleep, you’re going to feel a lot more tired throughout the day, compared to when you wake up gently, gradually, slowly making the transition from deep sleep to a completely awaken state. Surprisingly enough, even though many millions of people go through this unpleasant process daily, I’ve never seen an alarm clock which tries to achieve a gentle awakening by starting to emit some extremely low, pleasant sounds and then slowly increasing the volume (over several minutes) to a powerful noise, which cannot be ignored anymore. This is probably because most of us are quite sensitive to sound and we would wake up more or less instantly anyway.

The solution

MiLight LED Bulb With Green Check Mark

Nevertheless there is a solution. Humans have evolved to sleep well in the dark and wake up easily in the light, so waking up to the increasing level of light in our room is a natural and much more pleasant experience. Unfortunately the sun rises at a different moment of the day every day throughout the year, usually sooner then we wish to wake up in the summer and later in the winter. This makes the sun an unsuitable wake up device for the modern man. But hey, since we’re in the modern age, we’ve got lost of technology around us and those of us lucky enough to have some remote controlled, dimmable light bulbs, have the possibility to simulate the rising of the sun by programming the light bulbs in our rooms to turn on at a specified moment of the day. The bulbs can be turned on a few minutes before our wake up time, and then the intensity of their light gently, gradually increased, until they flood the room with light so bright that it cannot be ignored anymore. The good old alarm clock or phone can be set to scare the hack out of us a few minutes after the bulbs shine brightly, just in case we’re too tired to react to the light and wake up. Believe me, I’ve been using this method for a few months now, and it’s a blessing!

The implementation

So let’s see how it can be done. Remember when I told you about the MiLight/LimitlessLED/EasyBulb LED bulbs? Also, do you remember that I’ve taught you to control them with a Raspberry Pi? Well then, things couldn’t be more simple, could they? The Raspberry Pi is a Linux computer which can easily be set up to execute actions at specified times (in this article I explain the usage of cron), so all we need now is a script which simulates the sunrise by turning on our bulbs and then gradually increasing the intensity of their light. Did I hear you thinking about how such a script can be written? Let us look at one of many ways to do it:

#The zone where the lights will be turned on (1 to 4 or 0/ALL for all zones)
zone=1

#The duration of the lowest intensity (first) step (in seconds)
durationLowestIntensity=30

#The duration of the lower intensity steps (in seconds)
durationLowerIntensity=10

#The duration of the higher intensity steps (in seconds)
durationHigherIntensity=8


/soft/milight/milight $zone b 1
sleep $durationLowestIntensity

for i in `seq 2 9`; do
/soft/milight/milight $zone b $i
sleep $durationLowerIntensity
done

for i in `seq 10 19`; do
/soft/milight/milight $zone b $i
sleep $durationHigherIntensity
done

The above script turns on the MiLight bulbs and increases the intensity of their light in 3 phases:

1. In the first phase the lights are kept at minimum level for a longer period of time to give you a chance to start coming out of deep sleep.

2. In the second phase the intensity is increased slowly up to around half of the maximum level, to stimulate the waking up process even more.

3. Finally, in the third phase, the intensity is increased fast until maximum level is reached, to increase the chances of noticing it, even by deep sleepers.

Of course, you can change the parameters (like which zone to turn on and the duration in seconds for the steps in each phase) by editing the script and assigning different values to the variables at the beginning of the script. In the above form it can be downloaded from here.

It uses the milight RGBW command line utility for Linux, which I have presented in a previous article: Home Automation: Using the Raspberry Pi to control the lights in your home over Wi-Fi

To execute the script at predefined times, for example at a given hour on each weekday (working day), you just have to save it somewhere and use cron to call it at the moments of your choice. To do this, log in to your Raspberry Pi and open the cron schedule file:

sudo crontab -e

Add a line like this:

45 5 * * 1-5 /soft/scripts/milight/waker.sh

In this example the script is saved as /soft/scripts/milight/waker.sh and it will be executed once on every day from Monday to Friday (1-5) at 5:45 (AM).

That’s it, you’re done!

Final notes

The solution presented in this article uses a specific type of light bulbs (MiLight RGBW LED bulbs) controlled over Wi-Fi by a specific type of computer (Raspberry Pi or generally a Linux machine). But the idea itself is generic. You could theoretically use other types of dimmable light bulbs and another type of controlling machine, as long as you can get them to communicate with each other. However, your bulbs would most likely have to be dimmable LED bulbs and in order to communicate with a controller that can establish schedules, they would most likely have to be controlled over a computer network (probably through Wi-Fi) and using radio waves, otherwise you’ll end up with a whole bunch of ugly cables. Finally, there probably isn’t a computer which is better suited for this purpose (controlling the light bulbs) than the Raspberry Pi (considering how cheap, small, noiseless and power efficient it is), except maybe some other similar single-board micro computers, devices from the same category, which you may already have lying around at home.

Whatever kind of light bulbs you have and however you choose to control them, try implementing a solution for waking up to increasing light, rather than to a sudden sound alarm. You are very likely to like it and get rid of your old alarm clock forever.

  • Wake up gently to gradually increasing light
Wake up gently to gradually increasing light

Back to Featured Articles on Logo Paperblog