Make your own internet radio

11 Mar 2014

Paradium the first

For quite some time now I always harbored two secret wishes. One involves Scarlett Johansson and a hot tub but today I'll be covering the other. A wish of having a simple standalone device that I can turn on and that starts playing my favorite radio station Radio Paradise right away. And outputs the best imaginable quality right do digital audio.

A few devices like that started to appear in stores, notably the Mondo internet radio but they all had severe shortcomings. They tended to be bulky and large and have their own remote control or lack a digital TOSLINK output or, which I found worst of all, didn't pick the right stream that you wanted. The encoding and bitrate of your choice and not someone elses. Also, they all haven't been built by me. So it was about time to change that.

Hardware

Raspberry Pi seems to be everone's little favorite toy nowadays, so it was the obvious choice. And much simpler than expected. It does present a few challenges though. How will I control it? Also, it doesn't have a TOSLINK digital audio connector. So how can I hook it up that way?

Well, the first question was quickly solved. I'm gonna have to write a tiny little webserver to control it with the iPhone. It mostly sits here on the table anyway. No extra remote. The question of the TOSLINK output is tougher and I finally settled for an extra device that extracts the audio signal out of the HDMI stream. Unfortunatley that device requires it's own power supply but I'll get to this later. So after all, this is what you need:

Paradium parts

Want me to write it down for ya? Here we go:

And of course, most importantly, you're gonna need a really cool casing. Some sort of object that you want to turn from liveless boring matter into the awesomness of your radio. Actually, that took me longest. I was rummaging through my stuff again and again and finally came up with that:

Paradium assembled

Neat, eh? I can't close the zipper though. The Pi does emit a little warmth and I don't want to fry it. That doesn't matter much though as it now has a dim red LED light coming out of it, making it look even cooler.

One remaining problem is the power. The Ligawo decoder comes with a 5V barrel connector supply. Small but present. Pi needs to be powered by micro USB and that requires yet another power supply. So you end up having two. To make things worse, you can't switch them both on with one power switch. Tests have shown that the HDMI decoder has to be switched on for at least a few seconds before the Pi boots. I suspect this might be because they negotiate some protocol via HDMI. Whatever. The whole setup consumes very little power and you're probably not going to switch it on or off a lot.

Installation

First of all, the Pi needed to be installed. It likes to run Raspbian. I did a headless install like here. Worked like a breeze. Setting up the wifi was a walk in the park and a few extra packages made me feel right at home. One thing needs to be remembered. There's a config.txt file on the Pi that sets up raspbian specific hardware settings. In order for the HDMI decoder to work properly you need to add the following parameter:

hdmi_force_edid_audio=1

So, long story short, I'm still working on the software but once it's done I will put it here for download and you don't have to mess with it.

Software

So how about the actual radio? Did I have to mess with retrieving streams and put them into a decoder programatically? No Sir, I did not. The powers that be gave us MPD. That little beast of a daemon can play everything. Really. local music database, internet streams, all sorts of codecs you name it. Also, it can be remote controlled from pretty much everything. Network interface included with client lib for every language on the planet. In this case Python, which is the standard for the Pi.

So the next step was the creation of a server that can control MPD and has a nice and good looking frontend on the iPhone. But as this text has long ago gone the way of all that is tl;dr I'm sparing you the details. Know that it will be included in the download. My next posting will cover that.

Right now I'm gonna lean back and listen to my favorite station.