Introduction: Raspberry Pi, Internet Radio

We have been aiming to do a mini hack for a while to bring some new life to an old radio and let us radio are favourite internet radio stations.

Step 1: You Will Need...

Depending on the radio you are going to install your Raspberry Pi into, your design will vary and thus the parts and equipment required will also. Below is a generic list based on what we used, it is not complete but should give you a good idea.

Parts:

1x Raspberry Pi.

1x SDcard with 4 GB.

1x AC adapter with micro USB plug or a DC-DC converter supplying 5v and a micro USB lead.

1x Wireless LAN Adapter (n150).

1x Adafruit RGB LCD.

1x A radio large enough to fit pi screen etc.

4x Sub-Miniature Push-to-Make Switches Two Red & Two black.

1x Dupont cable or and IDC cable e.g. an IDE hard disk cable.

1x Heat shrink tubing.

Hot melt glue.

Cable ties.

Tools & Equipment:

Basic hand tools e.g. screwdrivers, wire cutters, craft knife, pliers etc.

Something to cut the radios case with, we used a a Dremel.

A drill for the holes for the buttons.

Files, medium and fine suitable for using on plastic to tidy up your cutting.

A soldering station or at a pinch a soldering iron.

A multimeter.

Hot Glue gun.

We are also assuming you will have a working internet WiFi connection for testing and access to an HDMI monitor / TV screen and a keyboard for setup.

Step 2: Setting Up Your Raspberry Pi

To setup the pi follow This Guide: http://www.raspberrypi.org/help/quick-start-guide... we have used the RASPBIAN OS, we used the build from January, we have not tested with the newer builds.

Once you have set up the Pi and plugged in the screen you will be presented with a blue setup wizard, in advanced settings change the hostname to something like "PiRadio", then you can exit the wizard, once you exit the system will reboot.

The next stage is to set up the wifi , log into the Pi using the following login details:

Username: pi

Password: Raspbery

Setup Wifi on the Pi to connect to the network where you will be using the radio: http://www.raspberrypi.org/documentation/configur...

Step 3: Controls & Display

We opted to use the 16x2 Character LCD + Keypad for Raspberry Pi from Adafruit for the display as they are readily available and well documented. We assembled the display module as per the instructions on the Adafruit web site which can be found here.

https://learn.adafruit.com/adafruit-16x2-character...

We did however make a few minor alterations to facilitate the placement of the display in the radio:


Instead of using the tactile switch push buttons provided we used some sub micro push to make buttons. These were connected with short lengths of wire soldered directly to the PCB. At the the switch end they were soldered and heat shrunk to reduce the risk of shorting.

With the LCD panel itself we soldered 0.1 pin headers on both the control board and the panel, these were linked with an old IDE hard disk cable we had lying around but any 0.1 pin pitch cable would suffice. This was done to enable us to fit the panel in the small space at the front of the radio.

Step 4: Setup Radio Software

The radio is based on this fantastic build we found on the internet https://tinkerthon.de/2013/04/internet-radio-mit-... we set modified it a little to get some uk radio stations and to work with newer pi os.

To start with setup Media Player (Mpd) with the following commands:

sudo apt-get install mpd mpc git 
sudo service mpd start

time to download the script and install it:

cd ~; git clone https://github.com/oschettler/radio.git

Now we need to make a few modifications to the script:

cd radio 
sudo nano initradio.sh

Change:

/home/olav/work/radio/radio.py 2>&1 &

To:

/home/pi/radio/radio.py 2>&1 &

Press Control O to save followed by Control X to exit.

sudo apt-get install python-smbus
sudo apt-get install python-serial python-imaging python-unidecode
sudo cp initradio.sh /etc/init.d/radio 
sudo update-rc.d radio defaults service 

We need to update the playlist address to do this:

sudo nano //etc/mpd.conf

playlist_directory "/var/lib/mpd/playlists"

To:

playlist_directory "/home/pi/radio/playlists"

Press Control O to save followed by Control X to exit.

sudo service radio start and the you shood be done,

Step 5: Upload a Play List.

All the stations will be stored in standard ".M3u" files that you can find for many podcasts and radio stations. To use them you just need to copy them to the server while the Pi is plugged in. I have made a list of stations which download and install with the following commands, with the Pi pluged into the screen login and then start xwindows with:

