Raspberry Pi STL in a Box

I promised more details in the future about the Raspberry Pi STL build. Well, against all odds, I’m going to deliver!

The project exists purely to solve a problem with getting audio between two sites for a hospital radio station. They currently use a costly dedicated line that’s purely analogue. Imagine the old fashioned exchange with patch cables everywhere and you’ve pretty much got the picture. Ok, I admit it’s not quite that old fashioned, but a balanced line with “Post Office” written on the equipment doesn’t really scream the height of modern technology.

To reduce costs and improve quality, we started looked at a number of other options. RF links of any form are pretty much a dead option thanks to the terrain between the two sites. It might only be three miles between them as the crow flies but there’s a ridge in the way. There’s no way we’re getting anything near “line of site” between them.

That’s pushed us to look at IP and ADSL circuits. We’re planning to get one installed which this box will be plumbed in to.

And talking of the box, it’s configured to pull a private webstream and fallback to an audio loop on failure. This is something a Raspberry Pi can do with little bother and detailed in this article about configuring LiquidSoap (the software we’re using). LiquidSoap and webstreaming was chosen over OpenOB as the station is already generating a private stream in 64k AAC+ and we needed the fallback feature.

But that doesn’t explain why I’ve gutted an old equipment box headed for the bin rather than just directly installing the Raspberry Pi. There’s two reasons for that. Firstly, we need the audio output to be electrically balanced. While something like an Alice Matchpak could have been used, it’s yet another box that has to be supported in a remote location.

The second reason I’ve built this box is that it’s going into a remote location the station has limited access to (someone else’s racks room). Simple metering and a 16×2 LCD display provide information that can be relayed to us over the phone if something goes wrong. I doubt many engineers will struggle to understand a display that says “!!!ON BACKUP!!!” along with “No IP Address!”.

The LCD display is in reality a PiFace. That in turn is fed data by a script that is constantly running on the Pi and monitors the LiquidSoap log file. It also pulls data from the MusicStats service to provide a “now playing” display. Not a necessary feature but it does prove the system is still alive and has a network connection.

In case you ever need anything like this youself, here’s a copy of the script that’s currently in use. Well, with all the sensitive bits edited out.

Metering is provided through a pair of LM3915 LED meter drivers and balancing is provided by a pair of SSM2142 chips. Admittedly it’s probably cheating to use these but it keeps the circuit simple.

Anyway, enough of the words – time for pictures. First of which is the circuit diagram for the audio side of things. Click on it to see the full scale version in a new browser tab.

I’ll warn you before we get to the internal pictures, things are a bit messy. I’ve never been too good at making things look neat. That said, the fire extinguisher in the cover picture is there as a joke. I swear…

Anyway, here’s a shot of the audio circuitry. I did warn you it would be messy:

Now for the brains of the operation, the Raspberry Pi:

We can’t forget the PiFace, solidly glued onto the front panel:

Things are a bit tight in that box. Thankfully it all works OK and heat isn’t too much of a problem (the various air holes in the box help with that one). As proof, here’s some fine music from the homeland playing on the station:

4 Responses

I just found your blog and have thoroughly enjoyed your projects. I did have a few questions about this project though. What are the values of Resistors R7,R8,R9.R10,R11 and R12? I also was trying to find the link to the script that you used for the PiFace and had no luck. Love this project and have a few things I would like to do with it. Thanks!

I’m usually quite good at putting the resistor values onto my diagrams. Apologies for missing those ones!

R7/R8 and R9/R10 are likely values I’ll have tweaked from experimenting. They adjust the reference level of the meter through a potential divider. Something like a 10k or 20k pot could make a good replacement for these.

To get you the actual values I used, I’d have to take the unit out of service and get the lid off to see the values.

For 11 and 12 I used two 41ohm resistors. These are just acting as LED protection resistors. They could probably be adjusted depending on the brightness you need from the LED display.

That’s probably something that got missed in the blog migration a little while back. Either way, I’ve got a copy of the script in the STL and Raspberry Pis article. It’s built round liquidsoap for pulling the audio but may be of some help to you.