In our last How-To, we showed you how to setup KODI on the Raspberry Pi and how you can use it as a multimedia centre. In this How-To, we go one step further and show you how to build and configure your own KODI Internet radio with 7,000 channels and a touch display.
Level: Beginners with basic knowledge
Time required: approx. 1 hour
Budget: about £80
What you need: 1x Raspberry Pi 3B+ Set, 5″ Raspberry Pi Touch Display
Can be extended with: Any KODI Add-ons
You also need: PC keyboard, Internet connection
Before you get started – The Operating System
As with all Raspberry Pi (RPi) projects, we start by installing an operating system. To make installation as easy as possible and avoid unnecessarily complicated installation of driver software, Waveshare, the manufacturer of the display, provides a pre-configured Raspian image. You can download it here. After downloading, unpack the image contained in the archive and copy it to a MicroSD card using a tool like Etcher.
Start up and basic settings
Next, install the display so that the two HDMI ports are on top of each other and terminate the GPIO pins. Insert the HDMI connector, connect a keyboard, insert the MicroSD card into the slot and connect your RPi to the power supply to start.
Then connect the RPi to the Internet (via Ethernet or WiFi). Finally, we recommend changing the default password. You do this in the console with the command passwd.
Installing KODI and touch display setup
Now it’s time to install KODI. To do this, enter the following commands in the console:
sudo apt-get update sudo apt-get upgrade sudo apt-get install kodi
Now you can test KODI. However, the touch input will probably need some adjustments. Position the pen in the upper left corner, and you will see that some scaling is still necessary. To calibrate the display for KODI, close KODI, open a new console and enter the following command:
This command opens a text editor with the specified file in the specified path. Insert the following lines and save them by pressing Ctrl + X.
<advancedsettings> <touchscreen> <x_offset> -42 </x_offset> <y_offset> -36.16 </y_offset> <x_stretch_factor> 0.21639 </x_stretch_factor> <y_stretch_factor> 0.1325 </y_stretch_factor> <touch_mouse>0</touch_mouse> <touch_confines>8</touch_confines> </touchscreen> </advancedsettings>
When you restart KODI, the display and touch input should be perfectly calibrated and you can start setting up your KODI internet radio.
Configure touch and sound on KODI internet radio
The most important thing now is to configure the user interface for touch input (until then, use the arrow keys on the keyboard, backspace, Enter and Esc to navigate). Now go to Interfacesettings/Skins in the settings and select Estouchy. Now you have a back button, and by clicking on the KODI logo, you get to the start screen. Stay in the interface settings to select your preferred language under Regional.
Now it goes to the system settings. Select Pi:Analogue as the audio output device. Also check directly whether mouse and touchscreen support are activated in the input settings. If the audio output does not work later, enter the following command in the console:
amixer -c 0 cset numid=3 1
If this does not solve the problem, you can find more help here.
7,000 stations – How to set up the Radio.net Add-On
Now it’s time to install the Radio Add-On. It gives you access to 7,000 international Internet radio stations and is really easy to install. Go to Settings/Addons/Install Repository/Music Add-Ons and select Radio.net and click on install. To make it available directly on your home screen, go to Settings/User Interface/Skins/Skins configure/Add-ons on Home page and add your Radio.net Add-On for add-on link 1. Now start the add-on, browse through the huge selection and select a station to play on startup. As soon as your radio is running, quit KODI, start a console and open the log file with the following command:
Find an entry with station id at the end of the file and make a note of the number. In order for your radio station to start playing, create an autoplay file with the following command:
And save the following lines (replace xxxx with your station ID):
import xbmc xbmc.executebuiltin( "PlayMedia(plugin://plugin.audio.radio_net/station/xxxx)" )
Then it is important to make autoexec.py executable with the following command:
sudo chmod +X /home/pi/.kodi/userdata/autoexec.py
Now that the radio starts automatically when you open KODI, you only need to start KODI automatically when you start the RPi. To do this, open the following file:
And add the entry @kodi -fs in a new line.
When you restart your RPi, your KODI internet radio starts automatically on your favorite radio station, no matter where in the world you are!
Photography: reichelt elektronik