Supervillain Soundboard


Created by: gleeco

Published Mar. 30, 2013

I was looking for a good first project after getting my Raspberry Pi.  Coincidentally it coincided with my son's fifth birthday which was to be Superhero themed.  I decided to create a life-sized super villain that the kids could take turns at defeating.  The idea is that the kids would throw beanbags at targets on the villain which would trigger sounds that my son and I had pre-recorded on the Pi.  I created a simple script which grabbed a random sound and played it when any of three switches were triggered.


Related categories: Tutorial

Step 1: Beginning and Graphics

I hadn't thought about sharing this with anyone until after I had completed a lot of the steps so, unfortunately, the pictures may not add as much clarity to the inner workings of the process as they have if I had taken them at the time that I was working on the step.  If you have any questions please comment (wait, there are no comments here...not sure how you would get a hold of me) and I can see what I can do to clarify.  It is not the most complicated project so I am hoping that it will be clear enough.  Anyway...

I started by grabbing some images of the web and getting them blown up at Kinkos.

Step 2: Electronics

While waiting for that work to get done I prorotyped the electronics.  It is a pretty simple layout.  3.3v in to 10k resistors.  On/On switches attached to the GPIOs on the PI.

It is basically the setup from this tutorial at Adafruit but I had to change the code because I couldn't get it to work properly with pygame.mixer (see programming step for the changes I had to make)

Step 3: Programming

This part was pretty simple, although it took me some trial and error to get to this solution.  Originally I was trying to use Pygame/Pygame.mixer but I could never get my WAV files to play (they would just make a click when triggered).  So I went even simpler and just called the SSH aplay command. 

My .WAV files are named "Villain" + some number between 1-12 + ".wav".  So I used a random number generator between one and twelve to pull one of the sounds randomly.  that is what is going on in this line:  os.system('aplay /home/pi/sounds/villian' + str(random.randrange(1,12)) + '.wav')


import RPi.GPIO as gpio
import os
import random

while True:
    input_value17 = gpio.input(17)
    input_value22 = gpio.input(22)
    input_value27 = gpio.input(27) 
    if input_value17 == False:
        os.system('aplay /home/pi/sounds/villian' + str(random.randrange(1,12)) + '.wav')
        while input_value17 == False:
            input_value17 = gpio.input(17)
    if input_value22 == False:
        os.system('aplay /home/pi/sounds/villian' + str(random.randrange(1,12)) + '.wav')
        while input_value22 == False:
            input_value22 = gpio.input(22)
    if input_value27 == False:
        os.system('aplay /home/pi/sounds/villian' + str(random.randrange(1,12)) + '.wav')
        while input_value27 == False:
            input_value27 = gpio.input(27)

Step 4: The Physical Stuff


Once I had the graphics back from the printer I cut a plywood board sized to match.  Then I cut out holes where the targets would be for the bean bags, I needed to take special care here to make the holes as clean as possible since I was going to reuse the cut out hole as the trigger.

I made a base out of 2x4s and here is where I made a bit of a mistake which I had to correct later.  I thought it would be more stable if I made the base so that the plywood sat back at an angle a bit (10 degrees).  It was more stable (it wouldn't fall forward) but it caused problems on the next step.

Next I took the cutouts holes and attached them via hinges at the top.  Because I had angled everything back the re-attached cutouts didn't sit flush with the rest of the plywood.  This problem plus the fact that I had to figure out a way to have these trigger cut-outs "spring" back into place once they were hit by the bean bags meant I had to rig up some sort of spring.  What I ended up doing (since this thing really only had to last a day or so) was to cut out a piece of t-shirt/jersey material and spanned across the hole (that is the blue material).  This seemed to have enough give so that when the trigger was hit it would trigger the electronic switch and still spring back into place.  I am worried a bit that this could be a failure point if it is hit a few times.  Seems strong enough at the moment.


Step 5: Attaching the electronics

Next step is attaching the PI and the triggers.  I took a Tupperware container and cut out some slots to allow the wires to some out the sides and screwed it to the back of the board.  I hot glued the switches to some strapping in a spot where they would get tapped by the plywood cut-outs when they were hit.  I used some clips for wire management.  Finally I decided to use some vinyl strapping (the yellow bits in the pics) to try and limit how far the triggers could flyout when hit.  I am hoping that this will limit the amount of problems I might have with the rigged up t-shirt "springs". 

I used a powered speaker (not shown) which I decided not to mount, that will sit to the side of the contraption.

(All of the good pictures about the electronics are on the previous step - deleting pictures wasn't working on this site when I posted this or I would have moved them).


Step 6: Attaching the Graphic

Finally I got some wallpaper adhesive from the hardware store and mounted the graphics on the front of the plywood.  Once that was dry I carefully cut the graphic over the triggers and trimmed them up.

I wasn't able to take any pictures while I was doing this step because I was worried about the glue drying up on me.  But here are some picture of the finished product.

Step 7: Coming soon!

I still have some clean up to do to make it look a little more polished and the back is pretty ugly but it was a fun project and was pretty simple.

The party is in a few weeks i will take a video of the working project then! 


comments powered by Disqus