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.

Setting up new Ubuntu computers

I’ve had to set up a few Ubuntu desktop machines recently, and I thought it was worth documenting what I install on each one, and how I automate those installations as much as possible. I wrote about this a few years ago but so much has changed with my setup that I thought it was worth revisiting these instructions.

Generally, I’ll always install from USB, and from the latest desktop version. I make my installer in Ubuntu, using Disk Image Writer and boot the computer from that. From 18.04 onwards I sometimes use the minimal installation feature (which I love), but for now assume that I just go with the defaults for everything.

Once it has finished installing, I’ll go through the process of getting everything I want on to the machine.

Install dropbox

I download the latest version from https://www.dropbox.com/install?os=lnx and then type:

sudo dpkg -i dropbox <hit the tab key>

I have a lot of files on Dropbox, so I let this sync while I’m doing the rest.

Add some software from the Ubuntu repositories

sudo apt update
sudo apt install byobu gimp vlc ubuntu-restricted-extras build-essential hexchat openssh-server gnome-tweak-tool tilix testdrive tasksel gnome-session libdvd-pkg chromium-browser youtube-dl
sudo snap install --classic atom
sudo snap install spotify

Add a script to make updating software easier

Create a new file called updateall

#!/bin/bash
echo "updateall v.1.2 for Ubuntu"
#Run this as a normal user. Your admin password will be asked for if required.
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove -y
sudo purge-old-kernels -y
echo "The script has now finished running."

I move it to /usr/local/bin/ then make it executable with sudo chmod 755 /usr/local/bin/updateall.

Install tails-installer

sudo add-apt-repository ppa:tails-team/tails-installer
sudo apt update
sudo apt install tails-installer   

Install pandoc

This installs the latest version at time of writing, although there may be updates available.

wget https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb
sudo dpkg -i pandoc-2.2.1-1-amd64.deb
sudo apt install texlive texlive-latex-extra

See here for more on how I configure and use Pandoc.

Cosmetic tweaks

  • Change desktop wallpaper
  • Log out, log back in, and select a vanilla Gnome desktop.
  • Go to Settings --> Security and Privacy and turn off all “phone home” functionality.

Accountability

At the start of the year I wrote a blog post about things I might do differently this year. Not resolutions as such, just lines in the sand and broad statements of intent. As the year is nearly two thirds of the way through (how?), I thought it was time to look at those statements of intent, see if anything had noticeably changed, and note anything else eventful that had happened.

The first thing I wrote about was visiting the cinema more. Apart from a slight lull in the spring this has gone very well, and I’ve seen 14 films this year so far. It’s not quite enough to make the unlimited card worth it, but when you add in discounts on food and drink and other benefits it’s just about paid for itself (although I do resolve to go to the cinema slightly more often in the cold winter months to make sure I get value for money). I also set up a (private) WordPress site to record everything I’ve seen, everything I want to see, and to otherwise document my cinematic adventures. Let’s face it, if I’m doing something then there is probably a WordPress site somewhere to document it.

The second thing I wrote about was my relationship with technology, and in particular how I was using my iPad more for personal computing (and my Surface Pro 4 for work computing). The last 8 months has probably been the least remarkable period of time in regard to changes in how I use technology, and I don’t think a single thing has really changed (apart from my diminishing love of the Surface). I’ve not bought a computer of any type this year, and spent a very small amount of money on technology in general. I’ve travelled several times with just an iPad, and have found that the thought of doing that is nowhere near as remarkable as I thought it might be at the start of the year. If anything has changed it’s that I’m using MacOS and Ubuntu at the same time rather than choosing between them, due to having a bigger desk that will fit two monitors, although the jury is still out as to whether I’ll actually replace the Mac when it finally dies or becomes obsolete (it’s 6 years old now).

The third thing I wrote about was music, and how I planned on buying less but listening to it more. This has largely gone as expected, although I did go through a period in the spring where I bought a few extra CDs, and it really took me until about May before the vision of the future I was aiming for actually came to pass. I’ve also noticed that I’ve started listening to older music a lot more this year, with as lot of old favourites getting significantly more airtime that records that came out this year. I’m not sure whether this is a blip or a trend yet, but it will be interesting when I do my yearly review to see how many records from before 2017 make the list.

The last thing I wrote about was socialising, and how I wanted to do more of this (but didn’t have a plan). This is probably the area where the most has changed, and I’ve been more socially active (especially with people from work), and have done a wider range of things (cinema, walking and comedy nights rather than just food and drinks). As predicted, it sorted itself out organically, and I can’t pretend I really did anything to make this happen.

