The Face – in action

Here’s a video of “The Face” showing how a simple Python program can be used to generate a range of facial expressions.

Now I just need some inspiration for developing it.

Advertisements

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.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
GPIO.setup(12, GPIO.OUT)
GPIO.setup(13, GPIO.OUT)
GPIO.setup(7, GPIO.IN)
shortDelay = 2
bell_times=["08:45","08:50","09:50","10:50","11:10","12:10","13:10","14:10","14:15","14:30","15:30"]
bell_warning=["09:45","10:45","12:05","13:05","14:05","14:15","14:25","15:25"]
while True:
         GPIO.output(11, GPIO.LOW)
         GPIO.output(12, GPIO.LOW)
         GPIO.output(13, GPIO.LOW)
         current_time=time.strftime("%H:%M")
         print(current_time)
         os.system("figlet "+str(current_time))
         time.sleep(1)
         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"')
                 time.sleep(20)
                 GPIO.output(11, GPIO.LOW)
                 time.sleep(1)
         if current_time in bell_times:
                 print("Brrrring, Brrrring, Brrrring....")
                 GPIO.output(12, GPIO.HIGH)
                 os.system('espeak "Ring Ring. Ring Ring. Ring Ring"')
                 time.sleep(20)
                 GPIO.output(12, GPIO.LOW)
                 time.sleep(10)