Skip to content

Whoo-Pi Cushion with Raspberry Pi

Build a high-tech whoopee cushion prank using Raspberry Pi, GPIO, and custom sound effects.

  • Raspberry Pi
  • Beginner
  • 60 minutes
  • 5 steps

Shop this project

Cart

Prices from vilros.com. Tax and shipping at checkout.

Before you start, you'll need

  • Raspberry Pi (any model with GPIO)
  • 2 paper plates
  • Paper clips
  • Scissors
  • Cardboard
  • Copper tape
  • Sticky tape
  • Sponges
  • Glue
  • Aluminum foil
  • 2 crocodile clip cables
  • 2 male-to-female jumper leads
  • Speaker or headphones

Build the pressure cushion

About 20 minutes

Create a pressure-sensitive switch using plates and foil.

  1. Cut two cardboard circles to fit inside the deep part of the paper plates.
  2. Attach aluminum foil strips to each cardboard circle using sticky tape. Make the strips long enough to reach the plate's lip.
  3. Use copper tape to fasten the foil strips to the edge of each plate to maintain conductivity.
  4. Cut sponge into cubes and glue them around the foil on one plate to keep the foil strips separated.
  5. Position the two plates so the foil strips face each other but don't touch.
  6. Tape the plates together or use paper clips to hold them.

You should see

The cushion is assembled. The foil strips don't touch until pressure is applied.

Connect the cushion to Raspberry Pi

About 10 minutes

Wire the cushion as a button input.

  1. Plug one jumper cable into a GND pin on your Raspberry Pi.
  2. Plug the other jumper cable into GPIO pin 2.
  3. Use crocodile clip cables to connect the copper tape strips to the male pins of the jumpers.
  4. Connect one copper strip to GND and the other to GPIO 2.

You should see

The cushion is wired to your Raspberry Pi's GPIO pins.

Download sound effects

About 10 minutes

Find and prepare sound files for playback.

  1. Create a folder called 'whoopi' in your home directory.
  2. Download funny sound effects in .wav format (search online or record your own).
  3. Save at least 3 sound files in the 'whoopi' folder.
  4. Test playback using the aplay command in Terminal.
  5. Configure audio output to the headphone jack.
Type in the Terminal
amixer cset numid=3 1

This switches audio output to the 3.5mm headphone jack. Use 2 for HDMI audio.

You should see

Sound files play successfully through your speakers or headphones.

Write the Python program

About 15 minutes

Create a script that plays a random sound when the cushion is pressed.

  1. Open Python 3 (IDLE) and create a new file.
  2. Save it as 'whoopi.py' in the whoopi folder.
  3. Import the necessary libraries (os, random, time, gpiozero).
  4. Create a list of your sound file names.
  5. Write a loop that waits for button presses and plays a random sound.
python
import os
import random
from time import sleep
from gpiozero import Button

button = Button(2)

sounds = ['fart1.wav', 'fart2.wav', 'fart3.wav']

while True:
    button.wait_for_press()
    sound = random.choice(sounds)
    os.system("aplay {0}".format(sound))
    sleep(2)

Replace the sound file names with your actual .wav files. The sleep(2) prevents rapid re-triggering.

You should see

The script runs without errors.

Test your Whoo-Pi Cushion

About 5 minutes

Verify the cushion triggers sounds when pressed.

  1. Run your Python script.
  2. Place the cushion on a chair (hide the wires if possible).
  3. Sit on the cushion and listen for a random sound to play.
  4. If nothing happens, check the wiring and ensure the foil strips make contact when pressed.

You should see

Sitting on the cushion triggers a random sound from your list.

It didn't work
  • No sound plays when the cushion is pressed.

    Check that the foil strips make good contact when pressed. Verify the GPIO wiring (GPIO 2 and GND). Test the button connection with a simple gpiozero script first.

  • Sound plays constantly or triggers multiple times.

    The sponges may be too compressed, causing the foil to touch constantly. Add more sponge cubes to increase separation. Increase the sleep() delay in the code.

What to do next

Stuck? Contact Vilros Support with your board model and what you see on screen.