This is a project for Arduino and Raspberry Pi to make an Internet
Radio, aimed at intermediate skill level. Some familiarity with Linux usage will be beneficial (or access to someone who can help out if required).
Raspberry Pi runs mpd music player daemon to receive and decode the internet radio stream.
ALSA running on the Raspberry Pi provides the sound through either the Jack Socket or the HDMI output.
Arduino runs a nanpy interface code to interface with Python, providing Text output of the Radio Station playing and Button inputs to control Playback.
* Learn how to use the mpd/mpc on the Raspberry Pi
* Learn how to use the nanpy library for Python to interface the Pi to the Arduino
* Make a Cool Internet Radio
By the way. If you like this Instructable, you might also like to read My Blog covering various projects and Tutorials. ==============
You will need:
* Arduino UNO
* LCD / Keyboard Shield e.g. (http://goo.gl/XAhvx)
* Raspberry Pi
* USB and Ethernet cables
The first thing we have to do is update Raspbian and install the required packages. Make sure you're logged in (obviously), and you have an Internet connection.
1. Update Raspbian to the latest packages
$ sudo apt-get update
2. Install the mpd / mpc packages
$ sudo apt-get install mpc mpd
This installs the Music Player Daemon (mpd) and it's client mpc.
You use the mpc client to configure mpd to add radio streams to the playlist, start and stop the player etc.
Now that we've done all the preliminary installation and setup, it's time to get on to some fun stuff.
Let's start by getting some music playing.
We need to add some radio stations to be played by mpd.
The mpd music player daemon is controlled and configerd by its client, mpc.
Let's add our first Radio Stream and get some music playing.
"Radio Paradise" is the first station we'll add to get us off to a funky-retro start. To do that we use mpc add as follows:
$ mpc add http://stream-sd.radioparadise.com:8056
and to play it:
$ mpc play 1
You should now hear Radio Paradise from the Pi and see on the Terminal Window that the station is playing. If you don't hear anything try plugging a speaker or headphones into the Jack Socket.
Type mpc help to see other options available to you with mpc.
Other suggested radio streams are:
RTE radio 1: $ mpc add http://icecast2.rte.ie/ieradio1
Monkey Radio: $ mpc add http://220.127.116.11:6969
The Smooth Lounge: $ mpc add http://listen.radionomy.com/the-smooth-lounge
Radio Nova: $ mpc add http://radionova128.media.vistatec.ie:80
Newstalk: $ mpc add http://newstalk.fmstreams.com:8080
Maybe adding stations needs an instructable of it's own, it can be a bit of a treasure hunt :-) See this article for advice http://wiki.slimdevices.com/index.php/Internet_radio
But I'll give you an example to show how I did it :
Go to a site with some radio streams e.g. http://www.listenlive.eu/
and a suitable link from that e.g. Top40: http://www.listenlive.eu/top40.html
Click RIGHT on a link under the "Listen Live" column, looking for URLs that end in .m3u. I chose Q-Music so I RIGHT clicked on the 96kbps link to open the file "http://icecast4.play.cz/evropa2-64.mp3.m3u".
This is a text file so make sure this file is opened with Notepad.
The file contains the line: "http://icecast-qmusic.cdp.triple-it.nl:80/Qmusic_be_live_96.mp3" so the correct URL should be: "http://icecast-qmusic.cdp.triple-it.nl:80"
Other links on the ListenLive site link directly to a URL for streaming; e.g. Alpha Radio: "http://18.104.22.168:8009/listen.pls" , so the URL would be: "http://22.214.171.124:8009"
Now we have a perfectly good Linux controllable Internet Radio.
But we don't want to stop there. We want to control the Radio from the Buttons on the Arduino and we want to see which Radio Station we're listening to on the LCD display.
To do that we need to write a Python Program running on the Pi that controls the Arduino.
Using nano or your favourite editor enter the Python code from giithub. (I used to have the code below but Instructables editor totally screws up the indenting so it's confusing).
Once entered and saved as radio.py , type
$ python radio. py &
You should now be able to control playback and station selection from the buttons on the Pi and see the selected station on the LCD.
UPDATE: jazzi_p merged this radio project with usualpanic.com web radio. You can get the code from github. The menu is added to display ip addess, set the audio port to hdmi/analog or auto. Also added the shutdown option. The volume keys are changed to left and right buttons and also it display's the volume status on the LCD, to change the stations we use up and bottom key. The Select key is used to activate the sub menu. Another option added is to Reload of playlist. Please check the tutorial on usualpanic.com for creating radio_playlist.sh file.