The other key thing that happened recently is that I stopped eating meat (and then eventually fish) at some point at the start of this year. It wasn’t a conscious decision (at least not at first), but once I realised I’d stopped and I felt better for it then it was a bit of a no brainer to just make it a thing I didn’t do any more. I’ve found it surprisingly easy, and I’ve found I’m learning more about food and how it affects my body as a result.

I think the only other things of note are that I bought my first pair of varifocals last week after a period of diminishing eyesight, and that at some point in the spring I started drinking proper coffee again and tried to cut out the instant rubbish as much as possible. Both of these are probably only of interest to me, although I’m sure people around me are glad I can now do things like read menus in restaurants and actually see what is on the screen of my phone.

Home improvement

We went to Ikea today, ostensibly for a new desk for my study. Evernote tells me I did the measurements for this desk over two years ago, so it’s probably about time. As well as a desk, we also picked up a new kitchen table (replacing one that’s probably 15 years old) and a new coffee/gaming table for the living room (replacing one that’s nearly as old as I am). We also picked up some stools and a couple of iPad holders each to make it easier to use what are fast becoming our primary computers in a number of different ways. Everything smells new and wooden, and I love it all.

I now need to work out how I want my new desk set up. I long ago accepted that my IT needs are less than they were when I actually worked in IT, and as a result I probably don’t need to have quite so many computers in circulation. How that is going to work with a larger desk I’m not sure, but I’m hoping I can at least be a little sensible when I’m deciding what actually needs to be reassembled tonight.

I’m also hoping this new setup will mean I can dismantle the standing desk I built on the living room fridge a year or so ago. It only houses a Raspberry Pi now, and it’s not really a useful workstation because the dog hates me using it to the point where she barks incessantly and/or tries to jump on my (non-existent) lap.

I like new things, and I suspect this is only phase one of a fairly major decluttering and renovation exercise that is long overdue.

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.

A few thoughts on Macs and iPads

I went in to the new Apple Store in Birmingham today. I’ve been meaning to go for ages, but as I’m not really in the market for anything new then I’ve not seen it as a pressing task. My main reason for going was to try out the keyboards on the new MacBook Pro to see if it’s something I could live with if I end up getting one at some point in the future. It’s very different to the keyboards I’m used to (the previous generation of MacBook Pro/Air, and also the Apple bluetooth keyboard and my Logitech solar powered keyboard). There is definitely less movement of the keys as I type, but my accuracy didn’t take a hit, and I think I could grow to accept it as a keyboard for everyday use. I also thought the screen was gorgeous, and that 8GB of RAM would be enough for most of what I use a laptop for these days, especially as the SSD is so fast. I’m not going to rush out and buy one, but I wouldn’t rule it out at some point in the future (although the touch bar still leaves me cold).

I also looked at the MacBook (small, similar keyboard, would make a decent MacBook Air replacement in a year or two), and the larger iPad Pro (huge, beautiful screen, surprisingly good typing experience with the Smart Keyboard). Neither of these are things I need, but I would happily use as my main portable device if the opportunity presented itself, and actually touching the iPad made me realise why so many people are saying they can use it as their main computer. I use my smaller iPad Air 2 for a lot of what I do online outside of work, and I can see how twice the memory and a much larger screen would help me leave my laptop behind forever (although I also want to wait and see what the next iteration of the device might look like).

I’m still hoping Apple bring out a desktop computer that excites me this year (because that is something I’ll need to buy soon as I fear my 2011 Mac Mini will be obsolete within a year or so). I would use anything they currently have on the market (with the right upgrades), but as I’ve not actually bought any of them then it suggests that there is nothing currently out there that is suitable enough for me to consider an upgrade at this point in time.

Using an iPad as a primary computer

There’s been a lot of talk on the internet over the last couple of weeks from people who were planning on buying a new Macbook Pro who have instead decided to move most (or all) of their workflow over to some sort of tablet (usually an iPad Pro). While I’m not quite there yet, I do find myself using my computer less and my iPad more, and I thought it was worth exploring exactly what it is that would stop me making this sort of switch.

As far as I can work out, the things I still need a computer for are downloading and managing music, ripping/converting CDs/DVDs, converting markdown into .docx (and possibly some other formats, although I have solutions for html and pdf now), and web development/Wordpress work.

Of these, the first one requires macOS/Windows because of the integration with iOS (and only because of that). I don’t want to stop using my iPhone/iPad though, and I buy new music very regularly, and want to be able to listen to it on the move.

The second one can be done on any computer that can be connected to a USB CD drive (which I already own), will run handbrake and that has enough storage space. I probably wouldn’t try this on a Raspberry Pi, but anything else would work.

The third one I can do on anything that can run Pandoc, so any computer that can handle the first two tasks will handle the third.

