How to play entrance music on your Raspberry Pi
Imagine walking through a doorway, and your entrance music begins playing. You’re a pro wrestler, or perhaps a character in a 1940’s hardboiled crime drama? Or the Queen, who no doubt gets to hear the national anthem on a regular basis.
Ty and Gig Builds have a tonne of cool Raspberry Pi projects on their YouTube channel, but we especially liked this one. Why? Because it’s the perfect device to welcome everyone to Raspberry Pi Towers each day. At least, once the time comes to leave our home offices and head back to Pi Towers.
How does it work?
A Python script running on a Raspberry Pi continuously searches for nearby Bluetooth devices in a ‘known’ list. It uses the Bluetooth MAC address of each detected phone in range to determine which entrance music its owner wants. All ‘known’ device owners have already nominated a chosen track, which is stored on the Raspberry Pi, and when it recognises one from its list, the Raspberry Pi plays the owner’s chosen audio file.
Raspberry Pi uses the Bluez stack to communicate over Bluetooth, it’s this service that lets the Raspberry Pi talk to your phone. Ty admits this was the fiddliest part of the build, but he explains it all very clearly, step-by-step, from this point in the video. A sound card, connected via USB, lets Raspberry Pi output audio through a big speaker. But you could also make the sound play through an HDMI TV.
Build your own
Wanna walk into the house with your own entrance music playing? Here’s the github repo with everything you’ll need. A Raspberry Pi 4 powers this project, but any of our boards with Bluetooth support would work.
You’re also going to need a separate sound card and here’s the one used in this build.
What would your entrance music be?
Some suggestions from the soon-to-return to Raspberry Pi Towers team:
- Back in Black, AC/DC
- Here You Come Again, Dolly Parton
- Paint It, Black, The Rolling Stones
- The Imperial March, John Williams
- Tiptoe Through the Tulips, Tiny Tim (yes, someone really picked this)
Comment with your entrance tune of choice.
I’d definitely use the Rocky theme so maybe it’ll make me want to work out more or to congratulate me on working out lol
Ode to Joy, because you can’t get enough joy.
Send in the Clowns for when the boss arrives. 🤣
Oh, that’s too good! I’m going to do that now lol.
Theme to shaft. ‘You’re damn right’
Professor Elemental’s “Theme Music” will be mine. “I always knew it was worth building a robot out of old trumpets!”