Built an awesome internet Radio with 2x16 RGB LCD Pi Plate :)

Talk about Adafruit Raspberry Pi® accessories!

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Built an awesome internet Radio with 2x16 RGB LCD Pi Plate :)

Postby waltermixxx » Mon Mar 04, 2013 8:25 pm

i bought three 256meg raspberry Pi's when they first came out... not sure why, but now I know.... ( i have since purchased 1 512 meg pi :)... in any case, with so many of them it would make it easy to dedicate one or two for some real live projects ( and not bread board projects... ) in any case, I digress....

I have a 256 meg raspberry pi in a laser cut case with an RGB Negative 2x16 LCD Pi Plate on it... with a wifi dongle, power, and connected to a Bose Soundock II :)
i use the buttons on the Pi to turn the radio on, off, and to check current station. I also use left and right to "tune in" one of the internet radio stations :)...
it was very easy, based on the LCDtest.py code, and code from Meistervision on youtube who has an awesome 1 hour tutorial on how to build a great internet radio... :)
i used chron to start up the code below when i turn this pi on :)

you will have to install the MPD MPC apps... check out Meistervision on youtube: http://www.youtube.com/watch?v=KM4n2OtwGl0


in any case here is my code based on both :) Thanks Adafruit for a store i would have loved to have as a child... (you kids are spoiled :) )

Code: Select all
#!/usr/bin/python

from time import sleep
from Adafruit_I2C import Adafruit_I2C
from Adafruit_MCP230xx import Adafruit_MCP230XX
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate

import smbus
import os

# initialize the LCD plate
# use busnum = 0 for raspi version 1 (256MB) and busnum = 1 for version 2
lcd = Adafruit_CharLCDPlate(busnum = 0)

# clear and initialize purple display
lcd.clear()
lcd.backlight(lcd.VIOLET)
lcd.message("Internet Radio\nStarting")
os.system("mpc stop")
sleep(1)

while 1:
    while 1:

        if (lcd.buttonPressed(lcd.DOWN)):
            lcd.clear()
            lcd.message("Radio Off")
            os.system("mpc stop")
            sleep(1)
            lcd.backlight(lcd.OFF)
            break
       
        if (lcd.buttonPressed(lcd.UP)):
            lcd.clear()
            lcd.backlight(lcd.VIOLET)
            lcd.message("Radio On")
            os.system("mpc play 1")
            sleep(1)
            lcd.backlight(lcd.OFF)
            break

        if (lcd.buttonPressed(lcd.LEFT)):
            lcd.clear()
            lcd.backlight(lcd.VIOLET)
            lcd.message("Previous Station")
            os.system("mpc prev")
            #sleep(1)
            lcd.backlight(lcd.OFF)
            break

        if (lcd.buttonPressed(lcd.RIGHT)):
            lcd.clear()
            lcd.backlight(lcd.VIOLET)
            lcd.message("Next Station")
            os.system("mpc next")
            #sleep(1)
            lcd.backlight(lcd.OFF)
            break
               
    f=os.popen("mpc current")
    station = ""
    for i in f.readlines():
            station += i
    # Send some text
    lcd.clear()
    lcd.backlight(lcd.VIOLET)
    lcd.message(station)
    sleep(5)
    lcd.backlight(lcd.OFF)
sleep(5)



{attachment=0]PIRadio.jpg[/attachment]
Attachments
PIRadio.jpg
Pi Internet Radio :) Party On....(and on)
PIRadio.jpg (149.58 KiB) Viewed 594 times
Last edited by waltermixxx on Mon Mar 04, 2013 8:54 pm, edited 1 time in total.
waltermixxx
 
Posts: 8
Joined: Sat Apr 10, 2010 1:36 am

Re: Built an awesome internet Radio with 2x16 RGB LCD Pi Plate :)

Postby waltermixxx » Mon Mar 04, 2013 8:39 pm

I did want to note that the portion of the code that prints the station and the song title needs work, originally designed to work on a 4x20 lcd. :)
i was too excited to mess around with getting the text to appear correctly ( Underground 80's new wave... !!!)
this is the bit here:

Code: Select all
f=os.popen("mpc current")
station = ""
for i in f.readlines():
         station += i
# Send some text
lcd.clear()
lcd.backlight(lcd.VIOLET)
lcd.message(station)


if anyone could help with getting it to appear properly on a 16x2 negative rgb backlit display via I2C i would be greatful... i image a some kind of loop that counts to 16 then adds a /n then continues?
:) any help would be appreciated :) I'm very new to python and this is my very first attempt and most of this code was borrowed and cobled together :)
waltermixxx
 
Posts: 8
Joined: Sat Apr 10, 2010 1:36 am



Return to Adafruit Raspberry Pi® accessories

Who is online

Users browsing this forum: limeychiney and 1 guest

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]