loading



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.

Objectives:
* 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:

==========

Step 1: You Will Need

You will need:
* Arduino UNO
* LCD / Keyboard Shield e.g. (http://goo.gl/XAhvx)
* Raspberry Pi
* USB and Ethernet cables

Step 2: Install the Required Packages for mpd/mpc

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.




Step 3: Install the Required Packages for Python-nanpy

We want to be able to talk to Arduino from Python running on the Pi.
To do that, we need to install the nanpy library for Python and the nanpy firmware for Arduino.

1. Install Arduino packages to build the nanpy firmware for Arduino
$ apt-get install arduino

2. Get the nanpy library for Python and extract
from /home/pi
$ wget http://pypi.python.org/packages/source/n/nanpy/nanpy-v0.7.tar.gz
$ tar xvf nanpy-v0.7.tar.gz

3. Get setuptools for Python (a dependancy for nanpy) and extract
$ wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e
$ tar xvf setuptools-0.6c11.tar.gz

4. Get pyserial for Python (a dependancy for nanpy) and extract
$ wget http://pypi.python.org/packages/source/p/pyserial/pyserial-2.6.tar.gz
$ tar xvf pyserial-2.6.tar.gz

5. Go to the setuptools directory and install Python setuptools
$ cd setuptools-0.6c11
$ sudo python setup.py install

6. Go to the nanpy directory and install the Python nanpy library
$ cd ../nanpy
$ sudo python setup.py install

7. Go to the serial directory and install the Python serial library
$ cd ../pyserial-2.6
$ sudo python setup.py install


Now we've got the files we need let's put the nanpy firmware on the Arduino.

Step 4: Put the nanpy Firmware on the Arduino

nanpy allows a Python program runing on the raspberry Pi to operate the Arduino using conventional Arduino-Sketch syntax e.g. the Python program to read an analogue input from Arduino might read:
int val = Arduino.analogRead(14)

nanpy has two components:
i) a library for Python that allows Arduino commands to be written in a familiar syntax and communicate with Arduino;
ii) firmware that runs on Arduino, communicating with Python on the Pi

We installed the Python part of nanpy, and downloaded the Arduino part of nanpy on the Pi in the last step.

Now we need to upload the nanpy firmware to Arduino.

Plug Arduino into the USB of the Raspberry Pi.

1. Go to the nanpy firmware directory and upload to Arduino
$ cd ../nanpy/firmware
$ export BOARD=uno
$ make
$ make upload

If you get a report that the device is not found on /dev/ttyACM0 , plug the Arduino into the other USB port.

Step 5: Add Radio Streams to mpd

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:
$ cd
$ 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.

Congratulations!!

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://76.73.3.245: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://86.57.151.4:8009/listen.pls" , so the URL would be: "http://86.57.151.4:8009"

