Pandora's Box - An Internet Radio player made with a Raspberry Pi!

 by Ayy
FeaturedContest Winner
Overall.jpg
Front1.jpg
Plug in this internet radio player and listen to your favorite stations on Pandora Radio. Six pushbuttons control the music, while an LCD gives feedback on the song, artist, and other useful information. All of this is housed in a custom acrylic case with access to the Raspberry Pi's ports.

Special thanks to LVL1 Hackerspace (www.lvl1.org) for use of their laser cutter!

Raspberry Pi is a trademark of the Raspberry Pi Foundation.
 
Remove these adsRemove these ads by Signing Up

Step 1: Parts List

In order to build the system, you will need several things. The main piece is a Raspberry Pi Model B with a 5V, 1A power supply. This Instructable is based on a Revision 2 board, but will work on earlier boards with minimal changes. 

Next, you will need an SD card with a Raspbian Wheezy image. Instructions for this process found at: http://elinux.org/RPi_Easy_SD_Card_Setup

Electrical hardware needed:
1) Solderless breadboard (and wire)
2) Serial LCD module (3.3V module from Sparkfun was used: www.sparkfun.com/products/9067)
3) Ethernet Cable
4) USB Keyboard and mouse (necessary for setup, not the final product)
5) Pushbuttons (6) -  "Normally Open" type with threaded mounts
6) 3.3V Regulator (LM1117T-3.3 from Texas Instruments in the TO-220 package type used here)
7) Resistors: (7) ~10kOhm, (6) 1 kOhm
8) Capacitors: (2) 10 uF tantalum (as recommended by TI for 3.3V regulator
9) Pi T-Cobbler from Adafruit (not necessary, but makes GPIO access much easier)
10) Auxiliary audio cable

Other equipment needed:
1) Soldering Iron and solder (for the T-Cobbler breakout board)
2) 1-Minute Epoxy (for the acrylic case)
3) Acrylic (and a means of cutting it)
4) Nylon Standoffs and Screws
5) Velcro strips (with sticky sides)

The acrylic used in this project was 0.08" thick and can be found at Lowe's in 8"x10" sheets. This was great for cutting with a laser-cutter. Other thicknesses can probably be used - this will be left up to your discretion (and experience).

The standoffs used were a combination of (3/8"  - hex -  1.25" -  4-40 thread) and (3/8" - hex - 0.375" - 4-40 thread) nylon male/female standoffs. 4-40 fillister flat head nylon screws were used with these standoffs.

Although this Instructable includes directions for the custom case, this is probably the trickiest part of the design. Familiarity with a laser-cutter is necessary, since every laser cutter and design software package is different.
1-40 of 98Next »
Ayy (author) says: Dec 13, 2012. 5:07 PM
Note: On the box plans, the center piece has an issue with the spacing of the raspberry pi's holes. If you are making the same box, double check the holes (I don't have the original files to correct the images...)
gl0rious says: Dec 13, 2012. 6:40 PM
Could i get an estimate of the cost? i really would like to do this project, and i am a beginner..
Ayy (author) in reply to gl0riousDec 13, 2012. 7:24 PM
This depends on what equipment you already have. For example, I already had soldering equipment, drill and tap set, standoffs, SD card, and resistors. I'll give some prices for the bigger items:

Raspberry Pi: $35 + shipping
Power Supply: $8 + shipping
T-Cobbler: $8 + shipping
Serial LCD Monitor: $25 + shipping
Buttons: $7
Acrylic Sheets: $8
Epoxy: $5
Capacitors: $2
Velcro: $5

The small things tended to add up quickly - like the bits I had to get from Radioshack and Lowes (buttons, capacitors, velcro, etc). I probably could have gotten some things much cheaper online, but I didn't have the patience to wait for the velcro to ship. All the parts were around $110 with shipping - but since I plan on reusing most of the stuff for future projects, the cost felt reasonable.

