Jun 12, 2013

Guten Morgen - Raspberry Pi As A Morning Alarm

Since my home router is in my kids' bedroom, I think it'd be great if  an alarm feature can be added to the Raspberry Pi to kick their asses up in the morning.  Other than a RPi we're gonna need these peripherals:
  • a speaker with 3.5mm audio jack for audio playback
  • a motion sensor as a switch to stop the alarm
The motion sensor is implemented with a webcam that can do motion detection. With two addiotnal packages installed on Raspbian Wheezy, and lots of time trying out the motion detection configuration, our GutenMorgen morning alarm is ready to go.

Install the audio file player and motion detection software:

$ sudo apt-get install omxplayer motion

The morning call is triggered via crontab (6:39 AM, Monday to Friday)

$ crontab -l 
39 6 * * 1-5 cd guten-morgen; ./guten-morgen.sh

Once the audio file is being played, the motion detection starts and if a motion event was triggered, the omxplayer process will be killed to silence the speaker.

Screenshots:

Raspberry Pi as a morning alarm (w/ USB powered speaker and a USB webcam component on top of RPi)
Thank David Su for donating an engineering sample of webcam component designed for laptops.  Before that I've tried some webcams but with no avail.  Check the RPi Verified Peripherals page to see if your accessories work on RPi.

Close-up of the webcam component (as a motion sensor)
Live demo: