James West

May include blinky lights. And cocktails.

Tag: radio

Cramming the Google AIY kit into a Roberts radio

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.

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.

Usual mess of wires

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.

Roberts Rambler 2

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.

Raspberry Pi internet radio

Last week I finished making my second Raspberry Pi powered internet radio.

Raspberry Pi Radio

Here’s a list of the hardware I used.

  • Raspberry Pi Zero
  • Pimoroni Speaker pHat amp
  • Protozero prototyping board
  • Adafruit 7 segment display backpack
  • 4 ohm 3 watt speaker, two buttons and a potentiometer from my box of bits and pieces
  • USB wifi adapter (if only there was a Pi Zero with wireless built in…)
  • Muji photo frame

The radio is a development of one I made a year ago, which borrowed heavily from the many internet radios Giles Booth has made.

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.

Raspberry Pi Radio

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.


import time
import os
import subprocess
import sys
from gpiozero import Button
from subprocess import check_call

pid = subprocess.Popen([sys.executable, "clock.py"])

def shutdown():
   check_call(['sudo', 'poweroff'])

shutdown_btn = Button(17, hold_time=3)
shutdown_btn.when_held = shutdown

# pause()

button = Button(23)

# set station to 5 live
station = 5

os.system("mpc play " + str(station))

while True:
  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

You can also find the code on GitHub.

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.

Speaker-pHat, Protozero and Raspberry Pi Zero triple stack

There are more photos here.

I’ve a few ideas for future modifications:

  • Work out how to get the VU meter on the front of the Speaker pHat pumping
  • Or use the LEDs to indicate which station I’m listening to
  • Make it tweet whenever I change stations (can I code it to only tweet after a station has been streaming for ten seconds so it doesn’t go crazy when I change from 5 live to Radio 2?)

© 2019 James West

Theme by Anders NorĂ©nUp ↑