26 December 2012

Raspberry Pi project #3: Beepy

Before you panic, you haven't missed my writings about any other Raspberry Pi projects. This is project number 3, but it's the first one I've actually written about.

The reasoning for Beepy came when the family were highlighting programmes in the Christmas edition of What's On TV. We used to set reminders on the TV, but it's rubbish - they only remind you if the TV is turned on.

Beepy is an alarm daemon that regularly reads a text file with a list of dates, times, numbers and words. For example, if I needed reminding to watch Doctor Who on BBC One on Christmas day at 17:15 (like I need reminding), the text file would have a line like this:

25/12/2012 17:13 1 Doctor Who

The date and time are obvious, and the '1' represents what sound the alarm makes. If that number was 3, there would be 3 beeps in quick succession followed by a pause, then repeated for a minute. The alarm also speaks any text at the end of the line.

The script makes use of 2 other programs for the Raspberry Pi:

  • mpg321 (to play the alarm noise)
  • festival (used for speech)

You also need to make sure the sound drivers are installed. This tutorial helped me.

In order to make it work as a daemon (i.e. running in the background) you have to modify the startup script at /etc/profile. Add the location of Beepy followed by an '&' (There has to be a better way of doing that). You'll need to edit the file names in Beepy to wherever you've stored it, then reboot, plug in a set of speakers and you're away!

To add an alarm, edit the text file in the same style as the example. Easy peasy.

A Raspberry Pi, hard drive, speakers and a router

My setup is getting more and more spaghettified. There are speakers and a USB hard drive which I'll get to some other time.

I'm sure this is the worst way of making a daemon, and the quality of my code is probably shocking. But hey, it works.

If you feel the urge to download this hideous creation, you can click here

No comments:

Post a Comment