Setting up a Raspberry Pi media centre

A couple of years ago I built a media player using a Raspberry Pi and OpenELEC. I’ve made a few changes since I wrote that blog post (not least moving to LibreELEC), and have also made a smaller version of the same device that I use in hotels when I’m travelling.

Hardware

There are two hardware choices for this sort of project – Any model of full sized Pi, or a Pi Zero (which is more portable, but harder to get media on to).

Preinstalled SD cards can be bought directly from Pi Hut (or just buy blank ones from Amazon which is what I do).

You’ll also need a mouse (for setup), the TV you’re going to plug it into, a HDMI cable, and some way of getting media on to the device if you’re using the Pi Zero (more about that later).

For my Pi III based device I still use the same case as before, and also have small USB drives plugged into each spare USB port to give more storage. I also have it networked now to allow easier streaming from my NAS.

For my Pi Zero I use a case that I can’t find a link for now, but really anything that allows access to all the ports will be fine.

Software

LibreELEC is one of the installation options on the NOOBS image, and can also be bought preinstalled on an SD card. The first option requires an internet connection (which might be tricky on the Pi Zero), and both options require a mouse.

Once installation had finished the device boots into the default Kodi interface. A web-based remote can be accessed by browsing to the device’s IP address on port 8080, and it can be accessed as network based storage from other computers on the same network.

Full details on how to download and install later verions of the software as they become available can be found on the LibreELEC wiki.

Content

Adding content is straightforward if the device is networked. It’s simply a case of browsing to the device and copying files across, or by pointing it at a network share.

For ther Pi Zero I’ve found the best way to do this is to use a USB ethernet adaptor (mine doesn’t have wifi), but I suspect that the newer model linked to above might work on wifi which would reduce the need for a further piece of hardware.

Addons

The original plan for this project was that I’d end up with something that could play movies and music on my TV, and that could handle storing a small amount of content locally so that when I end up in a hotel room with a few hours to kill I have something interesting to watch. The solution I’ve built ticks all those boxes, but I was curious to explore what else LibreELEC could handle.

After exploring the interface and available software for a little while I found channels for Last.fm scrobbles, BBC iPlayer and TED talks. All of these installed and worked fine, and I’ve not found myself needing anything else on these devices.The larger one is used every day, and is definitely my prefered platform for interacting with iPlayer. The smaller one travels with me, and I just copy a variety of films to the internal SD card and use the one USB port for a mouse.

My travel setup

My travel kit (for non-work travel) now consists of:

If I’m working I’ll also have my Surface Pro 4 with me, but apart from that I rarely travel with a laptop these days.

Building the Debian Handbook

What follows is instructions for creating a local HTML copy of the Debian Administrator’s Handbook (which is a very useful source of information for anyone working with any Debian derivative including Ubuntu and Raspian). All work related to this project was done on a Raspberry Pi Zero running Raspian, so I suspect it will work on anything running any Debian derivative (although Ubuntu 16.04 is the only other system I’ve tested this on so far).

Open up a terminal, and issue the following commands to get hold of the source code:

sudo apt install git
sudo git clone
git://anonscm.debian.org/debian-handbook/debian-handbook.git

Install the packages required for building:

sudo apt install publican publican-debian

Build the html files:

cd debian-handbook/
sudo ./build/build-html

It might take a while to build, especially on the sort of hardware I’ve been using. This might be the point to make a cup of tea.

Copy the HTML files into the root of your web server:

sudo cp -R publish/en-US/Debian/8/html/debian-handbook/ /var/www/html/

At this point you should be able to browse to the home page of the directory by navigating to the hostname or IP address of your web server.

Simple CCTV setup using a Raspberry Pi

This weekend I’ve been setting up my latest Raspberry Pi (a version III, in a blue lego case, running Ubuntu) to display a video stream of what’s going on outside my house so I can watch out for deliveries etc.

It’s something I’ve done before on different hardware, but I thought it was worth documenting as it’s a good project for any model of Raspberry Pi, and requires nothing more than the Pi, a USB webcam (or camera module), and 15 minutes of your time. I’m using a piece of software called motion which is available in the Debian/Raspian/Ubuntu repositories.

Install motion:

sudo apt-get install motion

Enable motion to start at boot:

sudo nano /etc/default/motion

Find the line that says start_motion_daemon=no and change it to start_motion_daemon=yes.

Enable the stream to be viewed from other computers on the local network, and also make the output a little bigger:

sudo nano /etc/motion/motion.conf

Change the following values:

daemon on    
width 640     
height 480     
framerate 100     
stream_localhost off    

Reboot, and then browse to port 8081 on the computer you’ve set it up on.