Gadgets come and go. There’s always something better on the horizon. But some things seems to last and last. They pass down generations but then they eventually break.
A decade ago I wrote about a little project to turn an x86 PC circa 2003 into a Linux music server, running the open source LMS (Logitech Squeezebox Server).
Sadly, that machine is no longer with us, but, a few years ago, I gutted the innards. Using the same beautiful brushed steel case of the original PC, I upgraded to a Raspberry Pi B running Squeezelite, a music player, which operates as an LMS client. This device continues to faithfully stream music, podcasts and internet radio via an optical digital audio adapter into my Hi-Fi amplifier.
Giving a lease of life to a long-forgotten bit of tech, was the inspiration behind my latest project, during the Christmas 2020 Tier 4 festivities. This time, I dissected a Roberts Radio Rambler, a transistor radio from the 1970s.
Starting with Zero
It was no longer picking up any radio stations. And while there are plenty of vintage radio enthusiasts who would love to get an old Roberts Radio working again, I am not in that club.
I wanted to keep the case and speaker, and replace the transistor PCB board with a Raspberry Pi Zero W (the one with Wi-Fi) and a HiBerry MiniAmp (this upgrades the Pi’s built-in sound and can drive the Rambler’s original speaker). HiBerry sound cards for the Raspberry Pi tend to be reliable, well-documented and work without requiring tonnes of configuration.
I also wanted a real volume knob and a way to change stations using the tuner knob. Unlike the Roberts Radio, which used potentiometers, I decided to use rotary encoders for my Pi-based internet radio’s volume and station changing functions. I bought the rotary encoders from Az-Delivery, a German company, which offers a useful inventory of electronic components, accompanied by documentation and sample code to support microcomputer hobbyists.
After a few issues with configuring Wi-Fi on the standard Pi operating system, Raspbian, I decided to use piCorePlayer instead. This is a pared down Linux operating system and Squeezelite LMS client, which runs entirely in memory. Unlike most operating systems, it does not need to be shut down properly. In other words, I can pull the plug, and the operating system will not fail when it is powered on again
Az-Delivery provides a simple Python script, which can be used to check that the rotary encoders are wired into the Pi correctly. This just counts up and down as the knob on the rotary encoder is rotated. The next task is figuring out how to turn this simple counter into volume commands for LMS. A Google search reveals a number of ways to do this, but I chose the squeezebox-controller 1.0.4 on PyPi from Sam Russell.
With a bit more coding, and some trial and error, I figured out how an internet radio station can be selected from a list of favourites using the second rotary encoder. The radio stations are basically stored in an LMS playlist; the rotary encoder then selects the next or previous one as the next track to play.
After plenty more Googling, code tweaking and reboots, I managed to get the Python code for the two rotary encoders to run at startup time when piCorePlayer is powered on. Job done. Total cost of materials (Pi Zero W, HiBerry MiniAMP. 2x rotary encoders, SD card) is about £60), which is probably a bit pricier compared to the cheapest of internet radios. But what’s the fun in buying one of those?
I started with zero knowledge of the Pi Zero W; I knew nothing about rotary encoders and how to get them to talk to the Pi and I had no idea how to send commands programmatically to the LMS. Oh, and by the way, I can barely program in Python. This is not a pat on the back. It’s recognition of the wealth of freely available knowledge on the internet.
Thanks to amazing resources like GitHub, extensive free documentation, code and discussion groups, almost anyone who wants to try to hack something together, can do so with the confidence that if they persevere, they will be able to make it work eventually.
And if there is a lesson learned or a key takeaway, it’s that a Raspberry Pi is a good way to lose a couple of days over Christmas hacking code to get things to work.