EduRadio

This tutorial shows you how to build an internet radio using a Raspberry Pi and an EduBoard!

The project is based around the EduBoard and assumes the SSD1306 OLED display library already installed, and configured. This must be done before trying to use the radio!
This project creates an internet streaming radio for the Raspberry Pi using the 128 x 64 pixel OLED screen, and using the two tactile switches on the EduBoard.

You will need a speaker or headphones plugged in to you Raspberry Pi audio jack.

To set up the SSD1306 OLED display library use the “Usage of the SSD1306 OLED Display” tutorial. Tutorial 9

If not already installed.

Before you begin to install any software it’s best to make sure the package files are up-to-date. Tutorial 3

Now install mpc and mpd using the following command:

During installation you will need to hit “Y”, followed by enter.

To add some radio stations to your play list use the mpc add commnad:

Radio station source: http://www.radiosure.com/stations/

You can test your web radio typing in the following command to the terminal prompt:

The output should be something like this:

Radio A Go Go: The Yardbirds - Heart Full Of Soul
[playing] #1/1 0:00/0:00 (0%)
volume: 80% repeat: off random: off single: off consume: off

and of course, you should hear your newly added radio station from the speakers.

To stop playing use the following:

Output:

volume: 80% repeat: off random: off single: off consume: off

and the music will stop.

mpc help will list out all the Options, and commands.

Adding Buttons

To control the web radio with buttons, we will use the following script:

Each control is started with a command such as:

The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module intends to replace several older modules and functions

Save the above script as: radio.py

You should run the python program from within that folder:

 

Adding The Display

The follwoing code example will add the OLED display function to the web radio, including the previous button function example.

RED button = Play/Stop

BLACK button = Next Song/Next Station

Save the script as: radio_oled.py

You should run the python program from within that folder:

Enjoy..:-)

FullSizeRender(1)