Hope that helps.
gl0rious in reply to AyyDec 13, 2012. 7:26 PM
thats very helpful thanks
akcook in reply to AyyDec 13, 2012. 10:41 PM
Thanks!
gbovee says: Mar 8, 2013. 11:56 AM
Can someone explain to me the point of using 5v and a regulator to get to 3.3v when there is a 3.3v supply from the pi. I am fairly new to this stuff and am just trying to learn. Thanks.
Ayy (author) in reply to gboveeMar 9, 2013. 1:49 PM
That's a really good question. The answer has to do with the current limit on the Raspberry Pi's 3.3V line. According to the link below, the 3.3V line can output up to 50 milliamps current. Meanwhile, the 3.3V LCD module I used can draw up to 60 mA.

While LCD may never draw that full 60 mA, it has the potential to cause issues. Since the 5V supply can supply over 300 mA (when using a 1A power supply), I chose to add the 3.3V regulator.  

RPi electrical specs: http://elinux.org/RPi_Low-level_peripherals
emcek says: Jun 17, 2013. 8:43 AM
Will this LCD working with or I need change anything
http://www.adafruit.com/products/1109
Ayy (author) in reply to emcekJun 17, 2013. 9:15 AM
That looks like it is fine hardware-wise, but it would take some software changes (the commands it recognizes are likely different than the one used). Since they provide example python code (and I used python to control my LCD) the changes would probably be pretty straightforward.
emcek says: Jun 17, 2013. 8:47 AM
will this lcd working http://www.adafruit.com/products/1109
wyso0017 says: Jun 11, 2013. 12:30 PM
Cool project. Would it be possible to add an FM receiver to the box as well? I'm thinking I'd like to create the ultimate radio box, fm and internet radio, maybe xm someday in the future.
Ayy (author) in reply to wyso0017Jun 12, 2013. 4:14 PM
FM would be a simple addition, I think. You could combine these two links (http://emmanuelgranatello.blogspot.com/2013/02/fm-radio-receiver-on-raspberry-pi.html) and (http://www.electronicsblog.net/arduino-fm-receiver-with-tea5767/). It's a great idea, but I don't have the time to try it out right now. Let me know if you do!
obxchris says: May 23, 2013. 11:24 AM
Hello all, this is my first project with a RPi so I ran into some problems right away and I wanted to share the solutions I found. I hope this helps anyone who needs it.

Wrt the first step, I initially had some problems freeing up my RPi's UART. This website helped explain the editing of the cmdline.txt file for me.

http://www.hobbytronics.co.uk/raspberry-pi-serial-port

Also, if you are having the "TLS handshake error", you can verify that you have the proper fingerprint by running the following in your cmd prompt. (from Jacob Roeland's "pidora" tutorial, https://github.com/jacroe/pidora)

fingerprint=`openssl s_client -connect tuner.pandora.com:443 < /dev/null 2> /dev/null | openssl x509 -noout -fingerprint | tr -d ':' | cut -d'=' -f2` && echo tls_fingerprint = $fingerprint >> ~/.config/pianobar/config
tenokage says: May 20, 2013. 4:53 PM
in the first paragraph, chmod 777 x.xx where x.xx is the filename, for which files? I also got an error when I tried to enter the last instruction given above (cp -r /home/pi/.config/pianobar/Pandoras-Box/scripts/.) where it said " cp: missing destination file operand after 'cp -r /home/pi/.config/pianoar/Pandoras-Box/scripts/." Any help would be greatly appreciated thanks
tenokage says: May 20, 2013. 4:45 PM
I was able to successfully get the "Hello" on the first line by writing this code in IDLE and running, but did not get the second line to output anything, is '\xFE\xC0' the correct syntax?
malleyne says: Apr 2, 2013. 6:02 PM
This looks great!

I'm a little new to this, but why do you need a raspberry pi for this to work? If your gadget is connected to the computer which is running pianobar couldn't each button correspond to a command like button one corresponds to 'n' and then send that through serial to the computer and use fifo to then send that information to pianobar to be executed? Better stated, can you briefly explain how the internet connection is working with pianobar?

SpeakNoEvil in reply to malleyneMay 13, 2013. 2:27 PM
The idea is that your gadget *isn't* connected to a desktop computer or laptop at all; it's a standalone device that just uses an internet connection. The RPi is the computer.
SpeakNoEvil says: May 4, 2013. 10:47 AM
Awesome project Ayy! Very well-done. I'm having two issues that I'd love some insight into:
First, the autostart script isn't working for me. Seems pretty straightforward, not sure what the issue is. Any ideas?
Second, my GPIO pins aren't responding. Have others had trouble here? Any updates to the design? Please let me know, and thanks again!
Ayy (author) in reply to SpeakNoEvilMay 5, 2013. 10:10 AM
These issues could be a number of things, but I suspect they are related. Since the autostart relies on one of the GPIO pins being pulled high, an issue with the GPIO pins would stop the rest of the program from working. I would suggest checking your circuitry on the pins for issues.
SpeakNoEvil in reply to AyyMay 11, 2013. 3:34 PM
Ayy,

Thanks for the response! I got them both figured out, thought I'd pass along the knowledge in case newbies like me can't figure it out:

GPIO pins not working: You're right, the RPi has pullup resistors, but you have to turn them on! Add this code to the ButtonPiper.h file:

gpio -g mode 2 up
gpio -g mode 3 up
gpio -g mode 4 up
gpio -g mode 17 up
gpio -g mode 27 up
gpio -g mode 22 up

Add them right after the code that says

gpio -g mode 2 in
gpio -g mode 3 in
gpio -g mode 4 in
gpio -g mode 17 in
gpio -g mode 27 in
gpio -g mode 22 in

That should fix it - or just add the pullup resistors you originally showed.

Second problem, autostart not working:

at least for me, you have to add @ to the front of the text in the tutorial!
@pianobar
@bash /home/pi/.config/pianobar/scripts/PandorasBox.sh

Also, for me I actually need to use ButtonPiper.sh, not PandorasBox.sh. Not sure why?

I'm now having trouble where it turns Pianobar on either twice or not at all... but I'm working on it!
dmlblank says: May 7, 2013. 7:21 PM
Hopefully someone can help me out.

Pianobar runs fine when I SSH into the RPi but asks for login information when I try to run it automatically at startup. Which would be fine if i weren't running it headless.

Also, I can not get Pianobar to output to the LCD screen, or the buttons to work. The test script outputs correctly, so I have *some* connectivity.

Help?
rezendes says: May 1, 2013. 5:16 PM
I noticed that the non-serial enabled LCDs are much cheaper, is this project possible using one of the cheaper non-serial enabled LCDs?
ianrab says: Apr 23, 2013. 6:03 AM
I had many issues getting even this far, but after much searching, I found this:

http://www.raspberrypi.org/phpBB3/viewtopic.php?f=63&t=33508&hilit=pianobar

It helped a whole bunch. I followed the directions precisely, and when I had an error, I tried running as the other user (between root and pi). Also, I set the permissions on the folders for read and write for all users. Not sure if that alone helped, but it made me feel better.
prairietech says: Apr 18, 2013. 8:10 AM
My RPi won't boot after making the change below:

http://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi/freeing-uart-on-the-pi

And change:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 $

to:

dwc_otg.lpm_enable=0 console=tty1 $

Doing this causes my RPi not to boot. I can't ssh with a console cable, it's just dead. Get all kinds of error msgs from the monitor on the composite video output but I don't know how to let you see those. Running the latest whezzy.

This is the second time I hosed this up. The first time I thought I fat-fingered something. This time I triple checked the change and it still caused the RPi not to boot. Guess I'll flash another SD and leave the LCD off this project for now.
prairietech says: Apr 14, 2013. 7:30 AM
Problem: Popping and clicking between songs when using the 3.5mm audio output jack.

Solved: (kind of)

Used a HDMI to VGA adapter I bought from Adafruit that also has stereo output. As a newbie to RPI I thought I needed a VGA monitor. After getting VNC figured out via the Chrome add-on, running the RPI headless is much better.

But I couldn't get the adapter to work with my VGA monitor and wanted to return it (glad Adafruit RMA dept must be overworked) and glad I still had it. Yes it did add $21 but well worth getting rid of the click, pop, click!
brthofman says: Mar 31, 2013. 7:51 AM
to the best of my knowledge i have entered all of the code properly, however my LCD screen wont work. when my pi starts up, the LCD screen shows some random characters, this time it was "1p) m" i tried to run the hello world script but on the line import sys, serial, time i get an error that says "importerror: no module named serial". and the buttons wont interact with pianobar. i have checked and when i press the button the pins are reading the change from high to low, so i dont know why the code isnt telling pianobar anything. also, the echo 'n' >> /home/pi/.config/pianobar/ctl command works. im pretty new to programming so i really dont know how to find out whats wrong... can anybody help?
aasselhoff says: Mar 26, 2013. 1:19 AM
For those who get TLS Handshake Error, this works for me:

Changing TLS_Fingerprint to: "tls_fingerprint = 2D0AFDAFA16F4B5C0A43F3CB1D4752F9535507C0"

but i'm getting an eventcmd error that (No such file or directory)
but what i have to do to fix it? haven't got any clue.
vishwakperera says: Mar 25, 2013. 10:34 PM
1.Can't we purchase the outer casing through internet ??
2.Don't we have to use a cooling fan and heat sinks to reduce heat?
3.Does heat reduce the functioning of this "Pandora's Box"?

I'm a begging to this subject!! please help!!
jkulow says: Mar 21, 2013. 7:25 PM
So, can't lie. I'm new to all this component level stuff so I'm finding it harder to follow how I should be putting this stuff together. Right now I'm looking at the circuit design for the LCD and I'm using an Adafruit half size perma-proto pcb and I'm trying to figure out how to wire this thing up properly. I was curious if you had some more detailed pictures of the breadboard that aren't obstructed by the ribbon cable?
gbovee says: Mar 11, 2013. 2:37 PM
Not sure why but no matter what I do I cannot get anything to display on the LCD. I bought the exact same one used in this instructable. I have followed the instructions to disable the use of the UART and restarted. I have installed the python-serial and wiringpi packages. I have it hooked to the 5v with an adjustable voltage regulator configured to 3.3v (verified with multimeter) but when I execute the test script nothing displays. I have adjusted the potientiometer to verify it was not a brightness issue. I also tried hooking the TX to the RX and used minicom to verify that it is transmitting. Any suggestions of things to try would be appreciated. I have everything else configured and working so this is my last hurdle :-)
Ayy (author) in reply to gboveeMar 17, 2013. 10:04 AM
When you first power on the LCD, does it show the "splash screen" message from sparkfun?
bdeschamps says: Mar 5, 2013. 4:20 PM
should be vdd, or the 5v, RX is data is data to the LCD and GND is ground. It will conect to the txd pin witch is pin 8 i belive on the rasberry pie. hear is a link to a pic of the pin out.http://www.hobbytronics.co.uk/image/data/tutorial/raspberry-pi/gpio-pinout.jpg
azeam1 says: Mar 5, 2013. 5:53 AM
If you want an Android remote control for your Pandora's Box you can check out http://raspberrypiserver.no-ip.org/pianobar_pandora_remote_control.html
jkulow says: Feb 23, 2013. 6:40 PM
What is the black surrounding the LCD? I need to figure out how to shield the pins sticking out from the backpack soldered on to it. I am guessing, from the pictures, that the black piece of whatever is doing that for you on this project.
Ayy (author) in reply to jkulowFeb 24, 2013. 5:26 AM
I forgot to mention that bit in the writeup. I used an old rubber mousepad, and cut the shape from it. Nothing too fancy.
josure says: Feb 8, 2013. 4:41 AM
hi i need a little help.im pretty beginner and i dont understand how to connect the lcd to what pin in lcd.i need some details.:) thnks to everyone
zombiemom42 says: Feb 5, 2013. 5:19 PM
how do i fix the TLS handshake problem?
Ayy (author) in reply to zombiemom42Feb 6, 2013. 9:43 AM
See my previous reply to "Sgehring" below
gregp203 says: Jan 15, 2013. 12:10 PM
nice project. I had a similar idea for a project , but instead of controlling/status of pianobar with hardware, I did it with a web interface. I access the web interface on my smartphone/tablet as if it was remote control for pianobar. this is the project https://github.com/gregp203/ajax-pianobar It just needs apache2, php5 and php5 apache module installed, and some changes to the eventcmd.sh and pianobar config file.
ElectronicsNoeb says: Jan 12, 2013. 8:22 AM
Hi,

Nice project. I have a few questions however.
I am new to electronics but play a lot with my Pi therefore I thought I'd expand and give this a try. My question is regarding the voltage of the resistors and capacitors. I have 10k 1/4w resistors and 10uF 6.3V capacitors. Are these OK or do I require something else? Thanks in advance.
1-40 of 98Next »
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!