Music at the flip of a switch
My roommate wanted to have a light switch in the bathroom that plays the Fairy Fountain song on loop. After all, we had agreed to a Legend of Zelda theme for our new apartment. Here’s how I did it.
- Adafruit Audio FX Sound Board
- Speaker (4-8 ohm, up to 2.2W)
- Micro USB Cable
- USB Power Adapter
- E26 to Outlet Adapter
- GU24 to E26 Adapter (if necessary)
- Purple LED Light Bulb (optional)
In the bathroom, there were three switches for the main light, fan light, and fan. The fan light enclosure was the perfect place to encapsulate this setup.
The two key challenges of this project were 1) powering this device and 2) remotely triggering the song to play. I initially considered using some sort of Arduino setup with a 120V relay triggered by the switch, but then I would need to find a separate way to power the Arduino and didn’t want to worry about batteries.
It turned out I could solve both problems by having the song loop when the device is powered on with 120V. However, this would make the Arduino less appealing due to boot time and steered me toward the Adafruit Audio FX Sound Board. This particular board has a built-in micro USB port for both power and adding audio files, as well as a built-in amplifier. Because this board specializes in audio effects, it requires no additional programming and supports playback when powered on and looping with minimal delays.
I grabbed a copy of the song and edited it down to a loopable WAV file, then loaded it onto the board with the name T10HOLDL.wav. As explained in the product tutorial, the board will attempt to loop a file with that name when pin #10 is connected to ground. Since I always wanted this to happen when the board has power, I soldered a tiny wire from 10 to a nearby GND. I also soldered the speaker to the appropriate pins on the board.
To power the device in the GU24 light socket, I used a GU24 to E26 adapter, followed by an E26 to outlet adapter, followed by USB power adapter to connected to the device via a micro USB cable. Since I had two GU24 sockets, I used the other one to squeeze in a purple light bulb for additional effect.
I unveiled the final product on Christmas.
December 26, 2018 at 12:00 pm
Next: Get refunds from DoorDash for “tips” never paid to your dasher
I work as a Senior Software Engineer at LinkedIn and perform on stage and on keyboard for improv comedy shows in the Bay Area.