The Google AIY kit that came with issue 57 of the MagPi makes a great internet radio. The cardboard box it comes with, however, is functional, but not wife-compliant so I wanted to find a better enclosure for it. For a while I mounted it behind a perspex Muji photo frame, which was OK but still not what I really wanted. Then I remembered the Pimoroni ARRR600 which had an internet radio inside an old Roberts.
Roberts radios are fantastic. They look amazing and, and are well built. When I first started working in radio the BBC’s local stations used them extensively for off-air cue at outside broadcasts and they survived a lot of rugged handling while still retaining their looks and sound quality. So I went to eBay and found a few for sale as “spares or repair.” I didn’t want to gut a functioning radio, or pay too much for just the case. I was out bid on a couple of R600s, but won the auction for a Roberts Rambler 2.
Taking it apart and removing the old innards was pretty easy. I had to make a mounting plate for my four new buttons, so cut down some 3mm acrylic sheets I had left over from something else, and carefully drilled holes in the right places, using the top cover as a template. I fitted the new buttons and pots, and soldered all the wires to them and to the Google Voice hat. I used the original speaker from the radio, connecting it to the hat via the volume pot so it can be adjusted without having to bother the AIY kit. (Although you can still say “Volume up” or “Volume down” to it if you like). The pulsing LED is mounted underneath the top panel, and shines through nicely. As there are plenty of spare GPIOs available on the hat I connected the buttons as mentioned, and added three extra LEDs too. These don’t do anything at the moment, but I suspect I could add some code for them if inspiration strikes me.
I used KTinkerer’s code and excellent blog post to get the BBC radio stations playing on the AIY kit, but I modified some of the station names to be more on-brand and swapped my BBC locals for Radio Nottingham from their example.
I’m pleased with the outcome of this, and it sits nicely on the desk in the front room with my Twitter ticker. Strangely the LED connected to GPIO 5 is always dimly lit. If anyone has any idea what might be causing that, or any other feedback, I’d be interested to hear in the comments.
I prototyped the hardware by stringing everything together with croc-clips and a breadboard. I removed the small speaker from the Speaker pHat and soldered some solid core wires onto the pads to hook-up the bigger speaker.
The code is based on Giles’, but I’ve modified it to use GPIO Zero and have added a second button which shuts the Pi down. The program runs clock.py as a subprocess, which is Adafruit’s code to display a clock on the 7 seg.
from gpiozero import Button
from subprocess import check_call
pid = subprocess.Popen([sys.executable, "clock.py"])
shutdown_btn = Button(17, hold_time=3)
shutdown_btn.when_held = shutdown
button = Button(23)
# set station to 5 live
station = 5
os.system("mpc play " + str(station))
station += 1
# Assumes there are 7 stations
if station > 7:
station = 1
os.system("mpc play " + str(station))
# pause to debounce - is quite long as found the buttons quite bouncy
Once I was happy it all worked as expected I drew a template of the Muji photo frame on graph paper to get the layout of the components right and mark up where I would need to drill holes. The small holes weren’t any trouble, and were easily made in the two layers of the frame with my Dremel set to low speed. The larger holes were more of a problem and I destroyed one frame before discovering that masonry drill bits seemed to work better than any other I had. As bits of Perspex splintered around me I was glad to be wearing safety glasses! The back sheet needed a window cutting out of it for the 7 segment display to poke through. Again my Dremel was the best tool I had for this, and I managed to get a reasonably tidy hole cut.
I spray painted the back of the top sheet of acrylic white and mounted everything on it before doing the soldering. Finally I hot glued the 7 segment display into place.
This is the triple-deck arrangement of boards with the Speaker-pHat at the bottom, Protozero in the middle and Raspberry Pi Zero on top.