Step 6: Python Program

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 pastebin. (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.

Enjoy!!

UPDATE: jazzi_p merged this radio project with usualpanic.com web radio. You can get the code from pastebin. 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.


Here's Updated Indented code, Enjoy:<br> <br> from datetime&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import datetime&nbsp;<br> from subprocess&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import *&nbsp;<br> from time&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import sleep, strftime&nbsp;<br> from Queue&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import Queue&nbsp;<br> from threading&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; import Thread<br> import os<br> from nanpy import Arduino, Lcd<br> <br> Arduino.pinMode(14, input)<br> <br> lcd = Lcd([8,9,4,5,6,7],[16,2])&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Setup the LCD pins for the Sainsmart Shield<br> lcd.printString(&quot;Jess's Web Radio&quot;,0,0)<br> lcd.printString(&quot;Loading&quot; + &quot;.&quot;*3,0,1)<br> sleep(5)<br> max_trax = 74<br> x = 1<br> loop_menu = 1<br> loop_radio = 1<br> <br> def display_ipaddr():&nbsp;<br> &nbsp;&nbsp; show_wlan0 = &quot;ip addr show wlan0 | cut -d/ -f1 | awk '/inet/ {printf \&quot;w%15.15s\&quot;, $2}'&quot;&nbsp;<br> &nbsp;&nbsp; show_eth0&nbsp; = &quot;ip addr show eth0&nbsp; | cut -d/ -f1 | awk '/inet/ {printf \&quot;e%15.15s\&quot;, $2}'&quot;&nbsp;<br> &nbsp;&nbsp; ipaddr = run_cmd(show_eth0)&nbsp;<br> &nbsp;&nbsp; if ipaddr == &quot;&quot;:&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ipaddr = run_cmd(show_wlan0)&nbsp;<br> &nbsp;&nbsp; lcd.printString('IP Address:',0,0)<br> &nbsp;&nbsp; lcd.printString(ipaddr,0,1)<br> &nbsp;&nbsp; sleep(2)<br> <br> def displaymenu():&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp; if x==1:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;1. Display&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp;&nbsp; IP Address&nbsp;&nbsp; &quot;,0,1)<br> &nbsp;&nbsp;&nbsp; elif x==2:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;2. Audio Output &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp;&nbsp; to hdmi Port &quot;,0,1)<br> &nbsp;&nbsp;&nbsp; elif x==3:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;3. Audio Output &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp; to Analog port&quot;,0,1)<br> &nbsp;&nbsp;&nbsp; elif x==4:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;4. Audio Output &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp; Auto Sel. Port&quot;,0,1)<br> &nbsp;&nbsp;&nbsp; elif x==5:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;5. Reload the&nbsp;&nbsp; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp;&nbsp; Playlist&nbsp;&nbsp;&nbsp;&nbsp; &quot;,0,1)<br> &nbsp;&nbsp;&nbsp; elif x==6:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;6. ShutDown&nbsp;&nbsp;&nbsp;&nbsp; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp;&nbsp; the System&nbsp;&nbsp; &quot;,0,1)<br> &nbsp;&nbsp;&nbsp; else:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;7. Exit to&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;&nbsp;&nbsp; Main Menu&nbsp;&nbsp;&nbsp; &quot;,0,1)<br> <br> def load_playlist():&nbsp;<br> &nbsp;&nbsp; output = run_cmd(&quot;mpc clear&quot;)&nbsp;<br> &nbsp;&nbsp; output = run_cmd(&quot;/home/pi/radio_playlist.sh&quot;)&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> def run_cmd(cmd):&nbsp;<br> &nbsp;&nbsp; p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)&nbsp;<br> &nbsp;&nbsp; output = p.communicate()[0]&nbsp;<br> &nbsp;&nbsp; return output<br> <br> def getKey():&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp; val = Arduino.analogRead(14)<br> &nbsp;&nbsp; if val == 1023:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;NONE&quot;<br> &nbsp;&nbsp; elif val &lt; 100:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;RIGHT&quot;<br> &nbsp;&nbsp; elif val &lt; 150:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;UP&quot;<br> &nbsp;&nbsp; elif val &lt; 330:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;DOWN&quot;<br> &nbsp;&nbsp; elif val &lt; 510:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;LEFT&quot;<br> &nbsp;&nbsp; elif val &lt; 750:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;SEL&quot;<br> &nbsp;&nbsp; else:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return &quot;KBD_FAULT&quot;<br> <br> load_playlist()<br> def getTrack():<br> &nbsp;&nbsp; #L= [S.strip('\n') for S in os.popen('mpc').readlines()]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Get the Track info from the stdout of the mpc command<br> &nbsp;&nbsp; output = run_cmd(&quot;mpc current&quot;)<br> &nbsp;&nbsp; station = output [0:16]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Pick out the Station and Track info<br> &nbsp;&nbsp; track =&nbsp; output [-17:-1]<br> &nbsp;&nbsp; lcd.printString(station + &quot; &quot;*(16 - len(station)), 0, 0)<br> &nbsp;&nbsp; lcd.printString(track + &quot; &quot;*(16 - len(track)), 0, 1)<br> <br> track_num = 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Start off on Track number 1<br> os.system(&quot;mpc play &quot;+str(track_num))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Tell the OS to Play it<br> <br> while loop_radio == 1:<br> &nbsp;&nbsp; getTrack()<br> &nbsp;&nbsp; loop_menu = 1<br> &nbsp;&nbsp; x = 1<br> &nbsp;&nbsp; key = getKey()<br> &nbsp;&nbsp; if key == &quot;UP&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; track_num += 1<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if track_num &gt; max_trax:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; track_num = max_trax<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.system(&quot;mpc play &quot; + str(track_num))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getTrack()<br> &nbsp;&nbsp; elif key == &quot;DOWN&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; track_num -= 1<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if track_num &lt; 1:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; track_num = 1<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.system(&quot;mpc play &quot; + str(track_num))<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getTrack()<br> &nbsp;&nbsp; elif key == &quot;SEL&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while loop_menu == 1:<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; displaymenu()<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; key = getKey()<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if key == &quot;RIGHT&quot;:<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; os.system(&quot;mpc volume +2&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;, 0, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;mpc volume&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;VOLUME UP:&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(output, 5, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.25)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,1)<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif key == &quot;LEFT&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; os.system(&quot;mpc volume -2&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;, 0,1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;mpc volume&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;VOLUME DOWN:&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(output, 5, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.25)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,1)<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif key == &quot;UP&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if x &lt;= 1:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x = 7<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x = x - 1<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif key == &quot;DOWN&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if x &gt;= 7:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; x = 1<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; else:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; x = x + 1&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif key == &quot;SEL&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if x == 1:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; display_ipaddr()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; sleep(1)<br> &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x == 2:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;amixer -q cset numid=3 2&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;Audio OUT--&gt;HDMI&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;output &quot;, 0, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.5)<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x == 3:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;amixer -q cset numid=3 1&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;Audio OUT-&gt;Analog&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;output &quot;, 0, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.5)<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x == 4:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;amixer -q cset numid=3 0&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;Audio OUT-&gt;&nbsp; Auto&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;output &quot;, 0, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.5)<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x == 5:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; load_playlist()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; os.system('mpc play 1')<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x == 6:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;Good Bye&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;Have a Nice Day&nbsp; &quot;, 0, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output = run_cmd(&quot;mpc clear&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output = run_cmd(&quot;sudo shutdown now&quot;)<br> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; elif x == 7:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; loop_menu = 0<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getTrack()<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break<br> &nbsp;&nbsp; elif key == &quot;RIGHT&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; os.system(&quot;mpc volume +2&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;, 0,1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;mpc volume&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;VOLUME UP:&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(output, 5, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.25)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,1)<br> &nbsp;&nbsp; elif key == &quot;LEFT&quot;:<br> &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; os.system(&quot;mpc volume -2&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;, 0, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; output = run_cmd(&quot;mpc volume&quot;)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(&quot;VOLUME DOWN:&quot;, 0, 0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; lcd.printString(output, 5, 1)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sleep(.25)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,0)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lcd.printString(16*&quot; &quot;,0,1)<br> <br>
Nice projekt have you the code in a file that i can use <br>with copy &amp; past it brings some errors in a am not a programmer <br> <br>i also use a Arduino Mega 2560 and the key's dont work :-(
Problems are solved <br>on the Mega Board the analog 14 Pin is Pin 54 <br> <br>the Python programm is now workung but after starting the program <br>the Display shows the ip an the loads the first Sender then the Raspberry <br>crashes :-( an i can only reset it
I have merged this radio project with usualpanic.com web radio. 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. I will upload the modified python program soon. <br>Another option added is to Reload of playlist. Please check the tutorial on usualpanic.com for creating radio_playlist.sh file.
<p>Thanks a lot!,</p><p>needed a lot of googling and tweeking but got its working!</p>
<p>hey there! is there anyone who has a good working radio.py?</p><p>the code from Jazzi_p gave me an error:</p><p>pi@raspi:~/nanpy/firmware $ File &quot;radio.py&quot;, line 119</p><p> sleep(.25)</p><p> ^</p><p>IndentationError: unexpected indent</p><p>it would be nice if there is anyone who help me out with it (after years)</p><p>i run this on an Raspberry Pi 2</p>
<p>I fixed the indents on the Pastebin site. The Jazzi_p code should work OK now.</p>
<p>Hey, I get it to work, but not properly.. The ip shown is a Mac and it hangs and always simulate volume+. Everytime i start up the Pi, I have to add the stream to mpd, if i store them in the playlist file who is wrote in the radio.py mpd can't open even if i add one manually. I edited the py script buttons-value to fit my LCD Keypad Shield but the script goes crazy.. </p>
<p>I got the same error, but if you compile until 118 it play music and change station.</p>
<p>I fixed the indents on the Pastebin site. The Jazzi_p code should work OK now.</p>
<p>Since I'm using a different brand of the LCD shield (<strong>ROBOT LCD SHIELD</strong>) I had to change the voltage levels a bit so that the buttons responded with correct commands, </p><p>Now I have a problem when pushing the <strong>SELECT</strong> button, When pushed it displays the first entry in the menu (<strong>1. DISPLAY</strong> <strong>IP address</strong>) for a less then a second and switches back to currently playing info so I can access the menu options.</p><p>Can someone give me some info on how to resolve this. My programming knowledge is <strong>very</strong> limited so keep that in mind :)</p><p>Thx </p>
<p>It could be that the ROBOT LCD shield <br>outputs different levels for the button presses. You can see the values <br>being output by your shield by loading a program onto your Arduino to <br>monitor the Analog Input Pin the buttons are connected to. See File: <br>Examples : Basics : AnalogReadSerial.</p><p>Also if you're changing the <br>compare values in def getKey() to suit your shield it's important that <br>they are in ascending order e.g. &lt;100, &lt;150, &lt;330 etc.. <br>NOT &lt; 100, &lt;330, &lt;150 etc..</p>
<p>I see the breadboard, but didn't notice it listed in the parts list or instructions. </p>
Ok so i got the radio playing through my tv via hdmi. But i have no read out on my lcd. I am using the same one that you are.<br><br>Can you please help!
<p>ok i have done everything up until step 6 ! i can hear the stations playing through my t.v. via hdmi. I am going to have to get a different lcd because it did not come with the control buttons.</p><p>Now the kit I have has a ir remote control could i a use that to control the stations or will it be easier with the button controls.</p><p>thanks in advance!</p>
<p>You could, but if you're a beginner I think that would be pretty difficult.</p>
<p>i have a question, after doing the build can you still use the pi as a computer or do you have to keep it connected as a radio? Sorry I am very new to arduino but I have experience with raspberry pi.</p>
<p>You can still connect to the Pi and use it in the normal way if you run the Python program in the background (i.e. python radio.py<strong> </strong>&amp;).</p>
<p>Nice tutorial. Thanks a lot I made it now the question is how can i change the play list of the radio stations.</p>
<p>what are you using to hear the music? external speaker?</p>
<p>Yes.</p>
<p>vorrei un aiuto per favore, mi sono bloccato nelle installazioni del raspberry per la configurazione iniziale e mi da sempre fallito o errore</p><p><br></p>
<p>can someone please help me to setup a 24&times;3 lcd on my raspberry pi b+</p><p>it has 18 pins link to photo here <a href="http://www.etypetv.com/pi" rel="nofollow">http://www.etypetv.com/pi</a></p><p>i need pin outs for this display to raspberry pi b+</p>
Thank you so much because this is exactly what I wanted to do with the Pandoras Box project someone has online. Kudos and thank you. Moddie ModMan M3 &amp; Pharaoh
<p>Hi could I use this to stream this radio station ? </p><p><a href="http://pirateradio.rit.edu/listen-now" rel="nofollow">http://pirateradio.rit.edu/listen-now</a></p><p>Thank you</p>
<p>File &quot;test2.py&quot;, line 6</p><p>SyntaxError: Non-ASCII character '\xc2' in file test2.py on line 6, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details</p><div>WHY DO I GET THIS ERROR AND COULD SOMEONE PLEASE GIVE ME CODE TO FIX IT AS I HAVE NO KNOWLEDGE WITH PYTHON, THANK YOU </div>
Arduino / Raspberry Pi Internet Radio<p>Please help</p><p>I can not translate in English </p><p>who sent me an Arduino / Raspberry Pi Internet Radio on sd card </p><p> Raspberry Pi </p><p>Arduino UNO </p><p>16X2 LCD display </p><p>reply to navi2@seznam.cz </p><p>What would be the price through pay pal </p><p>thank you</p>
<p>Email <a href="mailto:arduinolink@gmail" rel="nofollow">arduinolink@gmail</a> for how to install the new version 0.9</p>
<p>Nanpy version 0.9 is out now but the old versions (0.7 &amp; 0.8) are no longer available on the net. Get instructions for installing the new version from me. Email <a href="mailto:arduinolink@gmail.com" rel="nofollow">arduinolink@gmail.com</a></p><p>Tony Goodhew</p>
<p>hi !!! can i make this radio work only whit raspberry pi and an lcd attached to it ? </p>
<p>Yes. I think that should be possible. A simple search revealed this <a rel="nofollow">article</a>.</p>
<p>This instructable is no longer good. The firmware does not exist on the nanpy folder any more. I guess its a whole separate folder. Correct me if im wrong. </p>
<p>I've checked the nanpy install, and it is still there!</p><p>Try the specified location:</p><p><em><a href="http://pypi.python.org/packages/source/n/nanpy/nanpy-v0.7.tar.gz" rel="nofollow">http://pypi.python.org/packages/source/n/nanpy/nanpy-v0.7.tar.gz</a></em></p>
<p>hello, <br>I need your help once, I get no display on my display when I run the command make upload I get either an error message or it takes too long and the ssh connection breaks down so I have to start the raspberry pi new. the radio the other hand, works without problems. <br><br>I thank you for your great project</p>
<p>Sorted all the indents out seems to run but Im getting </p><p>song number greater than playlist length.</p><p>Any ideas ?</p><p>Im using these mms links</p><p>BBC Radio 1 - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio1/radio1_bb_live_eq1_sl0<br>BBC Radio 2 - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio2/radio2_bb_live_eq1_sl0<br>BBC Radio 3 - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio3/radio3_bb_live_eq1_sl0<br>BBC Radio 4 - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio4/radio4_bb_live_eq1_sl0<br>BBC Radio 5 Live - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio5/radio5_bb_live_eq1_sl0<br>BBC Radio 5 Live Extra - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio5/5spxtra_bb_live_eq1_sl0<br>BBC 6 Music - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_eq1_sl0<br>BBC Radio 7 - <br>mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/bbc7/bbc7_bb_live_eq1_sl0</p>
I get syntax errors at elif key == &quot;LEFT&quot;:
Indentation is important in Python. Make sure the elif statement has the same number of spaces at the start of the line at the if previously.
Hi, tried this tutorial, but after upload I got boxes in the upper line and the lower line stays empty. What went wrong? Can somebody help me?
<p>Hi is it possible if i do not include the arduino LCD/keypad shield? i am trying to find a guide where i can just used the raspberry pi + arduino + ethernet cable but i can't seem to find a proper guide out there. Something like this : <a href="http://www.youtube.com/watch?v=qBbhug3Jwq8" rel="nofollow">http://www.youtube.com/watch?v=qBbhug3Jwq8</a> but there isn't any guide on it.</p>
akellyirl, thanks for indenting the code. <br>I have uploaded the updated code below with indents... <br>Thanks for a great project...
Thanks a lot for the great tutorial and project I'm having an issue though when I attempt to change stations with the keypad. I get the following errors:<br> <br> <em><strong>i@raspberrypi ~ $ Radio Paradise - DJ-mixed modern &amp; classic rock, world, electronica, &amp; more: Regina Spektor - Better<br> [playing] #1/5&nbsp;&nbsp; 0:00/0:00 (0%)<br> volume: n/a&nbsp;&nbsp; repeat: off&nbsp;&nbsp; random: off&nbsp;&nbsp; single: off&nbsp;&nbsp; consume: off<br> ['Radio Paradise - DJ-mixed modern &amp; classic rock, world, electronica, &amp; more: Regina Spektor - Better', '[playing] #1/5&nbsp;&nbsp; 0:00/0:00 (0%)', 'volume: n/a&nbsp;&nbsp; repeat: off&nbsp;&nbsp; random: off&nbsp;&nbsp; single: off&nbsp;&nbsp; consume: off']<br> Radio Paradise<br> Spektor - Bette<br> Chilltrax - The World's Chillout Channel: Maya Jane Coles - Something In The Air [Don't Put Me In Your Box]<br> [playing] #2/5&nbsp;&nbsp; 0:00/0:00 (0%)<br> volume: n/a&nbsp;&nbsp; repeat: off&nbsp;&nbsp; random: off&nbsp;&nbsp; single: off&nbsp;&nbsp; consume: off<br> Traceback (most recent call last):<br> &nbsp; File &quot;radio.py&quot;, line 51, in &lt;module&gt;<br> &nbsp;&nbsp;&nbsp; getTrack()<br> &nbsp; File &quot;radio.py&quot;, line 33, in getTrack<br> &nbsp;&nbsp;&nbsp; lcd.printString(station, 0, 0)<br> &nbsp; File &quot;build/bdist.linux-armv6l/egg/nanpy/arduinoboard.py&quot;, line 56, in wrapper<br> &nbsp; File &quot;build/bdist.linux-armv6l/egg/nanpy/arduinoboard.py&quot;, line 37, in _call<br> &nbsp; File &quot;build/bdist.linux-armv6l/egg/nanpy/arduinoboard.py&quot;, line 10, in return_value<br> &nbsp; File &quot;build/bdist.linux-armv6l/egg/nanpy/serialmanager.py&quot;, line 53, in readline<br> UnicodeDecodeError: 'ascii' codec can't decode byte 0xf8 in position 0: ordinal not in range(128)</strong></em><br> <br> <br> Any suggestions?
Glad you liked it. <br> <br>It looks to me like the station value returned from mpc is causing the error. <br> <br>To debug, move the print statements before the lcd.printStrings() command. At least then you'll be able to see what's causing the problem. <br> <br>As a solution I suggest making use of Python's try except commands. <br> <br>See : http://wiki.python.org/moin/HandlingExceptions <br> <br>For example: <br>try: <br> lcd.printString(track, 0, 1) <br>except: <br> print &quot;track value error&quot; <br> <br>What this does is to 'try' to execute the lcd.printString command but if it throws an exception then print the message and continue with the program. That will prevent the program from reporting the error and stopping. <br> <br>For an example of how it can be used see: <br>http://www.instructables.com/id/Flight-Simulator-with-Arduino-and-Python/ <br> <br>Good Luck, <br> Anthony

About This Instructable

168,608views

172favorites

License:

More by akellyirl:Smart Home Thermostat Arduino Yun Messager Arduino Esplora Flight Simulator 
Add instructable to: