Build A Raspberry Pi Media Player
Build A Raspberry Pi Media Player
Build A Raspberry Pi Media Player
MEDIA PLAYER
Power up your TV and music system
www.dbooks.org
WELCOME
WELCOME!
T
hank you for picking up this copy of Build a
Digital Media Player. This is an exciting Raspberry Pi
project that’s fun and functional.
Raspberry Pi is small computer that can be picked up
from just $15. Add some simple software, and a remote
control, and you will build a digital media box that puts
shop-bought solutions to shame.
For starters, it’s cheaper to make your own media
player, but more importantly, you have complete
freedom to play whatever you want. Play your own movie
files, music and photographs alongside streaming video
and music from the big services.
In this book, we have collected together some of the
best articles from The MagPi magazine written on this
hugely popular subject. We’ll show you how to build a
media centre, create a home server that stores all your
video files, make your own music system and all the best
kit and projects to look at.
Happy making and enjoy your personal media player.
Lucy Hattersley
This official product is published by Raspberry Pi Ltd., Maurice Wilkes Building, Cambridge, CB4 0DS. The publisher, editor
and contributors accept no responsibility in respect of any omissions or errors relating to goods, products or services referred
to or advertised in the magazine. Except where otherwise noted, content in this magazine is licensed under a Creative
Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0).
ultimate
network equals lots of fun and productivity
28
06
56 anoSound ONE
N
Hi-Fi DAC Case
The best of both worlds with a melding
of the excellent NanoSound DAC
57 Argon IR Remote
A sleek minimalist remote for your
Raspberry Pi media centre
58 LibreELEC 9.1
LibreELEC comes to Raspberry Pi 4 Is it
ready for prime time yet?
BU I L D T H E U LT I M AT E
MEDIA
CENTRE
Create the ultimate media box
using just a Raspberry Pi
R
aspberry Pi is capable of many things, and we’ve
built a lot of projects with one. Having several
Raspberry Pi computers performing similar
functions seemed a littler redundant to us, though,
which gave us a brainwave – what if we could combine
multiple uses into one amazing project?
Thus we decided to see how many media services we
could squeeze into just one Raspberry Pi 4. Luckily, the
majority of the tools are already available – you just
need to know how to combine them all. Get ready for
the perfected media experience.
Parts list
Everything you need to put together your ultimate media centre
REQUIRED OPTIONAL
Case (Argon One M.2)
£42 / $45 magpi.cc/argononem2
Ethernet cable
Raspberry Pi 4
£34 / $35 magpi.cc/raspberrypi4
Official Raspberry Pi
4 power supply
£8 / $10 magpi.cc/psu4 Raspberry Pi
TV HAT
£20 magpi.cc/tvhat
Game controllers
Wireless
keyboard
HDMI cable
Removable
USB storage
16GB
microSD
Flirc USB card
£20 / $23 magpi.cc/flircusb
PUT IT TOGETHER manual that comes with the Argon One shows
you how to add the daughterboard to Raspberry Pi
Install RetroPie
01 We’re using RetroPie. This software allows
and then install it into the case with some screws.
Follow these instructions, and keep the power
you to emulate several game systems, as well as button pins in the default position.
installing Kodi under it for video and music. You’ll
need to burn your microSD card manually for this
– we advise using Raspberry Pi Imager (download
Hook it up
it from magpi.cc/imager). It’s easy to use: click
‘Choose OS’, select RetroPie, then choose the
03 For first-time setup, we recommend
‘RPI 4/400’ version for Raspberry 4 and 400. Then connecting a USB keyboard, along with having it
click ‘Choose SD card’, select your microSD card. connected to a monitor instead of a TV for comfort
Finally, click ‘Write’. – however, connecting it to your
selected TV is also fine. If you
also plan to use a wired game If you want
controller, connecting it now to add an M.2
Install Raspberry Pi SSD drive for
02 We’re using the Argon One M.2 case for a
is also a good idea. The last
thing to connect should be
increased internal
storage, do
few reasons – it’s secure, it keeps your Raspberry the power supply. so now!
Pi cool, it can use a Nanosound DAC if that’s your
thing, and it routes all the inputs to the rear of the
case. Because it has all these bells and whistles, it
INITIAL SETUP
does take an extra step to install. The instruction
First boot
01 With a power supply plugged in and
switched on, press the power button on the back
of the case to boot up your Raspberry Pi. RetroPie
will do some initial automated setup stuff, then
ask you to configure your games controller
Raspberry Pi Imager makes it easy to install Press the relevant buttons to configure your games
RetroPie – choose the RPi 4/400 version controller; hold any button to skip a function
For troubleshooting
and tips on specific
controllers,
especially for Sony,
Microsoft, and
Nintendo consoles,
look at the docs:
retropie.org.uk/
docs
Select the Configure WiFi option from the RetroPie menu and enter your network details
Configure Kodi
Go beyond games to stream your own media files over a network
Install Kodi
01 Kodi is our preferred media centre software
overscan issues. Find them in the settings menu,
and be sure to give the name of the system an
for watching video and playing music, and you can update if you want to as well so you can identify it
install it to RetroPie. Once again from the RetroPie on your network.
menu, go to RetroPie Setup and then Manage
Packages, Optional Packages. From there you’ll be
able to install Kodi – although it may take a while.
Add networked sources
Once installed, you’ll find it in the Ports menu as
an option after a reboot.
03 The easiest way to access media (videos,
music, or pictures) over your local network is
to add them as media sources. Head back to the
settings meny from the top of the interface. From
Setup Kodi
02 Kodi will be automatically set up after
there, go to File Manager and select Add Source.
You’ll be able to browse your available networked
installation, however you may want to change machines, or alternatively write in
some settings, especially if you’re experiencing the SMB route if you know it.
To go back
to RetroPie from
within Kodi, go to the
shutdown menu from
Kodi (top left) and
choose ‘exit’
With the
settings configured
for the app, you’ll also
be able to control Kodi
from your browser. Find
out more here:
magpi.cc/kodiweb
Using IR remotes
The Flirc USB dongle allows you to program specific
media commands into itself from another computer
before plugging it into a media centre. You may
need a USB extender so it’s visible, though!
While it’s downloading to your desired device, The system uses Tvheadend to configure it all.
you’ll need to tell Kodi to allow you to use it. You’ll need to make sure you have a decent
From the Settings menu, go to Services and find amount of storage attached if you
the Control option. From this list, you want to turn plan to record TV.
the following options to ON: ‘Allow programs on
other systems to control Kodi’, ‘Allow control of
Kodi via HTTP’, and ‘Announce these services to
other systems’. A Raspberry
Pi TV HAT
Open the app and you should be able to select enables you
to watch and
the name you gave your Kodi setup from the list record digital
and immediately start controlling it. terrestrial TV
Essential add-ons
Get streaming services and TV running on Kodi for the full smart TV experience
Warning!
Unofficial Add-on
Check that Netflix
add-ons like this are
legal in your region.
Catch your
favourite Netflix
shows and movies
on Kodi using a
third-party source
INSTALL SPOTIFY
Spotify source
01 There isn’t an official Spotify app on Kodi,
so you’ll need to install from a third-party source
like with the Netflix add-on, although this one
you’ll need to transfer from another computer.
Install YouTube
Head to magpi.cc/spotifykodi on a computer and Unlike Spotify and Netflix, this one is a bit
easier – a YouTube app is available in the
download the zip file from the link under ‘Install
standard Add-ons list for Kodi! From the
with repository’. If you’re able to transfer it to
Add-ons menu, go to Download, Video
your media PC over the internet, do so, or load it Add-ons, and scroll down to YouTube.
to a USB stick and plug it into the media box we’ve Install it from there and it will live in the
been building. Add-ons menu from now on. Like the
other apps, you’ll have to use the standard
Kodi interface to navigate it.
Creating your own media server, media centre, HTPC, or whatever you
want to call the box under your TV has never been easier. We have a
comprehensive guide on how to create and optimise your perfect project.
14
www.dbooks.org
TUTORIAL
Ultimate home
Part 01
server: assemble
your equipment
Revolutionise your home network with shared storage, media serving,
network management, home automation and more. All in one tiny box!
PJ Evans
MAKER
PJ is a writer,
software engineer
and tinkerer. His
server has just told
him it’s time for
another coffee.
twitter.com/
mrpjevans
R
aspberry Pi also makes a great home protecting your data, you’ll need at least 4GB for
server. Why do you need a home server? it to work effectively. Then consider what the
Well, there’s all kinds of uses: file sharing, server will be doing. Serving files doesn’t require
protecting your network from dodgy advertisers, much effort and is well within the capabilities of
controlling your smart devices; the list goes on. In Raspberry Pi Zero, and we strongly recommend a
this new series, we’ll build a home server with all wired network connection.
You’ll Need the bells and whistles to inspire you to create your
own ultimate build, with plenty of ideas and tips
> Raspberry Pi 4
along the way.
magpi.cc/
Choose a case
raspberrypi4
02 Our Raspberry Pi 4 needs a good home
> Argon One M.2 case
Choose the right model
magpi.cc/
argononem2
01 It’s probably no surprise that we’re using
if it’s going to be a server. There’s no shortage
of cases available and if you’re lucky enough
a Raspberry Pi 4 with 8GB RAM model for our to have a 3D printer, many more designs are
> 1TB M.2 SATA
ultimate server. It’s the most powerful Raspberry available for download. Have a think about storage
SSD drive
magpi.cc/ Pi. However, you can go for lower memory sizes requirements such as additional disks or access to
wdbluem2 and get similar performance. If you’re interested USB or GPIO connectors. We’ve chosen the Argon
in using advanced file systems like ZFS for One case. Not only is it beautiful, it also features
passive cooling (as well as a fan) and support for 3B, and Compute Modules 3+ and 4. However, you
M.2 storage devices. As a server is intended to be will need to update the bootloader on these devices.
running 24/7, make sure your choice of case is well See magpi.cc/bootloader for info and instructions.
ventilated and will be placed where it can ‘breathe’.
Argon assemble!
Top Tip
Choose storage 05
03 The standard application for a server is file
Now we have the computer, case and storage,
it’s time to put them together. The Argon One
USB drives
sharing: the ability for anyone in your household to comes with a comprehensive installation guide. Add If you’re going for
access a library of files. If you’re thinking of a media the expansion board to bring all the connections mass storage and
server, consider carefully what type of storage to use to the rear of the case, then mount in the case as fancy adding an
array of drives,
and how much you need. Movies, especially in high- instructed, using the supplied thermal pads to
don’t forget a
definition formats, eat up a lot of space but don’t get a good connection between the board and the powered USB
require fast storage to play back reliably. We’re heatsink. Install your M.2 SSD drive in the lower hub to avoid
making use of the Argon One’s M.2 interface to add part of the case, then screw the two halves together. undervolting –
1TB of fast SSD-based storage, but you may prefer The M.2 SSD device is connected to Raspberry Pi 4 this can damage
one or more USB SSD drives. Using a microSD card using an external USB-to-USB bridge. your data
and hardware.
is still an option, but slower and less reliable.
The Argon One’s it’s ready to boot. As this is a server, we don’t need network. If you didn’t do this, set up your hostname
clever expansion
board brings all the a graphical user interface, so we can keep things by running sudo raspi-config from a Terminal.
connectors to the lightweight. Using Raspberry Pi Imager, select You can also set up networking here if you need to.
back and converts the
HDMI ports to full-size Raspberry Pi OS Lite and check out the advanced Update everything with:
menu (CTRL/CMD+SHIFT+X) to set things like
hostname and networking before burning the sudo apt update && sudo apt -y full-upgrade
image to the card. We are naming our hostname
‘ultimate’ so it is easy to find on the network.
We recommend placing
your server close to your
home broadband router
based on temperature. It will also allow the power
button to cleanly shut down after being pressed
for three seconds. To change these settings, run
argonone-config from the command line.
...where <name> is the username you would like ...where <name> is the username you created
(avoid spaces and special characters). It will ask previously. Now you can log into your server
you a few optional questions about your full name without a password using SSH:
and location. Finally, you can set a password
(be sensible!). ssh <name>@ultimate.local
To give the user ‘super user’ or ‘sudo’ rights: If your local username matches the server’s, you
don’t even need to include it or the ‘@’.
sudo adduser <name> sudo
To give the new user all the same permissions as the You’ve now got the basis for building a powerful
‘pi’ user: home server. In the following tutorial, we’ll move
on to the most useful aspect of any home server:
sudo usermod -a -G file sharing.
Ultimate home
Part 02
server: sharing
and storing files
Sharing and storing large files on your network equals lots
of fun and productivity without filling up your computer
PJ Evans
“H
MAKER
ave you got that file? Can you email it to available to us. It makes sense to choose a
PJ is a writer,
me?” “But it’s 10GB! It’s too big!” We’ve protocol that is supported by as many different
software engineer
and tinkerer. His all been there. If you’re in a house full of platforms as possible, such as Linux, Windows,
server needs to go data-hungry family members, or working in a small and macOS. The de facto standard is SMB (Server
on a diet. business where a single repository of information Message Block) and the software that implements
twitter.com/ would be enormously helpful, then a file-sharing SMB on Raspberry Pi OS is called Samba.
mrpjevans device (sometimes called ‘network-attached Installation is simple:
storage’ or NAS) is what you need. We’re going to
take the Argon M.2 Raspberry Pi server we have sudo apt -y update && sudo apt -y upgrade
built and add file sharing and increase disk capacity sudo apt install samba
so there’s plenty of room for all your stuff.
If you get asked a question about WINS, just
Choose the right model
Identify your drive
01 To create our ultimate file sharing device,
say no. After installation completes, you have a
running file server, but with nothing configured.
carefully before we need to install some file-sharing software.
removing and
creating partitions There are many different protocols and options
You’ll Need
Adding an external drive
> Raspberry Pi allows for massive storage Our operating system is stored
ultimate server
and easy upgrades on the hidden M.2 card
magpi.cc/108
DOWNLOAD
THE FULL CODE:
magpi.cc/uhssmbconf
Configure Samba
03 We need to tell Samba to share our
Take care to indent the code correctly. These
lines set up the most basic kind of sharing. Save
new directory. All the sharing settings and the file and exit the editor (CTRL+X), then restart
configuration options are stored in the file Samba so the new configuration is picked up.
/etc/samba/smb.conf, so open that up in an editor:
sudo systemctl restart smbd
sudo nano /etc/samba/smb.conf
• Raspberry Pi Desktop: Open the File Manager, click ‘Go’ in the menu bar, Configure your users
click ‘Network’, select ‘ULTIMATE’ (or whatever you named your server), 04 Security constraints mean Samba cannot
click the ‘Shared’ directory, and enter your credentials (leave the domain
as WORKGROUP). check your password when you connect. To
• macOS: Open Finder, click on ‘Network’ on the sidebar, select ‘ULTIMATE’ mitigate this, you can set an additional password
(or whatever you named your server), click ‘Connect As…’, then enter your for Samba access. This can be the same as your
username and Samba password. Click ‘Shared’. regular password for something different. To add
• Windows: Open File Explorer and right-click on ‘This PC’, then select ‘Add a your user account to Samba and set your access
network location’. You’ll go through a short wizard; when asked which server
password, just run the following command:
to connect to, enter \\ULTIMATE\Shared and enter your username and
Samba password.
sudo smbpasswd -a <user>
...Where <user> is your current username or any command (assuming your external drive’s logical
other username that needs Samba permissions. name is /dev/sdb): Top Tip
Enter your new password twice and you’re ready
to go. sudo fdisk /dev/sdb RAID
FDISK is a utility for managing your disk’s partitions Did you know you
- the areas where data can be stored. can use multiple
disks to provide
Get yourself connected
05 Samba is now ready for use. You can also
Now complete the following steps (note that
this will erase any data on the disk). Repeatedly
protection against
drive failure?
mount shared drives from the command line in enter ‘d’ followed by RETURN to delete any current RAID is a system
Raspberry Pi OS using smbmount, or connect to partitions until you get a ‘no partition’ error. Enter for keeping two
your Raspberry Pi from another computer on your ‘n’ followed by RETURN to create the new partition, or more drives in
network – see ‘Getting connected’. accepting all the defaults. Enter ‘w’ to write the constant sync, so if
one fails, the other
changes to the disk and exit
has your data!
sudo fdisk -l
smb.conf (part 2)
> Language: Config / Bash
001. [Huge]
002. comment = Huge
003. path = /mnt/huge
004. read only = no
005. browsable = yes
DOWNLOAD UUID=c13507ef-190d-400d-9fc0-96f7cedea521
THE FULL CODE: /mnt/huge ext4 rw,user,auto 0 0
magpi.cc/uhssmbconf2
This is an example UUID: Make sure everything
after UUID= is the UUID of your new drive. Save and
reboot. Your drive should be automatically mounted.
Our server connected system. The first step is to create an ‘endpoint’: a
to an external drive
folder that will act as the gateway to the new disk.
The normal directory to use for this is ‘mnt’. To access your fancy
Top Tip sudo mkdir /mnt/huge new drive, you need to
Data danger! You don’t have to call it ‘huge’ – use any name you
‘mount’ it
like. You only have to do this once; the folder will
Using FDISK and
persist like any other.
MKFS can cause
data loss. Check
To mount the drive:
Share the disk
all your device
logical names are sudo mount -t ext4 /dev/sdb1 /mnt/huge
12 The final step is to let Samba know about our
correct and that new disk. Set the permissions and edit the Samba
there’s no data on That’s it. Any files written into that folder will be config file as we did earlier:
the disk that you
placed on our new disk. To unmount:
need to keep.
sudo chmod -R 777 /mnt/huge
sudo umount /mnt/huge sudo nano /etc/samba/smb.conf
At the bottom of the file, add a new line and add the
contents of the smb.conf (part 2) listing. Save the
file and exit (CTRL+X). You can now restart Samba
Automount on boot
11 The problem with the mount command is
to start the share without rebooting:
that it will not persist after a reboot. You can add sudo systemctl restart smbd
a mount command to something like rc.local, but
the best way to deal with this is to add the drive to Now try mapping from a remote device. All being
the file system table (fstab). This is a dangerous well, you now have a huge amount of storage at
step as a misconfigured fstab can make your your disposal.
Raspberry Pi unbootable. First, get the UUID of
your new drive. Run this command:
We’ve now got our server sharing files across your
sudo blkid network. So, what else can you do with an always-
on device? In the next tutorial we’ll look at one of
Find the line containing our new drive (/dev/sdb) the most popular applications: media streaming.
and copy the list of numbers and letters quoted in
UUID=“”. Now edit the table:
Ultimate home
Part 03
PJ Evans
MAKER
PJ is a writer,
software engineer,
and tinkerer. His
ambient music
collection has
been described
as “inspiring” (PJ
Create as many Plex provides a beautiful
Evans) and “just libraries as you like playback experience and
a load of random by dividing media won’t say a word about
noise” (Mrs Evans, into directories your musical taste
music teacher).
twitter.com/
mrpjevans
S
ound and vision is where we’re at for our on startup. Reboot and then issue this one simple
ultimate server project in this tutorial. Sure, command in the terminal:
serving files is all very well (see the previous
tutorial) but what about a decent media interface? df -h
Luckily we’re spoilt for choice. We’re going to add
two media serving solutions, Plex and Mopidy, to our The ‘df’ command is short for ‘disk free’ and
server. Plex is a great choice for playing back your shows you a summary of disk usage. If all is well,
media anywhere in the world and Mopidy can turn you’ll see the external drive (partition sdb1) mounted
your server into a jukebox as well as a multi-room to /mnt/huge (or whatever you decided to call the
audio streaming system. We’ll also look at how to mount point). If /mnt/huge does not appear in the
create your file structure and how to add content list, refer back to the previous tutorial and make sure
You’ll Need from different sources. Let’s hit the play button. the entry in /etc/fstab is correct.
> Raspberry Pi
ultimate server
magpi.cc/108
Check, check, and check again Set up your library
> Plex magpi.cc/plex 01 Before we plunge into the world of media
02 Media streaming tends to involve a lot of
> Mopidy streaming, let’s make sure your ultimate server is files. Before you find yourself in a mess, take some
magpi.cc/mopidy correctly configured as per the previous tutorial. time to consider how you would like to structure
We want to be sure our external drive is mounting all your media. How you do this is up to you, but
Top Tip completely up to you. video podcasts. You can also use plug-ins to access
all of YouTube. Of course, if you have a collection of
home movies, it’s a great way to get them up on the
Quickly copy big screen.
your media Add some sounds
03 Now we have lots of fast USB 3.0 space to
Moving a lot of
media files over play with, we can add some media that we’d like to
Let’s Plex!
the network can
be very time-
stream. This is a massive topic in itself, so we’ll just
give you some pointers here. You can now legally
05 We’re going to install Plex, one of the most
consuming. Luckily, buy MP3s from many sources such as Amazon and popular media streaming services available. It
our USB drive
Apple. These are free from DRM (Digital Rights supports a dizzying array of file formats for both
can be mounted
Management), meaning you can play them back on audio and video. Plus, clever built-in transcoding
onto the source
machine for super- your Raspberry Pi media system without issues. If systems mean it can compress on-the-fly to ensure
fast copying. the smoothest of playbacks. All with a very friendly,
Remember, the good-looking user interface. Installation takes a few
host operating Figure 1 steps, so follow the commands in the install_plex.sh
system will need listing to add Plex’s repository, update, and then
a driver that
install and configure Plex. Once complete, we can
can understand
ext4 partitions. check Plex is running using this command:
First-time Plexing
06 When we installed Plex, it started a web
server on port 32400. So all you need to do is open a
web browser on another machine (or the server itself
if you’ve installed a desktop) and go to:
http://ultimate.local:32400/web
Initial setup
07 Plex will take you through a short wizard to
get things set up. Start by giving your Plex server
a name; we’ve chosen ‘ultimate’ to be consistent.
You can also opt for access to your Plex library from
anywhere on the internet. Plex will attempt to open
a port on our home router so you can access your
media from the plex.tv website. If you don’t want
to do this, ensure the checkbox is clear. Click ‘Next’
to start adding your libraries. One-by-one, select a
library ‘type’ (music, movies, etc.) when navigating
to the corresponding folder on your external drive;
e.g. for ‘Music’, use /mnt/huge/Media/Music.
Once Plex is installed,
Streaming to headless devices
10 One restriction of Plex is that it requires
you need to add
each directory and
specify what type of
a device with some kind of interface to work and media it contains
Library management
08 Plex will now start scanning your folders for
plays audio to that interface. If we wanted to play
audio on the ultimate server itself, or stream to
content. It will also access online databases to add another Raspberry Pi computer that is connected to
metadata to its library to make your collection as speakers, we need to use Mopidy, a purpose-built
complete as possible. Depending on the size of your audio streaming solution. Luckily, Plex and Mopidy
collection, this process will take anywhere between can live side-by-side and even share libraries. To
seconds and hours. It’s a background process though, install Mopidy and its user interface, Iris, follow the
so you can start using Plex right away as your media commands in the install_mopidy.sh listing. Once
appears. You’ll also notice that Plex will also offer complete, you can access the user interface here:
you online content – you can disable this if you wish
or sign up for a ‘Plex Pass’ for a lot more features. If http://ultimate.local:6680/iris/
you don’t like what Plex has ‘found’ for your media
types, you can always click the pen icon and edit the
metadata; Plex doesn’t always get it right.
install_plex.sh DOWNLOAD
THE FULL CODE:
> Language: Bash magpi.cc/installplexsh
Access it anywhere
09 One of the great things about Plex is the 001. #!/bin/sh
002.
availability of its client applications. Not only is there
003. # Plex's repository uses HTTPS as the transport, so we need to
a rock-solid web-based interface (which works great install support
on Raspberry Pi OS’s Chromium) but support for a 004. sudo apt update
wide range of devices including PlayStation, Xbox, 005. sudo apt install apt-transport-https ca-certificates curl
Apple TV, Amazon Fire devices – and for mobile, iOS 006.
007. # Get Plex's public key and add the Plex repo
and Android. If you created an account earlier, all you
008. curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt
have to do is install the app and log in. Your ultimate key add -
server will be detected and added. Now you can 009. echo deb https://downloads.plex.tv/repo/deb public main | sudo
access and stream your media collection from any tee /etc/apt/sources.list.d/plexmediaserver.list
location on the internet.
010. # Install the server
011. sudo apt update
012. sudo apt install plexmediaserver
Mopidy is an
alternative to Plex,
designed for
local playback
and streaming
Warning!
Adding media to Mopidy
The laws covering the
ripping of CDs, DVDs
11 In the previous step we installed the
Add the following at the end of the file:
and Blu-rays vary from ‘local’ plugin, which allows Mopidy to access local [local]
country to country.
The private copying of file systems for media. One restriction is that it can media_dir = /mnt/huge/Media/Music
copyrighted material only support a single directory. Start by editing the
is illegal in the United
Kingdom. Check what config file: Remember to change this path if you’re using a
you want to do is legal different naming system or structure. Save the file
before proceeding!
sudo nano /etc/mopidy/mopidy.conf (CTRL+X), and instruct Mopidy to scan the contents,
magpi.cc/ripping
then restart:
Ultimate home
Part 04
server: enhance
your network
Make your ultimate server a network genie with these apps
I
n the previous parts of this tutorial, we’ve forward. The easiest way to do this is to ask your
PJ Evans taken a Raspberry Pi 4 and turned it into a router to reserve an IP address for your ultimate
MAKER
file sharing, media streaming powerhouse. server. We recommend you look at doing this
PJ is a writer, Next we’re taking on your network. There are before proceeding. Sorry for the vagueness, but
software developer
so many ways to enhance your home (or office) every router does this differently.
and tinkerer. His
server has just told network that we can’t hope to fit them into a few
him it’s time for pages. However, these steps will point you in the
lunch. This might be right direction and hopefully inspire you to make
getting out of hand.
Home control the easy way
twitter.com/
your home network smarter, faster, and more
convenient to use. Follow along and we’ll automate
02 Want to automate your home? Fancy being
mrpjevans
your home, allow you to access your data securely able to control lights or check a home webcam
from anywhere in the world, and automatically from anywhere in the world? How about if that
protect you from nefarious websites. software cost you absolutely nothing? Home
Assistant is an incredible package that integrates
a wide range of inexpensive smart devices such as
Philips Hue, Ikea Trädfri, and many more. Best of
Settle on an address
01 A key aspect for any server is that you
all, it’s open enough that you can create your own
activities and integrate your own projects relatively
should know where it is. It seems obvious, but easily. Installation on an existing server requires
a typical home network will assign IP addresses a few steps, but a great guide has been written by
dynamically (a system known as DHCP) and the HA team – magpi.cc/hacore – that we have
there’s a fair chance they will change from time summarised here: magpi.cc/hasummary.
Home Assistant can
control hundreds to time. We normally get around this by using
of IoT devices
zero-config domain names like ‘.local’, but we’re
with customisable
dashboards like this going to need a set IP address for our server going
Getting started with
03 Home Assistant
The first time you run Home Assistant, it’ll take
a few minutes or so to get its act together as it
installs everything it needs. HA will also scan
your network for any existing devices you have.
Once running, you can access the dashboard at
http://ultimate.local:8123 (change the name if
you didn’t call your server ‘ultimate’). You may
be surprised to see what is already detected and
available. If not, there are hundreds of plug-ins
to extend HA’s capabilities. Home Assistant is a
massive topic, so you may want to have a read of
our tutorial in The MagPi #99 (magpi.cc/99).
A virtual private network) that you can connect to securely from a port mapping. Your router needs to forward all
network such as
Wireguard creates a anywhere in the world. Previously PiVPN only traffic to port 51820 (default) over UDP to your
secure encrypted link supported OpenVPN, which can be difficult to server. How to do this varies from router to router,
to your home devices
from anywhere work with, but now the much simpler Wireguard so search for your particular router’s instructions.
protocol is supported. To create users that can access the network,
run this command:
07 For lots of information on PiVPN and Give a username when prompted and a config file
Building
your Home Wireguard, head over to The PiVPN Project at will be created. Copy that config file to the device
Assistant pivpn.io. To get started with installation, run the you want to use to access the network and import
setup following command from a Terminal: it using the free Wireguard client software. Now
you can access your home network from a laptop
The Home curl -L https://install.pivpn.io | bash or smartphone from anywhere in the world.
Assistant
community
maintains a list of The installer will take you through a series of
compatible smart questions. An important point is to ensure you
Add a web server
devices. These
either work ’out
have a static IP address as your router will need
to know where to find your Wireguard server.
09 The fun thing about web servers is they
of the box’ or with When asked what type of server to install, are actually very simple things. You can place
a free plug‑in:
answer ‘Wireguard’. Continue through the a text file in the home directory and the server
magpi.cc/
installer, accepting the default answers. If you will happily serve it anywhere in the world. If
haplugin
don’t have a static IP address for your router, you you would like to be able to access files through
may need to consider a dynamic DNS service such a web browser, you can combine Wireguard and a
as DynDNS (account.dyn.com) so you can easily web server to make access both easy and secure.
reach your Wireguard service. As an example, we’re going to configure access
to the media library we have previously created.
First, install a web server:
Using Wireguard
08 Before you can use Wireguard to get secure
sudo apt install apache2
remote access to your network, you need to allow After that single line, you would be able to access
the internet to ‘see’ it. This is done by creating a simple welcome page at http://ultimate.local.
Adding directories to
10 your web server
It has a maintained blacklist of DNS servers
that are for advertising and intercepts any such
What a web server can provide you with is only requests. To do this, Pi-hole must be your DNS
limited by imagination. Let’s get simple access server. Here things get complicated. For best
to our music and videos, which are stored in results, your new Pi-hole server should also
/mnt/huge/Media. Apache has a complex be your network DHCP server (the server that
configuration system, but we’re going to play a allocates IP addresses to your local devices). This
little UNIX trick to make things easier: a symbolic requires some additional setup and we recommend
link. This allows us to map one part of the file you have a read of The MagPi #104 (magpi.cc/104).
system to another, creating a kind of short cut.
Ultimate home
Part 05
server: Backup
and UPS
Now you have the ultimate server, let’s keep your
data safe with an uninterruptable power supply
PJ Evans
MAKER
I
PJ is a writer, f you’ve been following our home server We’re going to cover the three key pillars of
software developer
tutorials over the past months, you should server management: Backup, Reliability, and
and tinkerer. He
keeps several clones now have a pretty sweet Raspberry Pi- Monitoring. Luckily, these are not hard to achieve,
of himself in storage powered server up and running, with file even for a home setup, and you never know: there
just in case. sharing, media streaming, remote access, may come a day when you’re really glad you took
twitter.com/ and more. In this final part of our Ultimate the time to protect your investment.
mrpjevans Server tutorial, we’re going to look at protecting
both your hard work and all that data you have
entrusted to our favourite little computer.
Don’t be that person
RAID systems,
01 When you’ve completed a project like this,
like this RAID 10
it’s tempting to stop now and enjoy the fruits of
configuration,
protect against disk your labour. Sadly, the annals of computer history
failure and service
interruption by are filled with stories of those who did not heed the
duplicating data over warnings and didn’t back up. It’s caused heartbreak
multiple disks
when families have lost their photo libraries
and bankruptcy when companies have lost their
precious customer data. Never trust your data to one
single source, no matter how much you’ve spent, or
the reputation of the supplier. Think carefully about
how to keep your data safe, not only from hardware
or software failure, but also theft and disaster.
You need three copies of accident, you’ll be holding a parade through the
You’ll Need
streets when you realise you’ve got that data safe
your data, on at least two and sound on the second drive. All you need to
> Raspberry Pi
do is set up a regular backup routine to copy the
different media types contents of your first drive to the second.
Ultimate Server
(The MagPi issue
#107 to #110)
much work. What needs to be done is twofold: make magpi.cc/issues
sure the data is available elsewhere and that if you > Uninterruptible
Quick and easy backup power supply
delete a file, you can get it back.
04 Assuming you’re adding an identical USB (optional)
drive to your server, make sure you’ve partitioned > Additional USB 3.0
and formatted the drive identically to the original. external hard disks
(optional)
A local drive for local data
03 Let’s start with a very simple way of
See tutorial part 1 for details on how to do this.
Next, do an initial backup to ensure everything is
backing up your data. We connected a 4TB drive OK. This may take some time, depending on how
to our ultimate server for all our lovely files. much data you have. If your first disk is mounted to
The easiest thing to do is to double it so we can /mnt/huge and your new disk is /mnt/backup, the
mirror that data. Adding a second 4TB drive may command would be:
sound expensive for little benefit, but when your
original drive fails or you delete a critical file by sudo rsync -av /mnt/huge /mnt/backup
Time Machine
Not only can you Introducing iDrive
back up your 06 If you want to keep things easy, we can
ultimate server, but
recommend iDrive (idrive.com) as a contender. Not
it can back up your
only do they offer very attractive first-year terms:
Mac as well. Make
your file shares they are one of the few off-site backup companies
Time Machine- to offer full Linux (i.e. Raspberry Pi OS) support.
compatible by Although you’ll need to do some navigation of
following these Rsync will only copy changes, so it’s faster after the command line, you can install the iDrive tools
instructions:
the initial backup. To run this on a regular basis, and create a destination and a backup-set in a
magpi.cc/
add it to crontab (a schedule of regular jobs): surprisingly short amount of time. If you have a
timemachinegit
lot of data, the first backup may take some time,
sudo nano /etc/crontab but iDrive can throttle the bandwidth used. Once
uploaded, a regular incremental backup keeps you
Add this line at the end: up to date. Best of all, deleted files and different
versions of files can be archived.
1 12 * * * root rsync -av /mnt/huge /mnt/
backup > /var/log/backup.txt 2>&1
Home Assistant
The amazing rclone
can monitor your
server and your UPS,
This will run the backup every night at one minute
past twelve. You can change it to any time or to be
07 There are many services available that
triggering alerts
when necessary as (in)frequent as you like. offer some form of ‘block’ or ‘bucket’ storage.
Most popular is Amazon S3, but there are a
growing number of contenders such as BackBlaze
B2, Box, or Digital Ocean Spaces. Working out
how to communicate with all these can be a
challenge, but luckily rClone (rclone.org) knows
how to talk to over 40 different services. Sign up
for the service you want, get your credentials,
and configure rClone using its menus. Although
trickier to configure than iDrive, this can be a
very cheap way of backing up in the long term.
Top Tip
Redundancy is a good thing Let it grow Remote
10 Another aspect of good server management
12 Nothing we have discussed here prevents Monitoring
is availability. If you have all your cool data on the your server from growing in the future. Modern
If you want to
server, you want to make sure it can handle failure RAID systems such as Z2 allow you to increase
monitor your
and keep going. Although the two-drive system disk capacity with no downtime. Using load- server from afar
will prevent data loss, it’s going to be a pain to balancing software such as Varnish means and have exposed
reconfigure everything. For a truly robust system, you can add in more servers, or replace failed a web server
you need a redundant array of inexpensive disks hardware, without anyone noticing. You’re free to the internet,
(RAID). This is a file system that allows a number to add more software and features whenever you services such as
uptimerobot.com
of disks to operate as one and can tolerate at want. As for off-site data storage, there really
will alert you if
least one drive failure. You can then replace the are no practical limits. Any time you need to
they can
drive and have the data protected again with no boost your hardware, it’s possible to do it with no no longer reach
downtime at all. The ZFS file system is especially interruption, again and again, truly making it the your site.
good at this. ultimate server.
www.dbooks.org
TUTORIAL
Ultimate home
Part 01
T
he ability to play music throughout your powered by a single connector. You can also use
home, in perfect sync and controllable two power supplies if you prefer. Mount the DAC
PJ Evans from your phone, has been around HAT on the GPIO pins and secure. We used 20 mm
MAKER
for a few years now. Many solutions are 2.5M screws to secure the HAT to the computer
PJ is a writer, available, from simple Bluetooth speakers and screen controller standoffs. Connect the
software engineer,
to high-end systems like Sonos. Often the 5 V and GND pins for the touchscreen to their
and lover of open-
source software. It’s price can be off‑putting and there has been partners on the DAC HAT.
his turn to choose recent controversy over the closed nature of
the next track, thank these systems. Can we build a whole-house
you very much.
audio system using nothing but open-source
@mrpjevans Prepare Raspberry Pi OS
technology and our favourite little computer?
This month, we’ll start by building a dedicated
02 The case prevents access to the microSD
music-playback station that can produce card, so make sure you’ve got a basic setup of
audiophile-level sound and web-based control. Raspberry Pi OS before assembling everything. For
this project we’re going to be using Chromium,
so we need the ‘standard’ OS image with Desktop
(but we don’t need the Recommended Software
Hardware assembly
01 The JustBoom DAC (digital-to-analogue
version). Burn this image with your preferred
method and make sure you’re connected to the
converter) HAT provides high-quality audio network with SSH enabled, or hook up a mouse and
output for our project. It also blocks the GPIO keyboard if you prefer. Finally, as ever, make sure
header, which we need to power the touchscreen. you’re running the latest version of everything
Luckily, the HAT has a GPIO breakout, so we with sudo apt update && sudo apt upgrade.
soldered a two-pin header to the 5 V and GND
for the touchscreen so the whole system can be
That last line flips the screen if you’ve found, as Now install Mopidy and set its user’s permissions:
we did, that the touchscreen display is now upside
down. Reboot your Raspberry Pi computer and sudo apt install mopidy
from the command line, test audio output: sudo adduser mopidy video
You should hear a calm voice say ‘front centre’. sudo systemctl enable mopidy
[local]
Install the UI & file support
The DAC HAT
provides high-
07 Next, we’re going to install Iris, a user
media_dir = /home/pi/Music
resolution output interface, and support for playing music stored on Restart Mopidy to pick up the configuration
at line level. You
can swap this with the local system. Run these commands: changes and then initiate the first music scan:
an amplifier HAT
and use passive
speakers instead sudo pip3 install Mopidy-Iris sudo mopidyctl local scan
Kiosk mode
09 DOWNLOAD
To get Iris running on the touchscreen, we
can make Chromium run in ‘kiosk’ mode so that no
kiosk.sh THE FULL CODE:
other elements of Raspberry Pi OS Desktop can be
seen. The first step is to install ‘unclutter’, a handy > Language: Bash/Shell magpi.cc/iriskiosk
app for hiding the mouse pointer when not in use.
001. #!/bin/bash
sudo apt install unclutter 002. unclutter -idle 0.5 -root &
003. sed -i 's/"exited_cleanly":false/"exited_cleanly":true/'
Now we’ll create a script to launch Chromium with /home/pi/.config/chromium/Default/Preferences
all the correct settings: 004. sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/'
/home/pi/.config/chromium/Default/Preferences
nano ~/kiosk.sh 005. /usr/bin/chromium-browser --noerrdialogs
--disable-infobars --kiosk http://127.0.0.1:6680/iris &
Add the code shown in the listing. When run, this
will enable cursor hiding, prevent some Chromium
error messages from being displayed, and then @/home/pi/kiosk.sh
start Chromium in kiosk mode, going directly to
the Iris website in full-screen. Save the file and reboot your system. The desktop
will appear and then Iris will boot full-screen. Your
touchscreen music system is now ready for use. You
can control everything from either the touchscreen,
Implement the kiosk script
10 Before we can use the script, it needs to be
a web browser on any device, or your smartphone.
flagged as an executable:
All being well, Iris should start full-screen and be sudo apt install abcde
controllable by touch. We recommend going into
settings and enabling ‘Wide scrollbars’ to make it Hook up a CD drive to the USB port, insert a CD,
easier to control with fingers. You can also choose and enter this:
between light and dark themes, the darker theme
being a little kinder on the eyes when used with abcde -o flac
the touchscreen.
Abcde will guide you through the whole process,
including automatically naming the tracks. Place
the resulting directory in your Music directory and
Run on boot
11 The final step for our music system is to
go to Settings in Iris to initiate a rescan.
Ultimate home
Part 02
music: services
Extend the capabilities of your music system with
Mopidy extensions and access a world of audio
P
reviously, we built a standalone music
server using a DAC (digital-to-analogue
PJ Evans converter) HAT, Mopidy, Iris, and a
MAKER
so it’s worth explaining how it’s formatted. Each Cut and paste this into /etc/mopidy/mopidy.conf
extension is named ‘Mopidy-Extension’. In the and add your Spotify username and password. See Top Tip
config file located at /etc/mopidy/mopidy.conf, the code listing overleaf for an example.
Extension becomes [extension] and any relevant Now restart Mopidy: Lossless or
options go underneath that line in the form ‘key = lossy?
value’. For example: sudo systemctl restart mopidy
Lossless (FLAC)
compresses audio
[local] Go back to Iris and the world of Spotify is literally
with no loss of
media_dir = /home/pi/Music at your fingertips.
quality. Lossy
(Ogg Vorbis, MP3)
We’ve provided an example config file to help removes audio
make sure things are properly set up. information to
Radio waves produce smaller
05 How about adding radio stations to your file sizes.
We now need to authorise Mopidy to use your sudo apt install mopidy-tunein
account by visiting magpi.cc/mpdyspotify. Once sudo pip3 install Mopidy-RadioNet
you’re authorised, a config file will be displayed. sudo systemctl restart mopidy
Now you can use Browse to find your favourite You can browse
show and listen on demand.
SoundCloud’s vast
collection from Mopidy
SomaFM
07 YouTube
SomaFM was one of the early pioneers
of internet audio streaming. Working through
09 The ubiquitous YouTube contains countless
a donations model, it has expanded to over 30 hours of audio-specific content. Either listen to
channels, all with the theme of ambience but one of the many audio recordings uploaded or just
covering different genres from electronica to jazz. the soundtrack of a favourite video. Again, the
Often SomaFM makes for perfect background standard installation pattern applies:
music. To add SomaFM to Mopidy (you’ve probably
spotted a pattern emerging by now): sudo pip3 install Mopidy-YouTube
sudo systemctl restart mopidy
sudo pip3 install Mopidy-SomaFM
sudo systemctl restart mopidy One difference with this extension is the need to
specifically enable it in /etc/mopidy/mopidy.conf.
Make sure this is in the file or YouTube files will
not appear in search results:
[youtube]
enabled = true
mopidy.conf DOWNLOAD
THE FULL CODE:
> Language: Config file magpi.cc/modipyconf
001. [http]
002. # Make sure the web interface can be accessed by the
Mopidy-Party lets your friends choose the music, which
local network
may or may not be a good thing 003. hostname = 0.0.0.0
004.
catalogue of Grateful Dead recordings! You can 005. [audio]
access all of these from your Mopidy system: 006. # Direct audio to the DAC, not HDMI
007. output = alsasink
sudo pip3 install Mopidy-InternetArchive 008.
sudo systemctl restart mopidy 009. # The File extension isn't of much use, so we can disable it
010. [file]
We recommend using the ‘Browse’ feature of 011. enabled = false
Iris to navigate this resource. Search results can 012.
be overwhelming! 013. # If enabled, this adds support for M3U playlists
014. [m3u]
015. enabled = false
016.
Party time, excellent! 017. # Location of local music
11 You now have access to a mind-boggling 018. [local]
array of music and audio. Time to celebrate. We’ve 019. media_dir = /home/pi/Music
been using Iris as our interface to Mopidy, but in 020.
fact you can install different interfaces and even 021. # Replace with the information given when you authorise
run them concurrently. If you’re having a few 022. # then add in you Spotify username and password
friends around, Mopidy-Party allows you to safely 023. [spotify]
give everyone access to your music collection from 024. username = <Spotify username>
their phones and add their picks to a playback 025. password = <Spotify password>
queue. Now, who put Showaddywaddy on? 026. client_id = <Client ID>
027. client_secret = <Client secret>
028.
029. # Getting to many results in TuneIn? Add this so you only
Make your own get stations.
12 Something missing from your collection? 030. [tunein]
Is there no access to the latest and greatest 031. filter = station
streaming service? If you’re handy with a bit of 032.
Python coding, then you’re free to make your own 033. # Once authorised, add the provided token here
Mopidy extensions and share them with users 034. [soundcloud]
all over the world. Not only have the Mopidy 035. auth_token = <Auth token>
developers provided detailed documentation at 036.
magpi.cc/mpdyext, they have also provided a 037. # Most extensions are enabled by default. You must
‘cookiecutter’ project at magpi.cc/mpdycookie explicitly enable YouTube.
which will get you up and running in no time. 038. [youtube]
Contributions to improve existing extensions are 039. enabled = true
also welcomed.
Ultimate home
Part 03
music: multi-room
You’ve built your music system and enhanced it with
streaming services, now let’s fill your home with sound
I
Going multi-room
n the previous two tutorials, we’ve built
and configured an all-singing, all-dancing,
01 Sure, playback from our Mopidy setup is
tricked-out music system using a Raspberry great, but you don’t want to be carrying that setup
PJ Evans
MAKER
Pi computer and Mopidy, the Python-based around the house. With Snapcast we can play music
extendable music server. We can listen to our anywhere in perfect sync, so you can wander around
PJ is a writer,
music in beautiful FLAC quality and stream from your home without interruption. This clever piece of
software engineer,
and now has a the worlds of Spotify, SoundCloud, and YouTube. open-source software sends out audio in ‘frames’,
house with too There’s one amazing feature that systems such as each one with a time code attached. Any device
many speakers. Sonos offer that we haven’t yet covered: multi- that’s part of the stream matches the frame’s time
@mrpjevans room audio. Not just playing music in different code to its own internal clock to ensure playback
rooms, but also playing in perfect sync. In this final happens at the same time, providing in-sync audio.
part, we’ll do just that and learn a few new Mopidy The only downside is a short delay in starting
tricks along the way. playback as everything syncs up.
You’ll Need
> Mopidy Music
System
Snap to it
02 Before we can add Snapcast clients, our
original Mopidy needs to become one itself, so it
can keep in sync with everything else. We start
by installing the Snapcast client and server on
the same machine (it’s effectively streaming to
itself). Enter the following on the command line to
download the client:
get https://github.com/badaix/
snapcast/releases/download/v0.20.0/
snapclient_0.20.0-1_armhf.deb
sudo dpkg -i snapclient_0.20.0-1_armhf.deb
Set me up
04 Iris comes with full control over the Top Tip
Snapcast system. After restarting Mopidy, go to
Choose your
the Iris interface and into Settings. You’ll see a
DAC
Snapcast icon. Click on it and then click ‘Enable’.
You should see a ‘Connected’ message appear. There are a wide
There will also be a group which represents your range of digital
local Mopidy setup. Click the group to rename it to audio convertors
something memorable. Before proceeding further, out there catering
make sure that playback still works. It’ll take a for every budget,
from £12 to
second or two longer to start as Snapcast syncs
thousands –
up, but should otherwise be unaffected. If it works choose wisely.
The addition of this purpose-built case not only
protects your project, but also adds a bit of class well, your local Mopidy setup is complete.
wget https://github.com/badaix/
snapcast/releases/download/v0.20.0/
snapclient_0.20.0-1_armhf.deb
sudo dpkg -i snapclient_0.20.0-1_armhf.deb
itself, which means it can play in sync with other sudo apt -f install
The case includes
access to the HDMI devices, so let’s add one. We’re using the HiFiBerry
and USB ports, so DAC+Zero, a great DAC for a small price. Start This will detect and install all the dependencies
you can connect a
touchscreen monitor by connecting the DAC to a Raspberry Pi Zero W, required and then finish configuration. Snapcast
and use it as a
Mopidy control centre
ideally using standoffs to ensure a secure fit. will be configured to automatically start on boot.
Install Raspberry Pi OS Lite on this device as we’re
You can use Iris on
any web device going to be running it headless. Using raspi-config,
to control which make sure you’ve configured WiFi and set a
group is listening to
which stream suitable hostname. Now update everything to the
latest version using:
Near the end of the file, find the line reading: sudo nano /etc/default/snapclient
stream = airplay:///shairport-sync?name=
Airplay&devicename=Jukebox
Reviews
When it comes to hardware and software, it can be tricky to figure
out what the best item for the job is. Let us show you some of the
best Raspberry Pi accessories that will help improve your
media centre project.
www.dbooks.org
REVIEW
DRIVE TYPE: Add a super-fast M.2 SATA SSD to Raspberry Pi 4 along with dual full-sized
M.2 SATA SSD
with Key-B or
Key-B&M
HDMI sockets, a power button, and fan cooling. By Lucy Hattersley
DISPLAY
T
PORTS: he Argon ONE M.2 case for Raspberry Pi 4 The aluminium alloy lid acts as a heatsink and
Dual full-size has been on the radar for many Raspberry a 30 mm fan provides active cooling. The fan
HDMI
Pi power users. We’re glad to report that is controlled via a script provided by Argon 40.
FEATURES: your anticipation has not gone unrewarded. Default settings start at 10% power when the CPU
UASP support, The marquee addition here is support for an temperature is at 55ºC, increasing to 55% at 60ºC,
power M.2 SATA SSD drive (the blade drives commonly and 100% at 65ºC.
management,
found in laptops). This sits snugly in a bottom
active and
passive cooling compartment and is connected to Raspberry Pi Putting it together
using the USB 3.0 connection (via a U-shaped Your M.2 SATA SSD clips into the lower part of
adapter). It features UASP (USB Attached SCSI the case and is held in place with a single screw.
Protocol) support to increase performance. The two halves are then screwed together and a
In the spirit of things, we tested it with a U-shaped USB adapter is used to bridge the lower
Raspberry Pi 4 8GB RAM and Raspberry Pi OS (64- part of the case the port on the upper part.
bit, magpi.cc/64bit). It’s an ingenious solution, but you lose a USB 3.0
An internal board repositions the ports to socket in the final build. More importantly, the
the rear, and converts the micro-HDMI ports of microSD card socket is sealed inside the case,
Raspberry Pi 4 to two full-sized HDMI sockets. requiring disassembly to access it.
GPIO remains accessible via a removable flap with Raspberry Pi EEPROM recently provided USB
a pin guide printed to the side. boot support in the default ‘critical’ firmware,
You get unrestrained time the board got a little more stressed, maxing
out at 73ºC – enough for the Argon fan to kick in
performance with an at 100% speed, but below the critical 80ºC point
where Raspberry Pi OS begins to throttle back the
overclocked Raspberry Pi 4 CPU speed.
So at all times you get unrestrained performance
coupled with an ultra-fast with an overclocked Raspberry Pi 4 coupled with an
ultra-fast SSD storage solution. If that’s not nifty,
SSD storage solution we don’t know what is.
We did also install Ubuntu, but we could not Verdict
Overjoyed with our SSD throughput rate, we set install the scripts for the fan in this case (as it
about testing CPU speed and thermal performance depends on GPIO Zero, magpi.cc/gpiozero), so the If you want to
take Raspberry
(the two are related as Raspberry Pi OS throttles fan was on permanently. Raspberry Pi OS remains
Pi 4 performance
performance if the CPU temperature exceeds 80°C). our preferred operating system at any rate. as far as it can
We performed a similar test to the one Gareth We spent a delightful couple of days knocking go, this is the
Halfacree uses when thermal-testing Raspberry Pi together the scripts for testing in Visual Studio way to do it.
10
boards (magpi.cc/thermaltesting). We ran stress- Code and creating graphs of the results in
ng and glxgears for ten minutes while monitoring LibreOffice, all while doing browser research and
/10
CPU speed and temperature recordings, followed writing up the results. Our Argon ONE M.2 build
by a five-minute cool-down period. remained a joy to use throughout.
Flirc Raspberry Pi 4
Flirc £16 / $16
SPECS
DIMENSIONS:
66×91×25 mm Stylish and clever case with a body that becomes
CASE: a heat sink. By Lucy Hattersley
Aluminium
W
housing
e see a lot of cases here at The MagPi, Flirc claims that this is “the most beautifully
FEATURES: but the Flirc Raspberry Pi 4 case came crafted Raspberry Pi 4 case” and it’s not a wholly
Built-in
recommended to us via Raspberry Pi’s unwarranted claim. It certainly has a sense of
heat sink
engineering team, so we had to take a look. style. Everything is neatly constructed from high-
The Flirc Raspberry Pi 4 case comes in two quality materials and there’s considerable charm
halves: the bottom is a soft-touch plastic shell, to the heat sink. The microSD card slot is easily
and the top half is milled aluminium coated with accessible, and a small cut-out on the enclosure
more soft-touch. The result is a stylish and lovely- enables the LEDs to shine through.
to-hold case made from solid metal.
Here’s where things get clever: inside the case On the box
is a protruding heat sink that reaches down to One downside to the sealed approach is that the
Raspberry Pi 4’s CPU. This turns the whole of the GPIO pins are hidden away inside the case. Unlike
aluminium case into a giant heat sink, cooling
down your Raspberry Pi 4. to provide access to the pins.
Inside the pack is a square thermal pad (similar To Flirc’s credit, it has addressed this issue via a
in substance to Blu Tack). You use this to squidge small gap on the underneath of the Flirc Raspberry
the Raspberry Pi to the heat sink. Putting together Pi 4 case, which could be used with a breakout I/O
Warning!
the case is ludicrously simple: you simply drop a cable. But it’s an ungainly addition to such a lovely
Using stress should only Raspberry Pi in the bottom half, attach the thermal looking case.
be done for short periods.
Watch your Raspberry Pi
paste, squidge down the lid, and use four screws to If you plan to use Raspberry Pi as a desktop
and restart afterwards. hold everything together.
8
case to get.
/10
Flirc Raspberry Pi 4 magpi.cc 55
REVIEW
NanoSound ONE
Hi-Fi DAC Case
Nanomesher magpi.cc/nanosound1 £59 / $80
SPECS
Combine the best of both worlds with a melding of the excellent NanoSound CHIP:
Texas
DACs and the Argon ONE case. Rob Zwetsloot grabs his listenin’ ears Instruments
PCM5122
SAMPLE
I
t’s no secret that we’re big fans of the The whole process is very quick, and we were RATE:
Argon ONE cases – they’re fantastic for able to experience some excellent sounds from the 192 kHz
keeping your Raspberry Pi cool, they look DAC part in no time, which uses the same tech as
RESOLUTION:
great, and they have neat features like GPIO pins the NanoSound DAC 2. You’re paying a little bit
24-bit
under a magnetic lid and all the ports rearranged of a premium for the DAC and case together (only
to the rear. We’re also a fan of the NanoSound about $5), but you are getting a custom version SIGNAL-TO-
DACs, so we were quite intrigued when we found of one of our favourite cases – so it’s definitely NOISE RATIO:
out about a melding of the two into one product: worth it. 112 dB
9
The standard piece just encloses the whole thing
and provides an SD card port, while there’s also
/10
the M.2 SSD storage bay option which we reviewed
last month.
Argon IR Remote
Argon40 magpi.cc/argonir £9 / $10
Looking for a sleek minimalist remote for your Raspberry Pi media centre?
PJ Evans sits back on his sofa and gets clicking
U
sing a Raspberry Pi 4 as a media centre reasonable £9 is a minimalist, slim remote with
SPECS
makes for a brilliant way to access just enough to make controlling Kodi a breeze.
your favourite sounds and movies. Add Basic directional control, selection, volume, and
DIMENSIONS: Argon40’s sleek ONE case and it looks as good, if standard navigation work alongside a power button
150 mm × 35 mm not better, as any other set-top box. There’s even that works out-of-the box with any Raspberry Pi 4,
× 10 mm
mature software in the form of the LibreELEC regardless of operating system. It’s light too, at
POWER: operating system and Kodi media centre app. All just 65 g with two AAA batteries.
2 × AAA batteries
that’s missing is an easy way to control the action.
COMMUNICATION: The eagle-eyed may have noticed the ONE case’s More than media
Infrared circuitry includes an IR sensor, and now Argon40 If media centres are not your thing, or you have
HARDWARE has made the companion Argon IR infrared remote other epic plans for a remote control, Argon40
COMPATIBILITY: control available. provides software that allows you to assign any
Argon ONE & Thankfully, Argon40 has been watching key press to a button using the standard LIRC
EON cases
other tech design teams rather than those of library with ease, making the addition of IR remote
SOFTWARE most modern TVs. What you get for your very control to your project easier than ever before. In
COMPATIBILITY: our tests, this worked flawlessly. However, we did
LibreELEC or
have some issues configuring Kodi due to some
Raspberry Pi OS
missing steps in the supplied instructions. Once
resolved, the remote performed admirably from
across the room.
9 /10 The lack of extraneous buttons and a small form factor make the
Argon IR comfortable to hold and use
You’ll need an Argon ONE case (or the forthcoming
EON) to use the Argon IR
KODI VERSION:
18.3 ‘Leia’
LibreELEC comes to Raspberry Pi 4. Rob Zwetsloot
COMPATIBILITY:
tests it out to see if it’s ready for prime time yet
All Raspberry Pi
versions
INSTALLATION:
Graphical wizard
or burnable
image
IMAGE SIZE:
129MB
Y
ou could easily argue that Raspberry Pi was
already the perfect media PC – why get
excited for a Raspberry Pi 4-compatible
version of LibreELEC/Kodi, then? One of the many
improvements to Raspberry Pi 4 was the inclusion
of hardware H.265 decoding – also known as HEVC.
This means it can support 10-bit colour, as well as
the 4K output of the new Raspberry Pi 4.
Verdict And we can say right off the bat that with H.265
encoded media, it’s noticeable immediately. Colour
tearing and glitches are completely gone, with The video game part has a way to go
LibreELEC 9.x
media running at full speed without it seeming to
still needs some
work upstream.
struggle. 4K works fine as well – not great, just fine some extensive testing with the three versions,
However, the – at 30Hz. playback was the exact same, even with the
beta is well worth most demanding bit rates. The UI, however, was
jumping on board Size matters? noticeably just a little bit more responsive on
if you have a That’s not the only reason we decided to do a quick the higher gigabyte models. Just the slightest
Raspberry Pi 4 and
re-review of LibreELEC, though – there’s also the bit, though – nothing to splurge on. At the very
the need to use
question of what version of Raspberry Pi 4 do you least, the 1GB model is a bit better than previous
9
the extra power.
need. Could you save $20 and get the 1GB version Raspberry Pi computers, in our experience.
over the 4GB, or is there a difference? So, to recap: you don’t even need to buy the best
/10
Yes, there is a difference, but no it’s not worth version of Raspberry Pi 4 to get the major benefits
the $20 (for this purpose) in our opinion. After of the hardware redesign. That’s a huge win.
10 Best:
Raspberry Pi
media players
Here’s how to play music and
video on your Raspberry Pi
R
aspberry Pi has been used to play video and
music since the very first board landed in
the hands of an enthusiast. Its use as a media
platform is legendary, and for good reason. Want to
Plex
take advantage of Raspberry Pi’s media powers? Here
are ten excellent ways… Ultimate media library
Need a tiny media server that will stream to all your devices that support Plex?
Using Raspberry Pi you can create the ultimate streaming media server, with
VLC Media Player the tiniest footprint in both physical space and on your electricity bill.
plex.tv
All-purpose player
VLC seems to be able to play just about
anything you throw at it, while still
having a very small install size. It also
Pi MusicBox
has great streaming abilities, and can
receive web streams and network Music streaming software
streams as well. It also has a GUI.
Another excellent streaming solution for your home. As well as being able to
magpi.cc/qsXYHH connect to your local music collection, it connects well to online services such
as Spotify and SoundCloud.
pimusicbox.com
MPlayer
The legend
MPlayer is still adored by many long-term Linux
and open-source software users, and for good
reason: it’s great. You’ll probably have to compile it
from source to get a version you prefer, though.
mplayerhq.hu
KODI
Kodi is software used in many
home-theatre PCs and other kinds
of media PCs. You can install
it on Raspbian on Raspberry
osmc.tv
Chromium
Web browser streaming
Using the default Raspberry Pi OS
browser, you can access a world
of content online from various
video sources like YouTube,
as well as stuff on your home
network with the right add-ons.
RuneAudio chromium.org
OMXPlayer
Volumio
Command-line
All-in-one audio player
Volumio wants you This is great for having
to have everything media play when you
connected to one turn a Raspberry Pi on,
device, and has or to control it from an
created a system to SSH-connected remote
allow you to do that. computer. It makes use of
Not only can you store minimal resources, while
music on it, you can also being hardware-
stream music from accelerated for great
other places to it. picture quality.
volumio.org magpi.cc/ABdFRJ
10 Amazing:
Media Lunchbox Arcade Game
projects
machine disguised as a lunchbox is still one of our favourites. Playing it at home
or at work on your break seems like the perfect fit for it.
magpi.cc/lunchbox
Y
ou can use Raspberry Pi to play all kinds of The clicky wheel iPod is a very important
media thanks to its small but mighty system- device in the history of portable media
on-a-chip. We’ve seen people use Raspberry players. So of course, Guy here ripped one
Pi to create incredible and inventive projects involving apart and upgraded it with a Raspberry Pi
Zero W and Spotify.
media – here are some of the very best.
magpi.cc/ipodspotify
Big and Smart Raspberry Pi
Picture Frame
Digital photo supremacy
With a spare monitor, a nice frame, and a Raspberry Pi loaded with
photos or connected to a cloud service, you can easily have a nice,
ever-changing series of pictures displayed on your wall.
magpi.cc/bigframe
BOSEBerry Pi
A 2010 throwback
The iPod docks of yore are remembered fondly by many and are still available
in a lot of hotel rooms. The form factor (and used price) really appealed to
maker David Hunt, who turn one into an internet radio box.
magpi.cc/boseberrypi
magpi.cc/atomictv magpi.cc/vintagetv
PiVidBox
Simple solution
This basic media player just requires
you to plug in an SD card or USB stick
with various media on it. It uses old
storage that would otherwise never
get used, and each has a curated
selection of content, labelled to make
sure you know what’s on it.
magpi.cc/vinylemulator
Retro gaming
NES frame
Lo-Fi Orchestra
Video game art
Impractical yet cool
Pixel art and old game cover art
Using a whole host of microcontrollers and microcomputers – including have their place in pop culture, as
Raspberry Pi – Kevin, aka DIY Electro Music, has managed to recreate a lo-fi does modding the NES. Combine
version of Gustav Holst’s The Planets suite. He’s making his way through the them and you have this framed
suite, but Jupiter is one of our favourites. NES cartridge cycling through art.
magpi.cc/lofiorchestra magpi.cc/nesframe
SUBSCRIBE TODAY
FOR JUST £10
Get 3 issues + FREE Pico W
Subscriber Benefits
FREE Delivery
Get it fast and for FREE
Exclusive Offers
Great gifts, offers, and discounts
Great Savings
Save up to 35% compared to stores
+
Subscribe for 12 Months
Free Pico W
12 issues of The MagPi
Free delivery to your door
£55 (UK) £90 (USA)
£80 (EU) £90 (Rest of World)
64 magpi.cc
www.dbooks.org
SUBSCRIPTION
A brand new
RP2040-based
$6
Raspberry Pi Pico W
development board
SUBSCRIBE
on app stores
magpi.cc 65
THANK YOU FOR READING!
Build a Raspberry Pi
Media Player!
Raspberry Pi is a small, clever,
British-built computer that’s packed
with potential. Made using the same
technology you find in a smartphone,
Want more articles and guides about
all the things you can make with
Raspberry Pi?
raspberrypi.com
www.dbooks.org