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.
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.
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.
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:
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.
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
/home/olav/work/radio/radio.py 2>&1 &
/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"
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:
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.
Third Prize in the
Pi/e Day Contest
1 Person Made This Project!
- Jasea made it!