Audible Donation Box

When a patron turns in a book they’ve read for the summer reading program, they get a token to drop into the box. Since the Willowbrook Wildlife Center rehabilitates native animals that have been injured, I thought that playing local native animal sounds would help create a connection between the program and the organization it is supporting.

Here’s what the box looks like inside.

The speakers are driven by an Adafruit Music Maker Shield run off of an Arduino Uno, using the Adafruit VS1053 library. The token detection mechanism uses a high-intensity LED and a voltage divider, consisting of an 180 ohm resistor and a CdS photocell, to create an optical detector. The voltage across the small resistor is checked with an analogRead() in a tight loop to detect a token falling through the slot. Volume control is done through software on the VS1053, so I just hooked the sweeper on a 10K linear potentiometer up to a second analog input. When a token is detected, I play a random sound from the SD card in the background while continuing to check the volume control.

Here’s the schematic and a breadboard layout. I’ve just shown the control circuitry, as the Music Maker shield should be pretty easy to hook up.

All of the code, these schematics, and a Fritzing file are available on Github. Pay particular attention to the pin assignments at the top of the sketch if you’re using the Adafruit Music Maker board. They are hard-wired on the shield, but Adafruit’s tutorial is based on their breakout board, which you have to wire to an Arduino yourself.

One thing I had to consider with this build was power. I initially powered the box off of 4 AA batteries, and it looked like it worked great. After a few days of testing, it started to act a bit flaky. After being on for about 10 minutes, the speakers would just play static. After some testing, I found that the supply voltage was too low, so I swapped in a USB power supply for the batteries, and it worked much better. Since this has to run all day long for a couple months, USB is a better solution anyway.

We’re teaching a couple audio classes this summer, make sure to check back for scheduling details if you’re interested in doing something like this project yourself!