The Radio Play List

The radio play list / channel line-up is loaded dynamically from a file called radio_playlist.sh. This file is processed twice by the radio.py program: the first time it is executed as a shell script; and the second time it is read as a text file to load the channel display names.

12 thoughts on “Raspberry Pi Internet Radio”

That’s a hack I did on top of the Adafruit LCD class, which lets me use only 3 GPIO pins to drive the LCD (not counting power & ground). I’m thinking I might try building an internet radio like this, but add a few more buttons and possibly some more blinking lights & maybe change colors on the RGB backlight

I am new to the raspberry pi and python programming. lcd and buttons all setup and working. installed mpc mpd tested and working with playlist. try the radio player code above keep getting errors.
File “radio.py”, line 292, in
main()
File “radio.py”, line 92, in main
LCD.message(PLAYLIST_MSG[STATION – 1] )
IndexError: list index out of range

can you help thanks.
any help greatly appreciated as I would like to learn

The radio_playlist.sh file is executed as a Linux command script. Please make sure:
(a) you have execute permissions on your playlist file (a “chmod 775 radio_playlist.sh” should do it);
(b) that it is a properly formatted command script; and
(c) that it has UNIX line terminators and not Windows/DOS line terminators (LF and not CRLF).

Try running radio_playlist.sh from a terminal command line to see if you have it right. You can end up with the wrong line terminators if you SFTP the file from Windows to Linux as a “text” file and not as a “binary” file.

These are 10K ohm pull-down resisters used for the Previous and Next switches. Each resister is connected between ground and one end of a SPST switch. The other side of each switch is tied to 3.3V and also to one of the Raspberry Pi’s GPIO input connections; pin 18 for the previous switch; and pin 4 for next switch.

I tried this and having two distinct problems. The first us that no matter what I cannot get the playlist to load. And the second that even without being connected its acting as if the push buttons are being pressed in a random sequence. Any thoughts?

What permissions do you have on the file? Remember that it is run as a Linux shell command; so you’ll need execute permissions. What happens when you try to run it from a SSH session? A chmod 775 on the radio_playlist.sh file may help.

2. The switches.

How do you have the switches wired? I used 10Kohm pull-down resisters. Each resister is connected between ground and one end of a switch. The other side of each switch is tied to 3.3V and also to one of the Raspberry Pi’s GPIO input connections; pin 18 for the previous switch; and pin 4 for next switch.

In regards to the switches – I had them wired this exact same way when I got this result. Curiously, I get the same result even when I physically disconnect from 4 and 18. Could it be something in RPi.GPIO that’s sending a false positive to the Pins?

Hello!
I have got everything to work with some modifications.
But I get no sound out of the speakers!
I have tried but I can not think of anything that can help me.
The components I have are:
Raspberry Pi mod: B, 512 Kb
Adafruit Blue & White 16×2 LCD + Keypad.
Computer speakers.

It sounds like the file protection might be wrong on the playlist file. Remember the radio_playlist.sh file is run as a Linux shell command so you’ll need execute permissions. What happens if you run your radio_playlist.sh script from SSH?