Little Box of Fip

I’ve made many Raspberry Pi internet radios in the past – here’s how to make the simplest one possible, making use of an ancient RaspberryPi 1B that was lying neglected at the back of the drawer. This one is so simple, you can’t even change channel – the only internet radio station I ever listen to is the French station fip, so this is a perfect addition to the kitchen, and I’ll wire it in to the 3.5mm audio input socket on an old iPod dock.

Here’s what you need:

  • An old Raspberry Pi with SD card, power supply, wifi dongle
  • A keyboard, HDMI cable and some wired internet – all of these only temporarily
  • A 3.5mm audio jack lead to connect to the input of an amplifier or iPod dock.

Fresh OS install

I did try updating the old version of Wheezy on the old Pi’s SD card, but I ran into all sorts of problems. Far easier to do a fresh install of Raspbian Jesse Lite – this is a small install that doesn’t have a GUI, nor any of the software installed on the desktop like LibreOffice or the dreaded leviathan that is Wolfram. It’s command line only. That’s all we need for this.

First, as there were no files I wanted on the card, I re-formatted the SD card in my MacBook using Disk Utility as a single FAT32 partition. It was an 8GB card but I am sure you could use a far smaller one. I then downloaded NOOBS Lite, unzipped and dragged the files onto the SD card, then ejected it from the MacBook and plugged it back in the Pi.

I then plugged the Pi into my TV and plugged some wired internet into the Pi’s ethernet socket, booted it up and did a network install of Raspbian Jesse Lite. When this was finished I rebooted the Pi, and ran raspi-config to do a few things:

  • enabled ssh so I can log in remotely if I need to (it won’t have a screen or keyboard)
  • forced audio output to audio jack
  • selected option to wait until has network to boot
  • renamed device ‘fip’ so I can find it on my home network easily

Install a media player and add a station

I then installed the mpc media player by typing:
sudo apt-get install mpc mpd

I then added fip as a radio station by typing:
mpc add http://audio.scdn.arkena.com/11016/fip-midfi128.mp3

(As at Feb 2020 fip is at http://icecast.radiofrance.fr/fip-midfi.mp3 and you can find addresses for BBC local, regional and national radio stations on my page here.)

Test this works by typing
mpc play 1
at the command line. You should hear the station you added from the headphone jack on the Pi. (If you add more stations they’d be mpc play 2, 3, etc.)

I then ran
alsamixer
at the command line to turn the volume up as high as it can go, and stopped the stream playing with
mpc stop

Make it play automatically at boot

I then wrote a little shell script to play the radio by typing nano radio.sh and entering the following lines:
#!/bin/bash
mpc play 1

The press ctrl-x to save and exit.

Then I typed
chmod 755 radio.sh
to make it executable. I then typed sudo nano /etc/rc.local and added this line before exit 0:
/home/pi/radio.sh

Reboot the Pi, and it should now play your internet stream as soon as it boots up.

Wifi would be useful so I unplugged the ethernet, added a USB dongle and followed the instructions here about setting up a wifi network’s SSID and password. Rebooted without wired internet – and bingo, a little box that just plays my favourite radio station. This is probably massive feature creep, but if I could add ONE button, it might be one to shut it down gracefully…

This entry was posted in Linux, radio, Raspbian and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>