In my last post, I introduced the Pumpkin Pi: a Raspberry Pi project for Halloween. It puts a Raspberry Pi inside a jack-o'-latern to provide web-controlled lights and sound:
(click to enlarge; screenshot of latest version as of 2012-Oct-26)
The Pumpkin Pi software was written in Python with generous assistance from Bonnie King and can be found on GitHub under my account "pdp7" in the punkin_pi repository.
To run punkin_pi on your Rasperry Pi, you'll first need to install these dependencies. The following commands were run on the current Raspbian 2012-Sept-18 image:
sudo apt-get update
sudo apt-get install git-core mplayer python-setuptools
sudo easy_install bottle
sudo easy_install RPi.GPIO
If running an earlier image, then you may encounter an error on when installing the RPi.GPIO in that last step ("couldn't find Python.h"). To resolve the error, run this command: sudo apt-get install python-dev and then sudo easy_install RPi.GPIO again. Thanks to Joel Dunn for the advice!
Install sound clips:
Next, sounds clips that the pumpkin will play need to be installed. I downloaded a few .wav files from a site with a nice collection of Halloween sound clips and placed in /home/pi/files as punkin_pi expects:
pi@raspberrypi ~ $ mkdir files
pi@raspberrypi ~ $ cd files
pi@raspberrypi ~/files $ wget http://www.countessbloodshalloweenhorror.com/sounds/howl.wav
pi@raspberrypi ~/files $ wget http://www.countessbloodshalloweenhorror.com/sounds/scream.wav
pi@raspberrypi ~/files $ wget http://www.countessbloodshalloweenhorror.com/sounds/ghostgigl.wav
Any files that mplayer can play can be put into /home/pi/files such as .wav, .mp3 & .ogg.
Install & run punkin_pi:
Next, I installed the punkin_pi software project via git:
pi@raspberrypi ~ $ git clone https://github.com/pdp7/punkin_pi.git
The web server (built on the bottle framework) can be started via:
pi@raspberrypi ~ $ cd punkin_pi
pi@raspberrypi ~/punkin_pi $ sudo python ./control.py
It will be available at the Pi's IP address on port 8081. Here is a video of the web interface in action:
(The LEDs happen to be connected to the Raspberry Pi via the Adafruit Pi Cobbler in this video clip as my Adafruit Pi Plate featured in my previous post wasn't handy at the time)
If you want to check if punkin_pi will be able to play a particular file in /home/pi/files, then try to play it with mplayer:
Sometimes the sound system may become unstable and produce errors. Restarting ALSA should resolve this:
sudo /etc/init.d/alsa-utils restart
If your speakers lack a volume control, then the ALSA mixer can be used to adjust volume:
*Products and resources listed are listed to help members build their own Pi Projects. They are suggestions and listed for educational purposes. For substitutions of any parts, please post a question asking the original author.