Introduction: Raspberry Pi Radio

Picture of Raspberry Pi Radio

This retro looking radio was made from an old radio. Inside a Raspberry Pi and some other components were placed to make it work via the internet. It uses radio streams from the internet. Features of the radio are:

  • Tuning is done by turning the original tuning knob of the radio.
  • The tuned channel is pronounced through the speaker (in English or in your own language).
  • Both the tuned channel and current volume are stored in text files in order to restore these settings automatically the next time the radio is switched on.
  • Safe power off: the Raspberry Pi inside is properly shutdown upon pressing the power off button.
  • LED indicator to show if it is safe to remove the power cord.
  • Old style buttons for volume up/volume down.
  • Hardware includes a Raspberry Pi, a small audio amplifier, a rotary encoder as tuning control. All controls are connected to the Pi's GPIO connector. The software is a python script that I wrote.

Materials needed:

Step 1: Raspberry Pi Preparation

The OS and other software must be installed on the Raspberry Pi first. In this step we use a HDMI monitor to work with the Raspberry Pi. Later when all parts are mounted inside the radio case the only way to work with the Pi (for instance to add new radio channels, or update the software) is via SSH.

  1. Install the OS Raspbian with desktop on the Pi.
  2. Connect the Pi to your Wifi network and enable SSH and GPIO in Raspian settings.
  3. After this we need some additional software. Minimal MPlayer and Festival are needed. MPlayer is used to play the radio streams and Festival is a text-to-speech program that is used to pronounce the radio channels that you tune.
    This step can also be done using SSH since the network is there.

    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install festival
    sudo apt-get install mplayer2

Step 2: Hardware Installation

Picture of Hardware Installation

Open the case of your old radio and remove all components but the speaker.

Then install the new components according to the schematic. The input of the audio amplifier is connected to the audio output of the Pi. A capacitor is placed over the 5V of the Pi to decrease noise. I needed this because I use a cheap power adapter as power a source.

Connect the rotary encoder, the 3 switches and the LED with resistor with wires to the Pi.

I used high quality double sided tape to mount the Raspberry Pi and the audio amplifier. The LED needed some hot glue to stay stuck. Wire everything according to the schematic. If you do not understand anything, just ask me.

Step 3: Software Installation

Picture of Software Installation

The software consists of a Python script that is run automatically upon boot. You may want to change the Pyhton program before you upload it to your Raspberry Pi. You'll need to put in the radio channels that you want your radio to be tuned to.

When you look at the Python script you see that the array Channels holds all streams. Every stream has a name and a URL (2 consecutive entries in the array). The name will be pronounced by the system as you tune in to that station.

If you want the names to be pronounced in your own language instead of English you need to change the names into some sort of phonetic English. For instance I use the phrase "Bay N Err" to make the system say "BNR" in Dutch (instead of "Bee N Arr" as it would do if I just had put "BNR").

Upload the file Radio1.py to /home/pi

Config changes

  • Add the line enable_uart=1 in /boot/config.txt
  • Add the line python Radio2.py to the end of the file .bashrc

Also make sure that your Pi boots in command line.

Step 4: Listen to the Music

Listen to your favorite radio channels (or your own hosted streams) by tuning the tuning knob.

Increase or decrease the volume by pressing the volume switches.

If you want to switch off the radio press the power off button once and wait for the LED to be off. As soon as it is off then the Pi has halted and it is safe to remove the power cord.

Comments

8-Bits made it! (author)2017-11-15

I finally got around to adding the power-on LED and found I had to connect the anode (+) to pin 8 (UART TX) and not pin 10 as shown in the wiring diagram to get it to work.

The minor wiring changes I used are shown in the attached modified wiring diagram.

Thank you again for a fun project - John

pknutselpunk made it! (author)2017-10-07

Great instructable, couple of hours building fun.

The fact that you have to connect a mini-jack to the amplifier is something that i missed in the schematic. I figured it out, eventually. Also note that you have to rename the Radio1.py to Radio2.py, otherwise the following instruction will not work at all:


  • Add the line python Radio2.py to the end of the file .bashr

I still have some noise, unless i use a headphone, then sound is crispy clear. Maybe i blew the transistor while soldering? The next thing i would like to do is to add a little 12c lcd-screen to it and build a proper case around it.

8-Bits (author)2017-09-02

It should be noted that the original instructions and Wiring Diagram omit that an audio output feed needs to be made from the RPi to the “In” and second “GND” pins of the Amplifier Module.

With an RPi 2 or 3 board this can be accomplished using the “Left” and “GND” connections of its 3.5mm “TRRS” audio output jack.

About This Instructable

4,564views

76favorites

License:

More by _Marcel_:Raspberry Pi RadioRetro Game Console for Arcade Games
Add instructable to: