home / blog / podcasts / videos / notes / photos / about / more

AirPlay Radio

with Raspberry Pi and WiFi

Posted by Jeena

Before I started working for Pelagicore I won two Raspberry Pi's (short RP) which they sponsored. One because I was one of the first people on the foss-gbg mailinglist which they started. It is for people from Gothenburg and surroundings who would like to join others and talk about open source stuff in Gothenburg. And another which I won because I was on a hackaton for embedded systems they hosted. I also already had one more from before which I wanted to use as my entertainment system in the living room but this never really worked, I described why in a earlier blogpost.

Raspberry Pi

Anyway, I had 3 RP's and didn't know what to do with them. Then a colleague showed me a YouTube video where someone made a remote controllable entertainment system built in to the bath room ceiling with help of a RP, a amplifier and a couple of loudspeakers.

I often listen to podcasts or german radio on my computer and have often the problem that when I go out of the kitchen to the bath room or the bedroom. I was thinking about buying a couple of those AirPlay speakers, but I found all of them really expensive for what they did and I never got around researching if there are some I would like.

But that video gave me a great idea: Why not use one of my RP's, put it into an old radio and stream audio from my iMac or iPhone to that mobile device. I could take this then with me to both the bathroom and the bedroom, and even outside if I wanted.

I know I could learn everything about electronics and just use the radios transformer to get rechargeable batteries charged and the 5V which the RP needs. I sure even could find out how to hack in between the built in tuner and amplifier to use both together with the built in speaker for the audio.

But I am a lazy person, I don't have much free time and I have the money to buy other parts which make it easier for me to get the project done. You know, refining a already working project is so much easier then getting it perfect from the start.


So I bought a big rechargeable battery with a USB input for charging and output for the RP.


At home I already had one of those really small USB chargers. I removed the plastic shell and soldered it to the power input of the the old radio. That way I can load the battery without removing it, just by plugging in the radio into a normal 230 V power outlet.

USB charger

I bought a really old radio from a second hand shop. I got it for 2,50 € and I removed almost everything inside it to have space for the RP and the speakers. I put the battery and the USB charger where normally the four "D" batteries went.

Battery and USB charger

I also bought a USB WiFi stick and attached it to the RP because, obviously, in some way I need to get the audio stream from my iPhone/iMac on to this radio.


And lastly I bought a couple of cheap computer speakers powered via USB which I connected to the second USB port of the RP and put inside of the old radio shell.


All in all it was quite expensive:

Name Price
97 €
battery 20 €
USB WiFi 13 €
Raspberry Pi 33 €
case 10 €
speakers 10 €
old radio 3 €
USB charger 3 €
SD card 5 €

97 € which is kind of the starting price for one of those off the shelf AirPlay loudspeakers. But I am confident that the next one will be much cheaper, because I will have learned more about electronics so I will be able to reuse the old radios interna instead of buying every part separately. But to be honest, most of the small stuff I already had lying around at home and haven't been using them anyway.

Old radio, working as a AirPlay laudspeaker


I used ArchLinux because it doesn't have stuff installed and started I don't need anyway, so it will not use power unnecessarily. And frankly I only had a 2 GB SD card at hand, Raspbian needs a 4 GB one.

I installed a WiFi driver, Alsa, and at first the perl version of ShairPort which had really bad audio performance. After a bit of research I found out that the original repo of ShairPort moved on and has rewritten everything in C instead. I compiled it and oh wonder all the audio problems are gone! Funny side note, every other website writing about the perl version of ShairPort tried, and succeed, to convince people that the RP's audio output is really bad and that you need to buy a USB sound card to get it working.

Luckily ArchLinux already uses systemd which I know from work, so I wrote a service file to autostart ShairPort on boot, configuread and added autostart of wifi, alsa, etc. and it works flawlessly. I'm very impressed, it shows up together with my AirPort Express on my iMac and iPhone as a normal AirPlay device and behaves exactly like the AirPort Express.


There is still some weird stuff going on sometimes which I want to adress.

And one could even use the other hardware buttons to do more cool stuff, for example to have some software installed which runs a standalone internet radio, without the need of streaming from the iPhone or iMac, and to change the channels with the buttons. Or even use the potentiometer on the top right to search for new channels.

There is a on/off button on the top which I would like to use to turn the RP on or off and reboot it, which I think will be the first refinement of this project.

[update:] Discussion on HackerNews

2 Replies

1 Mention

ePirat Kelvin me Jason M Oliver ♥ Michaela Joshua Murray MOREnet Simon Old Fashioned dan alimojd Natalie Griffith Chris Routledge mathew wise Sara Blackthorne lonán Victor Carreño Guido Martinez RenatoJG Jonathan Pluck klinster Jeff McClure Jack Wilsdon Lee Cremeans Bacon Neck Games Mark Eltringham Aykut Celik Mariusz Sobociński Royal Gunner Stefan Urban Anjar Ollie Joe Henstridge juanfunez undertuga Andy Cherry Keith D Andrade Doug Phillips Daniel Caswell Oliver 박신종 Santos Solorzano Benas Trevor Cunningham opyh Anders Bornholm Cathy Young Bunnyhausen Elhaz Mike Renwick Maxine Ricardo Sueiras Tanatix Jesús Gil Austin Dixon Emmanuel Vandenbergh Aaron Fischer Joey Tyson Dani My-khael Pierce sree kotay Salva ⒸⒽⓄⓁⓄⓂⓁⒺⓎ daria bstru Edmond O'Connor Iskender P.S. Padraig Gubbins Nathan Blair Patrick Coombe Jesse Wallace Fabster ᅠᅠ ᅠᅠ ᅠᅠ Schonenberg Andrew Graham Jay Greasley Fernando Doutel Atsushi Ashigaru titi17 CoderDojo Karlskrona Robin Brandt wilson brown Alessandro Biondo Jakob Jungmann no lack of void Stephane Chenier Erich Donahue gooks Mugen Konrad Krawiec


Kost Francesco Perozzo Oldcrow Name Simon kamui57 Sara Blackthorne Raspberry Pi Jonathan Pluck Valentin Brosseau me Darren Stephens Lee Cremeans Jason M Oliver Carsten S. Addartis techgknet Royal Gunner Scott Kinnaird Ludovic Piot HamRadio Laurent Mark Eltringham David Spaeth Nicolas Taffin Adam Primhak Pharma Watch Keith D Andrade Daniel Mattsson Roberto Baldwin Roy Wetherall Ben Griffiths mat x Nedim Hadzic Thomas Lofts Peter B Chris Slater Bunnyhausen %CNXMAN, Quorum lost The Pi Zone Christian Beaubien Euan McAleece Dean Whitaker NotSoNovel Dell M Abie Krysalia h. Ash Choudry Steve Jones Creative Coding AMS Sameer Kulkarny Metal Queer Solid Ruslan Khozinov Ben Dunicliff CoderDojo Karlskrona Peter Goulborn Didier paul martin Steve K. wilson brown Folder Icon James Breward - Brew Τύχη Phillip Kast Tobias Olausson

Have you written a response? Let me know the URL:

There's also indie comments (webmentions) support.