Wake-up Light Part 2: Scheduling

Last time, we had managed to get a command for controlling the lights up and running on the Raspberry Pi. The obvious choice for scheduling such a command in Linux is Cron. To automatically turn on the lights using Cron, we need to edit the root-user’s crontab:

This will launch a text editor inside the terminal. Lets scroll down to the end using the arrow keys and add the following lines:

The values, in turn, represent minute, hour, day of month, month and day of week. That is, the first command fires 06:45 every month, Monday through Friday. The send command is the same as before; turn group 11111, light 3 and 4, on (1). There is lots you can do with Cron and it has been around forever. If you have not used it before there are lots of extensive guides out there to get you started so I will not bother. This setup took me through most of the winter. The Pi turned on the lights just before my alarm went off at 07:00 and the results were imminent – waking up was a lot easier and “softer” as the light eased the body into the idea of waking up before it was blasted by the sound of an alarm. It was good, but not what I had planned for. This was only fading in two discrete steps, and even though I could just have added a few more outlets like this, I really wanted a singe, more powerful, custom light. Plus, the relays in the outlets make a loud and annoying clicking sound when they turn on. On the software side things were working fine, but logging onto the Pi and setting the alarm in the terminal was not really optimal. Next time: Building some hardware!

2 thoughts on “Wake-up Light Part 2: Scheduling

  1. Hi, very interesting project, can you show your arduino code ? I try to send message to my Arduibo by My Raspberry but it d’ont work, ( using sudo ./send …. ) the message is cortecly sending but my Arduino received nothings…

    1. Hi! The simplest way to test is to just use the sample code that comes with the library and watch the output in the serial monitor on the computer. You find the code in the Arduino IDE under File > Examples > RCswitch > ReceiveDemo_Advanced! If I remember correctly, my code is simply a modified version of that.

Leave a Reply to albert Cancel reply

Your email address will not be published. Required fields are marked *

Are you a robot? * Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.