I thought it would be fun to setup a prop on my porch for Halloween that did more than just sit there. Of course I came up with the idea very late and so this whole thing was cobbled together in just an hour or two. Looking around my house at a ton of the gadgets I had the idea of putting a Jack-o-lantern on the porch that I could control the light in. Searching the internet for scary Halloween sounds caused things to quickly evolve into adding motion sensors, controlling a couple of lights, adding sound, and putting the pumpkin in the lap of a headless scarecrow.

I put a motion sensor at the end of the walk facing the house so that when someone approaches the porch it triggers the computer controlled sequence. First the porch light shuts off, then a scary sound starts playing through a speaker under the scarecrow. The light in the jack-o-lantern slowly brightens just as a "Help Me" emanates from the speaker. Then it dims back down, the sound stops, and the porch light turns back on. I also have a blacklight on the porch that stays on to make sure there is still some light there and to add some atmosphere. The scarecrow is just some old clothes stuffed with lots and lots of plastic shopping bags. I used a tan colored one up at the neck as a sort of flesh tone.

The whole thing is controlled by a Raspberry Pi with the standard Raspbian setup. The sound is played out the analog jack to a powered speaker that sits under the chair, and the lights are controlled with several X10 modules. In order to control the X10 modules and receive the signal from the motion sensor I use Heyu and a CM11A module connected to a USB serial adapter.

Heyu doesn't come as a package under Debian so you'll need to compile and install it yourself. It's pretty straightforward, but you'll need to adjust the localstatedir during configure:

$ ./configure --localstatedir=/var

After it compiles and installs, create the /usr/local/etc/heyu/x10.conf by coping the x10config.example and setting the serial port to /dev/ttyUSB0. Also down where the script section is, add the following lines:

ALIAS treater B8 SCRIPT treater on :: /usr/local/bin/treater.sh Create the /usr/local/bin/treater.sh file as below (or download the attached file) and put the sound file in /usr/local/lib. In rc.local add a line to automatically start the heyu engine. Test it out by sending the ON code that the motion sensor sends. Once the animated sequence is working, put it out on your porch and see how many kids you scare!

#!/bin/sh PATH=/usr/local/bin:/usr/bin:/bin export PATH PORCH=B3 PUMPKIN=B2 WINDOW=B4 if lockfile -! -r 0 /tmp/treater.lock ; then echo locked exit 0 fi play -q /usr/local/lib/way_scaryR.wav & heyu off ${PORCH} #heyu on ${WINDOW} heyu bright ${PUMPKIN} 22 sleep 2 heyu dim ${PUMPKIN} 22 heyu on ${PORCH} #heyu off $(WINDOW) rm -f /tmp/treater.lock