Raspberry Pi project: Simplest internet radio
I wanted to recreate the simplicity of a traditional portable radio, but using an internet stream.
That is to say it’s always tuned to Radio 4 and the only useful choices are to turn it on, turn it off (Archers), or change the volume.
It struck me that a Griffin PowerMate is an ideal interface for this. It’s got a dial for the volume, you can click it to turn it on or off, and there’s an LED built in to show the current status.
Playing a radio stream on the command line is pretty simple, thanks to the BBC serving up URLs like the following:
# Choose a station (one of: radio_one, radio_two, radio_three, radio_fourfm, radio_four_extra, radio_five_live, radio_five_live_sports_extra, 6music) ffplay -nodisp http://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/nonuk/low/ak/bbc_radio_fourfm.m3u8
Using the Griffin PowerMate on Linux is less simple. I’d previously used Gizmo Daemon in Linux and that worked OK, but it doesn’t seem to have been maintained in the last decade and apparently needs a bunch of manual edits to get it to compile on a Raspberry Pi. I also looked at evrouter but hit some issues when running it headless, as it seems quite bound to a graphical X environment. Finally I found Will Sowerbutts’ Griffin PowerMate driver for Linux and this seemed a really good basis to work from.
Adapting Will’s code to my needs, the result was github.com/paulherron/powermate-hooks. I’ve tried to present it in a fairly generic way, in the sense that putting scripts in the
hooks/ directly would allow you to run any commands. But if you follow the default install steps you’ll get an internet radio!