Want to build this project?
View Parts

 

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:

pumpkin_pi_20121026.png

(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.

 

 

Install dependencies:

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 CobblerAdafruit Pi Cobbler in this video clip as my Adafruit Pi PlateAdafruit Pi Plate featured in my previous post wasn't handy at the time)

 

 

Audio troubleshooting:

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:

mplayer /home/pi/files/howl.wav

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:

alsamixer

 

 

Cheers,

Drew

 

 

element14
Product Name*DescriptionBuy All PartsBuy All Parts
Raspberry Pi Model B with SD CardRaspberry Pi Model B with SD CardRaspberry Pi model B and 8GB SD Card with NOOBS preinstalled
Optical mouseOptical mouseBasic USB optical mouse
KeyboardKeyboardBasic USB keyboard
Adafruit Pi PlateAdafruit Pi PlateBreakout and expansion board for Raspberry Pi
Tiny BreadboardTiny BreadboardSmall breadboard sized to fit Pi Plate
Adafruit Pi BoxAdafruit Pi BoxClear acrylic enclosure for Raspberry Pi
(2)  NPN BJT(2)  NPN BJTNPN bipolar transistor
(2)  1k ohm resistor(2)  1k ohm resistor1k ohm, 250mW carbon film resistor
(4)  Red LED(4)  Red LED5mm red LED
(4)  220 ohm resistor(4)  220 ohm resistor220 ohm, 250mW carbon film resistor
(4)  180 ohm resistor(4)  180 ohm resistor180 ohm, 250mW carbon film resistor
(4)  Yellow LED(4)  Yellow LED5mm yellow LED
20AWG Red Hook Up Wire20AWG Red Hook Up Wire20AWG solid copper hook up wire - red
20AWG White Hook Up Wire20AWG White Hook Up Wire20AWG solid copper hook up wire – white
Additional Parts
Product Name*Description
Rechargeable USB Battery Pack4000 mAh Li-Ion battery pack with USB outputs and included cables
Mini SpeakerSmall rechargeable mono speaker with integrated amplifier

 

*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.