My Cart

A Halloween Sound Trigger with Raspberry Pi and ArduinoOctober 29, 2012

People have been asking me about interesting applications for the Raspberry Pi, and whether Raspberry Pi is an Arduino killer of some sort. The answer to the second question is no; in fact it is an Arduino augmenter. This blog post answers the first question with another question: how about a Haunted House sound effects machine?

A new revision of the Early Release of Getting Started with Raspberry Pi came out last Friday. I read Matt Richardson’s chapter on using Pygame with the GPIO pins on the Pi, which included a simple Sound Sample player. I adapted his example to work with an Arduino that talks to the Pi over a serial connection; this skeletal (ahem) hookup could easily be incorporated into some sort of Halloween installation. I decided to use Arduino for reading the inputs because out of the box it is more robust and can handle a wider variety of inputs. Also, there are many existing Haunted House triggering demos out in the wild that use Arduino.

First, you’ll need to prepare the trigger circuit. The following example uses three toggle switches, but you can replace those with any kind of on/off input. In a haunted house (or porch-based trick-or-treater installation), a PIR sensor would be handy for triggering based on proximity.

Here’s the basic schematic:

The 10k resistors can be replaced by the Arduino’s own internal pull-up resistors, if you know how to do that.

I connected the Arduino to the Raspberry Pi using a USB cable. While I had the Pi hooked into a monitor, I found that I could just plug the Arduino through my Mac keyboard USB connector and it got enough power from that to work. If you have an older Raspberry Pi with polyfuses limiting the power on the USB port (check to see if you have 2 little green fuses marked “1104″ next to the USB ports), you may need an external hub, or run the Pi headless to free up a USB port.

You’ll also need some sound files to play. I chose three from the Internet Archive: a generic scream, a Wilhelm Scream, and the classic Castle Thunder sample.

When you press the buttons each sound will play once; Pygame’s mixer will even play all three at the same time if you have multiple trick-or-treaters invading your porch.

Via and source: Make

Leave a Reply