100 Top Tips: Microsoft Excel
Power up your Microsoft Excel skills with this powerful pocket-sized book of tips that will save you time and help you learn more from your spreadsheets.
09 January 2025
When I first saw the Lego Retro Radio set (10334), I wondered whether I could get it to play my own music by putting a Raspberry Pi inside it. The Lego designer included a grip for mounting your phone inside, but I wanted something that could interact with the tuning dial on the radio, and that I could leave in the radio permanently.
The Lego set features a sound brick, which has a button in it. When the button is pressed, it plays a short sound snippet, including some funny adverts and DJ quotes. The sound brick is triggered by turning the tuning dial. The key to making my project work was designing a replacement sound brick, which I could connect to the Raspberry Pi.
Now, when the tuning knob is turned, it activates my button, and a Python program reacts to the button press by changing the music playing.
To make it easy for others to use, I created the simplest program I could, which just plays songs and jingles alternately. However, it would be possible to make a more complex program using my Raspberry Radio code as a starting point. This uses text-to-speech to introduce each track, and indexes your music so you don't have to put the filenames in the code. It would be possible to have the button press change channel by switching between different song lists, and perhaps even changing the DJ's accent. Another cool addition would be to give each channel a name which is announced when it starts playing.
I've configured the Raspberry Pi so that my Python program starts running when the device is powered up. Inside the radio, I included another button which can be used to initiate a safe shutdown, without risk of damanging the micro SD card used for storage.
See my build instructions for playing your own music on the Lego Retro Radio using a Raspberry Pi.
Permanent link for this post | Blog Home | Website Home | Email feedback
© Sean McManus. All rights reserved.
Visit www.sean.co.uk for free chapters from Sean's coding books (including Mission Python, Scratch Programming in Easy Steps and Coder Academy) and more!
Power up your Microsoft Excel skills with this powerful pocket-sized book of tips that will save you time and help you learn more from your spreadsheets.
This book, now fully updated for Scratch 3, will take you from the basics of the Scratch language into the depths of its more advanced features. A great way to start programming.
Code a space adventure game in this Python programming book published by No Starch Press.
Discover how to make 3D games, create mazes, build a drum machine, make a game with cartoon animals and more!
Set up your Raspberry Pi, then learn how to use the Linux command line, Scratch, Python, Sonic Pi, Minecraft and electronics projects with it.
In this entertaining techno-thriller, Sean McManus takes a slice through the music industry: from the boardroom to the stage; from the studio to the record fair.