Adafruit tutorial

eskMate2000">Updated blog post: Home-automation with a touchscreen Pi

I had a very exciting email the other day asking if I would write up my Internet radio as a tutorial for the Adafruit learn website. Being a massive fan of Adafruit I was very happy to do this!

The tutorial can be found here

If you have not visited Adafruit or bought from them I can highly recommend their products. In addition to selling some really cool products they are committed to producing and sharing detailed instructions and product support. I have found the tutorials to be really well written and often preempt common problems and issues you may find.

Comments

Finding Internet Radio station

eskMate2000">Updated blog post: Home-automation with a touchscreen Pi

Tutorial: Adding Internet Radio Stations to mpc



Step 1


If you haven't installed mpd and mpc start by making sure your Raspberry Pi is up to date.

sudo apt-get update

sudo apt-get upgrade


Step 2:

Install mpc and mpd

sudo apt-get install mpd mpc


Step 2:

Add BBC Radio 1 to your playlist to check everything is working as it should.

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio1_p?s=1365376033&e=1365390433&h=a0fef58c2149248d6bff1f7b7b438931


Start the radio station playing with

mpc play


Step 3:

Finding new radio stations to add to your playlist

Visit http://www.shoutcast.com and look at their large collection of internet streaming radio stations.

Once you find a station you like right click on the download icon and save the file.

Open the file you have just downloaded with a text editor. It will look something like this.

