Shower podcasts Part 1 - proof of concept

2 minute read

The problem I was trying to solve is fairly simple: I’ve had an FM radio in my shower for years, it’s sort-of water proof (more accurately it’s splash resistant), but NPR isn’t always the most joyful thing to listne to in the shower. I just wished there was a way to use that to listen to my podcasts from my iPhone.

Proof of concept

I had a spare Raspberry Pi on my hands, this is something that can surely be used.

The radio part

There’s a very intersting project which uses bit banging on the GPIOs in order to create an RM signal. The setup is really straightforward, you just stick a loose wire to one of the GPIOs, and that’s basically it

Receiving the podcast audio

The shairport-sync project handles the AirPlay part. There are quite a few options, but most of the default ones work. The only specificity here was that for the proof of concept I needed to pipe shairport-sync’s output to the fm_transmitter utility’s input, which only supports a handful of audio formats.

Piping the two

As documented, fm_transmitter only supports “raw” audio, which as far as I understand is a form of PCM.

After a few trials and errors, I came up with the following command that works, using the sox utility to do the audio format converstion.

shairport-sync -o=stdout |  sox -c 2 -r 44100 -b 16 -t raw -e signed - -t wav - | ./fm_transmitter -f 107.8 -

A viable solution?

It worked! I personally find it impressive that you can get an FM signal off GPIOs, but I could hear my podcast on the receiver!

Then I started wondering about the power level, and how I could keep this legal (according to FCC regulations, you seems to be allowed a very small but not zero power level). Going down that rabbit hole I found that some people had done a spectrum analysis of that solution, and that it was bleeding on many many frequencies. Considering that bit-banging a GPIO basically gives you a square signal, this isn’t too surprising. So now, not only do I need to worry about the power on the FM spectrum, but also about all these other frequencies I was now polluting.

So dedicated hardware

Adafruit sells a fairly inexpensive fm transmitter unit that is documented to be fairly easily interfaced with a Raspberry Pi. Apparently input is through an audio jack, which isn’t great from a packaging standpoint, but we’ll cross that bridge when we come to it.

At least, that’s a great lead into getting a clean FM signal.

In the next episode, I’ll be playing with that piece of hardware!