0

PiTFT Internet Radio
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/
Please be positive and constructive with your questions and comments.

PiTFT Internet Radio

by McCloud84 on Fri Feb 28, 2014 6:25 pm

When I first got my Raspberry Pi I built several of the common projects including an internet radio, as I only really listen to metal and heavy rock I found that I could actually listen to some really good stations online!

Recently I got my PiTFT and thought it would be cool to have a touchscreen interface for the internet radio. I had a search around online and couldn't find anyone else that had done it already so I decided to have a go myself.

I added the stations manually from the command line using 'mpc add' and then wrote a python script to control the mpc playback and to display the current station and track name.

I'm a real beginner when it comes to programming and python. I can understand some of the basic stuff but it doesn't take me long to get lost, so I was really pleased when I managed to actually get it working!!

All the files are available on my dropbox... https://www.dropbox.com/sh/fygjxtkjt73xh6b/9Q4rGMfcaA
I'm sure lots of you will be able to hugely improve upon what I've done (although it may be easier to scrap it and start from scratch) and I would really appreciate any opinions on what I can change to either make it better, or to simplify the code.

https://www.dropbox.com/s/8ijlwnedk1hlh9e/2014-02-28-220908_1680x1050_scrot.png

https://www.dropbox.com/s/4qpbj81lhlxe7p7/Photo%2028-02-2014%2022%2015%2032.jpg
McCloud84
 
Posts: 14
Joined: Fri Feb 28, 2014 2:45 pm

Re: PiTFT Internet Radio

by adafruit_support_mike on Sat Mar 01, 2014 12:15 am

Every project starts small and rough. The first version of Linux had just barely enough code to boot a 486 computer.

Thanks for posting this! ;-)
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 58843
Joined: Thu Feb 11, 2010 2:51 pm

Re: PiTFT Internet Radio

by wbp on Sat Mar 01, 2014 8:11 pm

adafruit_support_mike wrote:The first version of Linux had just barely enough code to boot a 486 computer.


I'm pretty sure the first version ran on an 80386 - I actually remember this... :)

wbp
 
Posts: 246
Joined: Mon Mar 07, 2011 1:18 pm

Re: PiTFT Internet Radio

by adafruit_support_mike on Mon Mar 03, 2014 6:48 pm

I think you're right. It's hard to remember which chip was dominant at the time. ;-)
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.

adafruit_support_mike
 
Posts: 58843
Joined: Thu Feb 11, 2010 2:51 pm

Re: PiTFT Internet Radio

by buguibu on Wed Mar 12, 2014 7:12 pm

Hy McCloud84 and thanks for the job, it looks like the project i'm looking for, simple and most important for me understandable because i'm really newe.

Due to Raspbian it's the only one Raspberry pi distribution that it's officially supporting PiTFT, i suppose that your script runs on Raspbian, i'm wrong?

Well, i'm having few time this week but i hope i could help to your project.

thanks again and long live to metal!
_\m/ :twisted:
buguibu
 
Posts: 1
Joined: Wed Mar 12, 2014 6:59 pm

Re: PiTFT Internet Radio

by McCloud84 on Fri Mar 14, 2014 5:23 am

Hi, I'm really glad that this project is helpful to you.

Yes it is all on Raspbian, you need to go through the PiTFT setup process first and get that all working properly, then you should be able to add some stations, run the script and off you go into a world of metal radio! \m/

I have made a few changes since I posted this, including using a touchscreen keyboard to add additional stations but I've not sorted the final code for it yet.

Cheers, Andrew
McCloud84
 
Posts: 14
Joined: Fri Feb 28, 2014 2:45 pm

Re: PiTFT Internet Radio

by gadjodilo on Mon Mar 24, 2014 10:46 am

McCloud84 wrote:Hi, I'm really glad that this project is helpful to you.

Yes it is all on Raspbian, you need to go through the PiTFT setup process first and get that all working properly, then you should be able to add some stations, run the script and off you go into a world of metal radio! \m/

I have made a few changes since I posted this, including using a touchscreen keyboard to add additional stations but I've not sorted the final code for it yet.

Cheers, Andrew



Hello McCloud84

Thanks for sharing this! I have a problem with the autostart of the scripts in the GUI. If I have this in the autostart, it displays briefly, then the window closes again.
Is it normal that the process is fully loaded when starting the script?

Him joyful hope of an update and thank you for this great project!

gadjo
gadjodilo
 
Posts: 2
Joined: Mon Mar 24, 2014 10:37 am

Re: PiTFT Internet Radio

by McCloud84 on Mon Mar 24, 2014 11:04 am

Hi, sorry to hear that you are having issues with the script.
As I said in the original post I am a real beginner when it comes to coding so I'm not sure that I can really help you.
I've not set my code to autostart as I use my pi for lots of other thing, so I just start it from the command line when I want to use the radio. I've not had any problems with mine so far, so I'm not really sure whet to suggest, sorry :?
McCloud84
 
Posts: 14
Joined: Fri Feb 28, 2014 2:45 pm

Re: PiTFT Internet Radio

by gadjodilo on Tue Mar 25, 2014 9:11 am

Hi and thanks for the write back. I have adapted your python script for the autostart process. I had to specify the full path for all images, then it worked.

imgbg = pygame.image.load ("bg.png")
to
imgbg = pygame.image.load ("/ home / pi / PiRadioTFT / bg.png")

thank you and greeting
gadjodilo
 
Posts: 2
Joined: Mon Mar 24, 2014 10:37 am

Please be positive and constructive with your questions and comments.