startx

Once into xwindows open the browser and head over to this guide and download the .zip file. Once it has downloaded, extract the files to the /pi/radio/playlists/ folder then open the file browser and head over to the file and then go to edit>Select all, right click on one of the properties and make sure all permissions are set so anyone can view, see screen shot.

Step 6: Altering the Radio Case

At this stage we can put the electronics inside almost anything but we chose to put it in an old radio so we could utilize its existing power supply and amplifier. Exactly how you go about fitting the Pi and display inside will depend on the radio you are working with. The following is how it worked out for us:

Cut a hole in the case of the radio to receive the display, we opted to do this on the front panel just below the analogue dial as there was plenty of space behind the the electronics and this area was relatively flat. Depending on the material your radio is made of there are many options to cutting the opening.

In our case we went with a Dremel fitted with a cut off disk, we soon realized that the heat generated was causing the plastic to melt and shrink back slightly. So to keep things neat we cut our opening a little small and then with a lot of patients slowly hand filed to get the precise shape required. If you are worried that you have not got it as neat as you would of liked then you could always get a bezel for your display

Drilling the holes to receive the buttons was much easier, just make sure you take care to see that there will be enough space for them and the wiring once the radio is re assembled. At this point we realized it was looking a little tight in the case and it was going to be difficult to fit everything in. In the end to make space for the raspberry PI etc we removed battery compartment once again using the Dremel and tidying up the edges with a file.

Step 7: Connecting to the Radio's Internal Circuits

With all the cutting out the way its just a simple matter of connecting the pi to the aux audio input of the radio and sorting out the power supply.

To connect the Pi to the aux input you could just plug a 3.5mm to 3.5mm lead from the audio out on the pi to the aux in on the radio. We however opted to cut off one of the plugs and solder the 3.5mm jack cable to the aux input circuit on the inside of the radio to make things neater.

To power the raspberry Pi we were originally going to use an external mobile phone style micro USB power supply, but when we opened up the radio we saw it would be very easy to draw 12v from the radio's internal power supply. The Raspberry Pi of course needs a 5v supply, so we decided to install a simple voltage regulator board to get 5v as we had one on hand (a better option would of been a DC-DC buck converter) and solder its output to a micro USB plug.

With all the above done its simply a matter of affixing all the above inside, to keep things simple we used a combination of hot glue and cable ties although there are many other options such as mounting pillars or double sided adhesive foam pads.

Step 8: Lets See If It Works!

Now for the moment of truth, we powered up the radio and the display came to life, we used the interface to choose a station and nothing. We soon realized that in came on with the volume turned right down. We turned it up and everything worked as expected. The audio quality is pretty good considering its a mono radio!

Step 9: Next Time.....

If we were to do this again I would be inclined try and leave the ability to run the radio on batteries and find an older radio to do the modification to. I would also consider bringing an Ethernet port out of the case so wired operation is possible. Other than those couple of things and possibly tidying things up a bit I am pretty happy with how it turned out.

Comments

author
JoeyyBoyy (author)2017-08-09

What was the approx. cost of this project in US dollars?

author
NevioP (author)2016-10-11

Ok so I figured out what was wrong with creating socket. I installed everything by your instructions. Shut down RPi and disconnect. Turned back on and nothing. It looks like I did something wrong. If I run LCD examples everything works ok but doesn't work when I start RPI. Please advise. Thank you! Great project!

author
NevioP (author)NevioP2016-10-12

Anybody? Please help. THANK YOU!!!!

author
KaushikMehul (author)2016-04-06

from where can i buy the outercasing?

author

Hi

I asume you mean the radio its self, we purchased ours from amazon, but you could use any similar radio.

http://www.amazon.co.uk/Steepletone-Brighton-1950s-Portable-Rotary/dp/B0060KZZKY/ref=sr_1_1?ie=UTF8&qid=1460377103&sr=8-1&keywords=radio+retro

author
bob8898 (author)2015-09-24

I it possible to modify anyof the files to eneable me streaming from pandora or spotify?

author
ggarcía-2 (author)2015-08-23

Looks very very nice. If I want to tune Spotify playlists?

author
Jasea made it! (author)2015-06-10

Hi Adam,

Thanks to your instructable I found this project very easy to complete. Power for the Raspberry was supplied by the circuitry taken from a power supplied from "The Pi Hut". I also added a Ethernet connection so that I could connect to the WIFI on foreign networks.