[playlist]
numberofentries=1
File1=http://67.23.252.145:9986
Title1=(#1 - 0/500) UCBRADIO
Length1=-1
Version=2


Copy the web address from the file (highliged in red below)

[playlist]
numberofentries=1
File1=http://67.23.252.145:9986
Title1=(#1 - 0/500) UCBRADIO
Length1=-1
Version=2

Now add the web address to the mpc playlist with

mpc add http://67.23.252.145:9986








Comments

Raspberry Pi Internet Radio Player

Tutorial: Raspberry Internet streaming radio

eskMate2000">Updated blog post: Home-automation with a touchscreen Pi

Latest video: Introducing the Hudl2 - budget Android tablet from Tesco



This project is based around the 2.8” touch screen from adafruit.

The full details of building and setting up the touch screen can be found on the adafruit website here. This must be done before trying to use the radio!

This project creates an internet streaming radio for the Raspberry Pi using the 2.8” touchscreen. This does not use the x interface and makes use of Pygame.

Raspberry Pi Radio

Step 1:

Set up the Adafruit TFT using the instructions provided by Adafruit. Make sure that all the steps are followed for calibration of the touch screen. There is no other control of the radio player other than the touch screen so if this is not done it won’t work!

Step 2:

Plug in a speaker or headphones into your audio jack. It took me nearly 5 minutes to work out my I was getting no sound when I hadn’t switched on my speakers!

Step 3:

If your Raspberry Pi is up to date you should already have the libraries for Pygame installed.

sudo apt-get update

sudo apt-get upgrade


Step 4:

Install mpc and mpd and add some radio stations to your play list

sudo apt-get install mpd mpc

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio1_p?s=1365376033&e=1365390433&h=a0fef58c2149248d6bff1f7b7b438931

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio2_p?s=1365376067&e=1365390467&h=d43dc8ae0f888809462a6cb7c389b46b

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio3_p?s=1365376123&e=1365390523&h=d53cf2a92272f3289b314a2251d23bc8

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio4_p?s=1365376126&e=1365390526&h=ed9a0642b30c422b07fbcd8683c52335

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_5live_p?s=1365376271&e=1365390671&h=e0d82133f35ae74d41d5eab6b9c150a6



mpc and internet radio stations are very well documented so I won’t go into too much detail here. The stations listed above are for BBC Radio stations in the UK.

If you want to save, edit and open your play list they are saved in /var/lib/mpd/playlists/


Step 5:

I have made the source code and icons I used available here.


I am not yet using github for my projects but hopefully will be soon!


Step 6:

Save the python program radioplayer.py and all the icons into one folder. You should run the python program from within that folder.

sudo python radioplayer.py


Controls

Play mpc play
Pause mpc stop
Refresh mpc stop followed by mpc play
Volume up mpc volume +10
Volume down mpc volume -10
Mute mpc volume 0
Previous station mpc prev
Next station mpc next

Each control is started with a command such as subprocess.call(“mpc play”, shell=True)

The code still contains much debugging and developer information so you will see lots of additional comments in the console - sorry!

Have fun, let me know what you think.

Now you are ready to add more channels to you mpc player check out this tutorial.





Comments

Raspberry Pi Internet Radio Player

Tutorial: Raspberry Internet streaming radio

eskMate2000">Updated blog post: Home-automation with a touchscreen Pi

Latest video: Introducing the Hudl2 - budget Android tablet from Tesco



This project is based around the 2.8” touch screen from adafruit.

The full details of building and setting up the touch screen can be found on the adafruit website here. This must be done before trying to use the radio!

This project creates an internet streaming radio for the Raspberry Pi using the 2.8” touchscreen. This does not use the x interface and makes use of Pygame.

Raspberry Pi Radio

Step 1:

Set up the Adafruit TFT using the instructions provided by Adafruit. Make sure that all the steps are followed for calibration of the touch screen. There is no other control of the radio player other than the touch screen so if this is not done it won’t work!

Step 2:

Plug in a speaker or headphones into your audio jack. It took me nearly 5 minutes to work out my I was getting no sound when I hadn’t switched on my speakers!

Step 3:

If your Raspberry Pi is up to date you should already have the libraries for Pygame installed.

sudo apt-get update

sudo apt-get upgrade


Step 4:

Install mpc and mpd and add some radio stations to your play list

sudo apt-get install mpd mpc

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio1_p?s=1365376033&e=1365390433&h=a0fef58c2149248d6bff1f7b7b438931

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio2_p?s=1365376067&e=1365390467&h=d43dc8ae0f888809462a6cb7c389b46b

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio3_p?s=1365376123&e=1365390523&h=d53cf2a92272f3289b314a2251d23bc8

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_radio4_p?s=1365376126&e=1365390526&h=ed9a0642b30c422b07fbcd8683c52335

mpc add http://bbcmedia.ic.llnwd.net/stream/bbcmedia_intl_lc_5live_p?s=1365376271&e=1365390671&h=e0d82133f35ae74d41d5eab6b9c150a6



mpc and internet radio stations are very well documented so I won’t go into too much detail here. The stations listed above are for BBC Radio stations in the UK.

If you want to save, edit and open your play list they are saved in /var/lib/mpd/playlists/


Step 5:

I have made the source code and icons I used available here.


I am not yet using github for my projects but hopefully will be soon!


Step 6:

Save the python program radioplayer.py and all the icons into one folder. You should run the python program from within that folder.

sudo python radioplayer.py


Controls

Play mpc play
Pause mpc stop
Refresh mpc stop followed by mpc play
Volume up mpc volume +10
Volume down mpc volume -10
Mute mpc volume 0
Previous station mpc prev
Next station mpc next

Each control is started with a command such as subprocess.call(“mpc play”, shell=True)

The code still contains much debugging and developer information so you will see lots of additional comments in the console - sorry!

Have fun, let me know what you think.

Now you are ready to add more channels to you mpc player check out this tutorial.





Comments

Pygame menu for TFT screen

eskMate2000">Updated blog post: Home-automation with a touchscreen Pi

Tutorial: Raspberry Pi TFT menu using Pygame

Pimenu_photo

This project is based around the 2.8” touch screen from adafruit.

The full details of building and setting up the touch screen can be found on the adafruit website here

This project creates a 4 button menu system for the Raspberry Pi using the 2.8” touchscreen. This does not use the x interface and makes use of Pygame.

This is work in progress and at the moment the buttons do not do anything.
You will need two images for the logos, I have used 100x100 bmp images.

The current source code can be found here on dropbox




Comments

Digital Photo Frame

Tutorial: Making a Raspberry Pi USB-stick Digital Photo frame


Pi photo frame

This tutorial is based around the 2.8” touch screen from adafruit.

The full details of building and setting up the touch screen can be found on the adafruit website here

The photo frame is powered by FBI (Frame Buffer Image Viewer) which can be installed using:

sudo apt-get install fbi

Rather than copying photos onto the Raspberry Pi I wanted to display photos from an attached USB memory stick.

Before you can attach and mount your USB stick check that you have a usb folder in /mnt

mkdir -p /mnt/usb

On your mac or PC format your USB stick as FAT32.
Make a folder called
Slideshow
Copy your photos into that folder as JPGs

If you are new to using USB from the command line you will need to insert the USB stick and then mount it.

sudo mount -t vfat /dev/sda1 /mnt/usb

You can simply check that your USB stick is attached by

cd /mnt/usb
ls


This should display the contents of the USB drive.

We are now ready to start the slideshow.

sudo fbi -a -t 5 /dev/fb1 -noverbose /mnt/usb/Slideshow/*.jpg

To exit the slideshow simply press escape.

additional information

-a scales the photos to fit the screen (both scale up and scale down)
-t 5 sets a duration of 5 seconds for each photo
-noverbose turns off on-screen message
-u will display the photos in a random order

The man pages for FBI can be found here





Comments

Why am I passionate about the Raspberry Pi?

Over the last few days I have been thinking about how the last two years for me have been so heavily influenced by the Raspberry Pi.

If someone had said that I would be running a successful computer programming club at school, training other teachers in programming and hooked up to such a great community I would not have believed it.

The scary thing is that after all this work I am becoming more and more certain that I want to make the transition from Science / Chemistry teacher to Computer Science teacher.

I made this video to explain how my son got interested in programming and how the Raspberry Pi has influenced him.



I do feel very excited about the future especially now that we have so many young people interested in programming, tinkering and project making. I don’t believe that everyone is destined to become the next big programmer or app developer but I do believe the skills that are developed have a much wider benefit.

Here’s to a bright future!


Comments