The Idea
In 2015, my church decided to revive their Fun Fair event. They encouraged folks to take a look at some of the old games and refurbish them if they were interested. I found an old game called “Dunk It”. It consisted of a toilet seat bolted to a green wooden frame. The goal was to toss a roll of toilet paper through the hole of the toilet seat to win a prize.
My inner 5yo. thought this would be my game. But, I couldn’t just leave it as is. I needed to make some… improvements. The premise of the game was simple, but it lacked something. There was no feedback for the player. So, I set out to give it a voice.
My first inclination was to use an Arduino with an audio shield. However, I was trying to minimize the cost, so I thought I’d use something I already had on hand, a Rapsberry Pi A+. This would handle the audio, and the programming would be relatively simple.
Alpha/Beta Version
To prove the concept, I thought I would wire up a light sensor (Light-dependent Resistor) to the Raspberry Pi. This was not as straightforward as I’d hoped, since LDRs are analog devices and the RPi only has digital I/O pins. So, after a bit of searching, I found a technique to read analog values from a digital I/O pin using a simple circuit.
Once I got this wired up, I stole some code to make the LDR reading work. I combined that with some code to play back audio and the alpha version was working…
Version 1.0
I foolishly ignored the advice to always put a resistor in series with an LED. And it bit me in the behind. An hour before the fun fair, the LED blew out, and I wasn’t able to leave and get a replacement. Lesson learned.
Version 2.0
For Version 2.0, I wanted to make some significant improvements. First, I wanted to make a more realistic “experience” for the players. I was able to secure a toilet on freecycle (I love freecycle). After sanitizing it, I set to work wiring up the LED in the bottom of the bowl. This had the added benefit of making the code simpler.
I also wanted to improve the sound for the game, so I got an inexpensive power amp and car speakers. I mounted the speakers on the snazzy new platform with locking casters. This made the whole thing much easier to move around.
Version 3.0
For version 3.0, I wanted to clean things up significantly, and make it easier to assemble/disassemble. I mounted the amp and Raspberry Pi on a board, that attaches to the inside of the tank with Velcro. I also used a connector for the sensor instead of being wired to the board.
Version 3.1
I added a shutdown button for the system so the SD card doesn’t get trashed, and the Pi shuts down gracefully. and covered the wires with some flexible split tubing. I also added some code to avoid repeating the audio if the sensor detected darkness at the end of the previous audio playback. Finally, I added some other… apropos sounds.
I bet this is the first time the words “graceful” and “toilet” appear in the same context.
Possible Improvements:
- I’d like to use the flush handle to perform the shutdown/recalibration
Resources
- Source Code
- Using a digital GPIO to read an analog sensor
- Another article on using Raspberry Pi GPIO to read analog sensors (I believe this is where I got the code)