Jasea

DSCN0103.jpg
author

Hi Jasea

Looks like you made a really good job of building it, glad you found it easy. We look forward to seeing other project you build.

fizzPOP

author

Thanks for shareing that looks fantastic!

author
GrahamP3 (author)2015-04-23

I don't seem to be getting very far. I have been cutting and pasting the code, and keep getting:

"bash: syntax error near unexpected token `newline'"

on the 3rd line.

Does anyone know what I am doing wrong?

author
Adam2070 (author)GrahamP32015-04-23

Hi!

Some how the code layout has got corrupted and some stray html code has got mixed in i will update and fix it.

Sorry for any problems.

Adam

author
G-Whizz (author)Adam20702015-04-23

Thank you, but it is more likely to be a schoolboy error made by me.

author
Adam2070 (author)Adam20702015-04-23

All done, if you still have any issues cut and paste the code you are having issues with and i will help you out has much has i can.

author
kayalar (author)2015-03-18

I have made this internet radio, following the instruct-able (thanks for a great project!) and it works OK. But, if the radio stream is interrupted, the radio stops and doesn't pick up the station again when it returns. Is there any way to add some buffering or repeated tries to reconnect ??

author
Adam2070 (author)kayalar2015-03-18

Hi!

I am at work at the moment but is sounds like a buffering problem. You might be able to fix it with the following guide.

https://volumio.org/forum/mpd-settings-for-problematic-wifi-t1895.html

i will have a look when i can let me no if that works.

author
kayalar (author)Adam20702015-03-18

Thanks Adam,

I'll have a look at that this evening and let you know.

Otherwise it's a great project - many thanks !!

author
Adam2070 (author)kayalar2015-03-19

That's Fantastic if you get chance post some pics of the build, would love to love to see it.

author
kayalar (author)Adam20702015-03-18

Hi again, Adam,

I've changed the settings as outlined in the volumio link you gave and things are looking much better!

(I am using a wired connection to my router)

The biggest improvement has been to add :-

buffer_time "15000000"

(yes, 15 seconds !)

to the alsa audio_output section of /etc/mpd.conf

So far the stream has been running for half an hour without any hickup !

My internet connection can be a bit iffy here in North Cyprus so I think your comment about it being a buffering problem is spot on.

Running "top" on the pi is showing "mpd" using about 10% cpu, 4.% memory and "radio.py" using 3% CPU and 1.5% memory.

Many thanks for your help, I'll get back if it goes "pear shaped"!

Nigel

author
oculartechie (author)2015-03-13

For the voltage regulator, did you use a simple 7805? If so, how did you prevent signal noise coming from the Pi? I am attempting a similar project using a USB DAC. I was thinking of using a DC-DC buck converter to avoid the signal noise.

author
Adam2070 (author)oculartechie2015-03-14

We used a dc to dc converter we had around; it was not necessarily the best one for the job that is why we have not given much info about it. The one we used was.

http://www.ebay.co.uk/itm/Hobbywing-3A-5-volt-UBEC-12v-8XAA-pack-Power-a-Raspberry-Pi-from-batteries-/161406021367?pt=LH_DefaultDomain_3&hash=item25948c6ef7

but there are much more efficient ones on the market.

author

Hi oculartechie

We did go down the route of a 7805 to start with but have now change it to using a DC-DC buck converter not so much due to noise (dc-dc converters can have issues here as well is not we designed) but due to the poor efficiency of using just a regulator. In the end we went with a converter intended for use with quad-copters etc as it was available easily online, although if I would be tempted just to design my own psu circuit going forward.

Cheers, Stuart

author
crank_girl (author)2015-03-11

Good work! I've got an old radio that I've been keeping for just such an 'ible.

author
tomatoskins (author)2015-03-09

This looks so beautiful! I love everything about it, thanks for sharing.

About This Instructable

103,342views

460favorites

License:

Bio: We are a small UK hack/makerspace. Wide and wild variations in interests. This is our official account. Open nights on Wednesdays. See @fzzpop, www ... More »
More by fizzPOP-TheBirminghamHackspace:Table Lamp USB ChargerDual weild MakeyMakey - even more inputs!Raspberry Pi, Internet Radio
Add instructable to: