Since long past times, when Gugliemo Marconi has amazed the entire World broadcasting his radio signals from the Elettra ship, a subject held dear by electronic engineers has been radio transmission. After these years, the scenario has changed a lot, firstly with the appering of digital technologies (DAB, for instance) and, up to day, with the streaming of radio transmissions on internet network by the TCP/IP protocol. Is this still radio? Or we can just talk of broadcasting radio station programs by TCP/IP network?.
Less fascinating than the old radio technology by “internet radio” we are able to send “radio” communication far beyond the range of “wireless” radio. In the current and in following articles, we would like to approach the topic of radio and audio broadcasting on TCP/IP network and its integration with radio repeaters, in order to build something like “hybrid” radio links. The example proposed in the article is based on Raspberry Pi that is, by now, the preferred platform for our tutorials on GNU/Linux embedded world. In this first issue we are depicting how to build a portable internet “radio”, it is a device suitable for receiving and managing radio and audio streaming carried by an internet connection, both wired and wireless. We will also cover the management of audio track playlists stored on USB keys or on network shared disk drives. Streaming trasmission requires sending a flows of TCP/HTTP packets containing bunches of digitazed audio from production and distribution servers to clients scattered all over internet networks, where the streaming itself will be turned again into audible sounds.
Figure represents the generic flow of transmissions and reception of audio streaming over internet. The streaming transport protocol can work at many different transmission rates in order to allow the client to choose the best rate according with the speed of the connections it is wired to. In this project we considered two different types of “human” interface”. The first is based on the LCD shield. The second is a web based interface. On the LCD shield five push buttons allow setting the radio by application menu functions as like as browsing radio station and audio tracks or setting up the volume.
The figure shows the application block diagram we are going to set up. Tanks to the effort of Bob Rathbone and Adafruit Industries, both expert in building and delivering products and expertise on Raspberry Pi, that have delivered many useful software tools and application to the community under the GNU GPL licence, we can adopt in our project, many “ready to use” software “bricks”. Actually, to complete the project, it is just required to physically assembly and install the LCD shield, the WiFi dongle and to download and configure the software. No programming it is required. The core module of the whole project is the MPD software. MPD stays for Music Player Daemon, that is a software server aimed to play audio streaming and files.
It has been written to run on old pc powered by Pentium 75 processors. The main purpose of this software is using as less system resources as possible, while being able to perform gapless playback, output audio buffering and cross fading. This features and the availability of the package for the Debian distribution make it the ideal tool to be installed on Raspberry Pi. Moreover MPD developers have kept a clear separation between server and client side of the tool. This leave the user free to choose which user interfaces adopt to manage his proper sound box, among the many available. On the web we can get a variety of clients with different interfaces like command line, stand alone GUI and web oriented applications, compatible with different device types like PC, tablet, smartphones, etc. You can find a list of available clients at the address http://mpd.wikia.com/wiki/Clients
You can go trough and try many of them. In this project we are going to install the solution developed basically for Raspberry Pi by Bob Rathbone (thanks!), from a fork of the Snoopy MPD client.
Setting up Raspberry Pi
In this project we choose to start from a fresh copy of Raspberry Pi Raspbian operating system. This because who is going to build a project like this is probably going to develop a “dedicated” solution of “portable” internet radio.
To start from a fresh copy of the operating system we have to download the last version from the download section of the Raspberry Pi official site at the address http://www.raspberrypi.org/downloads. Unzip and burn it into a SD Card using Win32DiskImager tool. Insert the SD Card in the Raspberry Pi slot, connect the network and the power cables and turn it on. Once connected, create the “root” user, and login with it. The first operation is upgrading the Raspbian distribution typing:
to open the Raspberry Pi configuration tool and expand the rootfs filesystem to fit the entire capacity of the SD Card. At this point we can take advantage of having the raspi-config opened in order to configure the correct geographical area, the current date and time and the keybord layout configuration. Exit the raspi-config configurator and accept the reboot request. Reconnect to Raspberry Pi using the “root” login and, using WINScp, enter the /home/pi folder and add a new folder. Name it “radio”.
For more detail: Internet Radio with Raspberry Pi