The bells are ringing in my head.

Sometimes, when things are going smoothly, it’s easy to lose track of time. This is compounded if the school bells aren’t working correctly (Excavator + Buried Cables might have something to do with it). Replacing cables is expensive, disruptive and time-consuming. Here’s where the Raspberry Pi might come in handy – particularly if it has the ability to use “Network Time”.

It’s also a bit of fun. I’ve got an RGB Piranha LED as well as a set of speakers. Ideally, I’d connect up that doorbell sat on my desk so that it sounds more realistic, but the “Ring Ring” spoken by espeak is a better talking and teaching point. Perhaps I should even get the head connected up. In addition, I’ve used figlet to make the time visible, although I’d really recommend running this headless to reduce power consumption.

The LED lights up green in the last 5 minutes of a lesson, and then goes red when the bell should be going. It repeats each message a couple of times to hammer the point home. If I really wanted to use that doorbell, then it’s a simple job to use the PiFace relay where the bell push-switch would be fitted.

Using this program with mplayer or omxplayer might make an interesting clock radio with mp3 files playing instead. Perhaps use mpd to play streaming radio. So many ideas, so little time…

#!/usr/bin/env python
import time, RPi.GPIO as GPIO
import os
GPIO.setup(11, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(7, GPIO.IN)
shortDelay = 2
while True:
         GPIO.output(11, GPIO.LOW)
         GPIO.output(12, GPIO.LOW)
         GPIO.output(13, GPIO.LOW)
         os.system("figlet "+str(current_time))
         if current_time in bell_warning:
                 print("Five minute warning for the bell")
                 GPIO.output(11, GPIO.HIGH)
                 os.system('espeak "the bell will go off in five minutes"')
                 GPIO.output(11, GPIO.LOW)
         if current_time in bell_times:
                 print("Brrrring, Brrrring, Brrrring....")
                 GPIO.output(12, GPIO.HIGH)
                 os.system('espeak "Ring Ring. Ring Ring. Ring Ring"')
                 GPIO.output(12, GPIO.LOW)