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:

$ sudo crontab -e

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

45 6 * * 1,2,3,4,5 send 11111 3 1
50 6 * * 1,2,3,4,5 send 11111 4 1

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!


Comments

3 responses to “Wake-up Light Part 2: Scheduling”

  1. Clemaul Avatar
    Clemaul

    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. albert Avatar
      albert

      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.

  2. […] have been working on my own custom wakeup-light on and off for several years (part 1, part 2, part 3). After getting Philips Hue lights, however, I have not gotten around to setting it up in […]

Leave a 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.