Raspberry Pi Model B Touchscreen Radio Project
Get a taste of the new Raspberry Pi 2By Mark Casilang
Description: 2.8" Touchscreen Raspberry Pi Radio
Assembly Time: 2-3 hours, depending on experience
The Raspberry Pi 2 Model B is an amazing piece of technology. It has taken the hobbyist population by storm with an affordable price and complex functionality. I am still a Pi novice, but I couldn't help but try this touchscreen radio project; it helped me to get familiar with the Pi OS and get a taste of new Raspberry Pi 2 Model B’s power. I highly recommend this touchscreen radio project for those looking for an introductory RPi project, but it is a great project for any experience level.
Required tools and components:
Raspberry Pi 3 Model B
2.8" Touchscreen compatible with Raspberry Pi 2
Raspberry Pi 2 Model B starter kit
8GB or higher micro SD card and card reader
Keyboard and mouse for the Raspberry Pi 2
Computer to download and install files
First, you'll need a micro SD card to store data for the Pi to function and files for the radio touchscreen to work. I recommend checking out the Raspberry Pi tutorial site; it does a great job getting you started from explaining how to download and install the OS to navigating and using the Pi. It's the best source whenever you get stuck, and I definitely came back from time to time throughout the project.
Once you are familiar with that process, you must "flash" the image that enables the touchscreen to work with the Pi. The site goes over the flashing process as well. It took me quite a bit of research and time to find the correct file and install it onto the micro SD card. Also download the buttons for the touchscreen radio; the necessary zip file can be found here.
Raspberry Pi Main Site
Next, insert your micro SD card to your Pi. Connect the mouse, keyboard and HDMI cord from the Pi to a monitor, and plug in the power cord. Once you have everything connected, flip the power switch on and see if the screen pops up. If you see a bunch of text scrolling, you have a functioning image file. If you have a rainbow colored screen, your file is corrupt and is not booting the OS correctly (I had several files give me the rainbow colored screen, but you will avoid that if you use the linked file provided).
The Raspberry Pi installation will take about 15 minutes once you start it up for the first time, but subsequent startups will take about the same amount of time as starting a desktop computer. Once you select "finish" to end the initial settings, a command line prompt will pop up. Type "startx" to begin using your functioning Pi.
After you get your Pi up and running, it's time to get the touchscreen to work. First I calibrated the touchscreen to ensure accuracy on touching the radio buttons. To calibrate, unplug the cable connecting the touchscreen to the Pi and plug it in again. Touch and hold down on the screen right away until the calibration screen pops up. It is a simple process by touching where the screen tells you.
Raspberry Pi 2 Connected
Raspberry Pi 2 Touchscreen
After you've calibrated the touchscreen, it's time to install the music player and load the streaming websites that your radio will play. To do this, you must go to the command terminal on your Raspberry Pi. Input the command "sudo apt-get update" to guarantee that you have the latest software and enable installation of the music player. Make sure you are connected to the Internet, either by Ethernet cable or the wireless adapter included in the starter kit. To install the player, input the command "sudo apt-get install mpd mpc". To add stations, input the command "mpc add http://...." for each station that you want to add.
Make sure you put the exact link for the radio station, or else it will not work. I tried radio stations on www.radionomy.com and was satisfied with the results. To get the correct link, right click the play button on the station and click "view page source". Then, search for the "https://listen.radionomy.com/..." link. To make sure your radio station works, input the command "mpc play," and should hear the station playing.
After adding all of your stations, run the radio player python program file in another terminal window. Input the command "sudo python radioplayer.py" and the radio player program should run. You can click play or pause, raise or lower volume, and select next or previous station buttons on the screen. The current station and song will display, if it doesn't show or has the incorrect information, click the refresh button to update.
RPi2 with Touchscreen
Touchscreen with Radioplayer Buttons
This was a great Pi introductory project and who doesn't like having a streaming radio at the tip of their fingers? Have you tried the new Raspberry Pi 2 Model B? Let us know what you think about this project and the new Pi at [email protected].
Mark is a graduate from Cal Poly, San Luis Obispo in Electrical Engineering. He is originally from sunny San Diego, CA. His interests include traveling, movies, games, sports, music, playing tennis and going to the beach.