Raspberry Pi #3: build a remotely controlled Media Center
How to transform a Raspberry Pi 3 into a headless (no display, no keyboard) media center, connected to an audio library over local network and remotely controlled by an Android phone.
Here’s a diagram of what we are building:
Requirements
- A Raspberry Pi 3
- A computer (with SD Card slot or adapter)
- And HDMI display
- An Android device
Step 1: prepare the Raspberry system
Computer
Download the official Noobs boot program from RaspberryPi.org. Choose the complete version, as we are about to install LibreElec, the system required to run Kodi as an OS.
- Extract files from the Zip file
- Format the Micro SD card in FAT using GParted or Disks on Gnome
- Copy all the files from the extracted Noobs folder and paste them onto the SD card drive.
- When this process has finished, safely remove the SD card and insert it into your Raspberry Pi.
Raspberry
Connect the network cable to you router and turn on the Raspberry by plugin the USB power cable. Wait until Noobs boots up, and proceed to install LibreElec. Once the installation is complete, the Pi reboots into Kodi.
- Once in Kodi, configure your Wifi access. A virtual keyboard will appear to enter the password.
- I had to go into System > Audio > Output device : and chose “Analogue” to resolve an analog sound issue between Kodi and Raspberry.
- In System Infos, note your IP Address as you’ll need it for the remote connection, or to connect over SSH from you computer. The default login and password are root and libreelec.
- If you forget to note the IP Address, use nmap or any other Network tool:
$: nmap -sL 192.168.1.* | grep -i “raspberry”
> nmap scan report for raspberrypi.home (192.168.1.21)
Step 2: Connect your Music library
Computer
In this project, the music library is stored in the main computer hard drive. The idea is to share it over the local network to use it in Kodi. As the Raspberry is to be headless, a deported music library is easier to manage and update. The Raspberry will be connect by analog to the music equipment: amplifier and speakers.
To share the music folder over network, I’ve decided to use Samba (a Linux & Windows sharing utility). I’ll certainly switch to NFS later. Install Samba, then reboot the computer:
$: sudo pacman -S samba manjaro-settings-samba nautilus-share
Right click on the folder you want to share, and select Sharing options. Name and Comment, select the Guest Access option to avoid using a login and password on Kodi. To verify that the folder appears in the shared folders, use the command:
$: smbtree
Step 3: load the Music Library
Raspberry
Add your music library folder to Kodi.
- Go to Music > Add Music…
- Select Windows network (SMB)
- Browse to your shared folder
- Wait until the music library is populated
- If your music library is to be updated frequently, go to the Media Settings screen, and in Library, select “Update Music library on startup”
Step 4: remote control
Raspberry
Allow your system to be controlled remotely:
- Services Settings > Control
- Allow “remote control via HTTP” and create your login and password
Android
To remotely control Kodi and browse your media library, install Yatse on your Android device.
Go New Host and configure your access. You’ll need:
- The Raspberry IP Address
- The Login and Password created in the previous step
- Save the host, you’re ready to go.
Now you have a fully functional Media Center, unplug the HDMI display connected to your Raspberry. To update your media library, use any computer connected to your network.
VNC Access
Raspberry
To finalize the headless installation, let’s authorize VNC connection to the Raspberry.
- Go to System Settings > Add-ons > Running > Install From Repository > All
- Search for “Raspberry Pi VNC”
- Install
You can now access Kodi from a VNC Client.
sudo pacman -S tiger-vnc
Open Tiger-vnc and connect to the RPi IP address, using port 5900:
192.168.x.x:5900
Have fun!