The fourth one I can do on any Mac/Linux computer. I already have a Linux solution working, and could even use a Raspberry Pi at a push (I’ve already set up a basic environment on a Pi II).

That’s actually not a lot. All my writing, blogging and social media works fine (in some cases better) on my iPad, and Microsoft Office also works well (and integrates nicely with both Sharepoint and Dropbox).

Right now my two most utilised computers are the iPad and the Pi that I use for watching TV shows. Nothing else comes close, and my desktop computers only really get any sort of serious use during weekends/holidays. Maybe there is more milage in this than I thought.

Getting up and running with a CHIP

Tonight I finally received two CHIP boards (sort of a cross between a Raspberry Pi and a Pi Zero). I’d kickstarted these about a year ago and totally forgotten about it, so it was a nice surprise. Whenever I get my hands on something like this the first challenge is to power it up, boot an operating system, and see what it will do.

What follows is one way to get one of these devices powered up, connected to a wifi network, and with access to a graphical desktop. These instructions will work on macOS and Linux, for Windows there may be a need to consult the manual to get the relevant type of terminal access.

The only thing you’ll need (apart from the CHIP itself) is a microUSB cable. As an avid Raspberry Pi enthusiast I have quite a few of these lying about so there was no additional expense. Plug the small end of the cable into the relevant slot on the CHIP and the other end into a spare USB port on your computer. You’ll then need to see what device name your computer has assigned your CHIP by issuing the following command in a terminal window:

ls /dev/tty*

Find the output that looks something like /dev/tty.usbmodemFD1223 and make a note of it. Then issue the following command (replacing my device name with whatever yours is):

screen /dev/tty.usbmodemFD1223 115200

At that point you should get a login prompt. Log in as user chip with password chip (yes, I know). At that point you should find yourself logged into a fairly minimal Debian installation.

As yet there is no network, but as the CHIP has wifi then we can set this up fairly easily. In the logged in terminal session enter the following:

sudo nmcli device wifi connect '(your wifi network name/SSID)' password '(your wifi password)' ifname wlan0

The output should be something like:

Connection with UUID 'e9e45ce8-9961-4116-a7eb-d526e60af3ee' created and activated on device 'wlan0'

At this point you should have a network connection. Test it by doing some software updates:

sudo apt-get update && sudo apt-get upgrade

When you’re done (it might take a while) install xrdp to allow you to initiate remote desktop connections to the CHIP:

sudo apt-get install xrdp

Once that is done, create a new RDP connection using your client of choice. Find out the IP address using ifconfig or just use the name chip.local, enter the username and password, and you should see a graphical desktop with an application menu and a fair few applications.

I’ve also had some success plugging an ethernet adaptor into the CHIP’s USB port and connecting via ssh, but on most occasions the device powered down before I could do anything useful with it. This is the same setup I use with my Raspberry Pi Zero, so I know it theoretically works, but I need to investigate how much power the adaptor is drawing as it looks like the device is struggling to power it.

Musings on hardware

My next work machine will be a Surface Pro. I could have gone with a very nice looking Acer, but as I’m keeping my old Macbook Pro for a little while I thought portability should win out. I’m also spending a lot of time using my iPad, and I’m finding myself missing a touch screen interface when I don’t have one, and I’ll need to use enough Windows-only software in my new job to make using anything else an exercise in frustration.

The way I use computers is certainly changing. I’ll get the Surface Pro 4 in a few weeks, and whilst I love the look of the new Macbook Pro I don’t think I can justify buying one right now, which suggests I’ll not be using a Mac for most of my day-to-day computing for the first time since 2010. What I really need to go with the Surface and the iPad is some sort of desktop to manage all my music and do any non-work tasks that require heavy lifting. I’m disappointed that Apple didn’t announce anything in their recent broadcast, but I’ll definitely be keeping my eye on the refurb store to see if anything looks affordable (which of course they don’t right now because all the prices have gone up). My Mac Mini will do for now, but it’s 5 years old and everything else I use feels snappier, despite the Mac having 16Gb of Ram and a fairly new SSD.

I’ve written this blog post on my iPad using a full sized bluetooth keyboard (which I used as my main keyboard for a number of years). It’s even easier than using the tiny keyboard I carry around everywhere, and I think that with this keyboard and my iPad (or maybe the larger iPad Pro) then I could easily do the vast majority of my work-away-from-work without access to another computer. I’m typing this whilst sitting at my coffee table, so my posture isn’t great, but I think that once I’ve cleaned the keyboard up a little then I’ll look at trying this combo out at a proper desk as it’s certainly worth further exploration as my main writing device.

Whatever happens next, I’m already using a lot of different kit than I was a year ago, and I think I’m only half way through a fairly major change in the way I work. I start my new job on 1st December and I’m sure that will bring even more change.

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.