Thu, 11 Jul 2024 08:22:47 -0500The simplest thing that could possibly play WPR

mr's Preposter.us Blog

Our dog Einstein was sad because he couldn’t listen to Wisconsin Public Radio.

image3.jpeg

For years we had a Henry Kloss Model 1 that happily played our local WPR station wirelessly for free with no internet, no ads, what a technology!  Unfortunately a year or so ago it got harder and harder to get a clean signal, so we had to find another way.

I found an old SONOS PLAY 3 at a thrift store and remember from the days when I wrote code for these things that they could play radio streams.  Things had changed, and I had to create an account with a third-party service just to play the free mp3 stream from WPR, but it worked for the most part even though it took way longer to start playing music than the old FM radio.

Then there were several updates to the SONOS software, and with the most recent one the device was rendered unusable.

The fact that this great-sounding piece of hardware that is physically in great shape (and probably will be for decades) is rendered useless just because it uses proprietary software breaks my heart.  I’ve experimented with designing my own media devices for years for just this reason but I never finish them because I run out of time or the scope spirals out of control.

This time I needed something soon, so I thought “how fast can I cobble-together something that can just play this one stream?”.

Turns out the answer is “about 60 minutes”.

I spent about 15 minutes searching for ways to force the SONOS to do this but they all involved additional services, etc. which doesn’t interest me (just more stuff to break in the future).  So I gave-up on the SONOS (for now) and grabbed the Model 1.

The Model 1 has an aux port which opens a world of possibilities.  There’s hundreds of off-the-shelf devices that could use this but I wanted something that was simple and didn’t require another device to work (so Bluetooth, etc. is out).  I also wanted something that was as open as possible so I could fix it if it screwed-up.

I had an old Rasberry Pi 3 Model A+ which has the perfect combination of being small and having both WiFi and an analog audio out jack.  I did a quick test to see if I could get the stream to play reliably using mplayerand after a couple of hours it was still going strong.

image4.jpeg
Einstein with his ear to the floor above the lab when I was testing playback

To make this fully automatic I wrote a shell script that checks to see if the stream is playing and if not, start it again.

image0.jpeg

Then I scheduled this script to run once a minute so that if the Pi reboots or looses power it should start playing again as soon as it boots-up.  

image1.jpeg

A reboot confirmed this, so I hauled everything upstairs and tucked all the ugly stuff behind a cabinet.

That’s pretty much it.  I’ll design & print a case for it to protect the board but otherwise this is good enough.  Of course I have lots of ideas for improvements, but for now this is enough to satisfy the primary demographic.

image5.jpeg