Professional Documents
Culture Documents
Pi User 02 (Spring 2017) (C00C1F48) PDF
Pi User 02 (Spring 2017) (C00C1F48) PDF
20 AMAZING
RASPBERRY PI
APPS
Discover the best web browser,
media player, games and more
15
Pi projects
to try
Q&A SPECIAL
ALL YOUR PI
PROBLEMS SOLVED!
Revealed! Simple solutions to your
most common Pi questions PIU02 2017
The Pi here is
protected by one
of two sturdy
boxes; the other
one protects
the battery. It’s
controlled
remotely via
Bluetooth.
Pi-powered skateboard
The Raspberry Pi Guy hits the road with a Pi-powered electric skateboard.
As Pi projects go, we have to say this one’s wheely good
atthew Timmons-Brown is well Cambridge, which is very flat – we suspect that
RECIPE
O1x
Raspberry Pi
Zero
M known in Pi circles: he’s the man
also known as The Raspberry Pi
Guy, and his site and YouTube
channel feature all kinds of
experiments served up to an audience of more
the hills of Yorkshire or San Francisco might prove
to be a much tougher challenge for the board’s
battery (and probably the rider’s stamina).
The electric skateboard’s power comes from
a single 3200W brushless motor that drives the
O1x than 57,000 people. He’ll happily show you how rear wheels. Two extra-sturdy boxes mounted
Nintendo Wii to control motors or rig up a camera, but our underneath the board protect the battery and the
remote
favourite video shows his skateboard, which electronics from the elements, debris, accidents
O1x features the unlikely combination of a board, and the occasional hedgehog. The motor is
brushless
electric a Raspberry Pi Zero and the remote controller operated by a speed controller, and that controller
motor from a Nintendo Wii. responds to signals from the Raspberry Pi.
The skateboard is capable of an impressive Using a Wii remote is a particularly clever touch:
O 1 x battery
30kmh (18mph) under electric power, which because it’s Bluetooth, the remote can connect to
“feels like a lot more when you’re actually riding the skateboard’s Raspberry Pi without any messy
it,” Matthew says. He hasn’t tested the range too wiring, so Matthew can use it to adjust the speed
much, but says that the board is quite capable of of the motor without worrying about getting
doing ten kilometres without running out of power. anything tangled. The only downside is that
It’s worth pointing out that those kilometres are in without the remote, the skateboard is entirely
people-powered. As you’d expect, the board is
steered the old-fashioned way, by leaning.
Matthew’s code is around 100 lines of Python,
and he’s put the code up on
Github so others can use it or CREATOR
tweak it. Sadly the skateboard
itself is a one-off: Matthew’s MATTHEW
TIMMONS-BROWN
already on to his next projects,
one of which is an attempt to Matthew is a 17-year-
See the board old student from
in action at www. create a Mars rover – Cambridge. Online,
theraspberrypiguy presumably powered by a Pi. he’s known as The
.com. How’s that for ambition? Raspberry Pi Guy.
6 // // Spring 2017
Our favourite HOME PI PROJECTS
Chessbord
No, it’s not a typo: the Chessbord is a chess board for the Internet of Things
hess and technology go back a long which in turn connects to a Raspberry Pi web
Four-pole jack
sockets: these
detect the
position of
the pieces and
also power the
Chessbord’s
LEDs.
Jack plugs:
where there’s
CREATOR a socket, there
needs to be
BEN a plug. These
JAMES were added
to each
Ben is 17 and would
individual
love to be an engineer. chess piece.
He shares his projects
online at Engineer
Cheer (engineercheer.
wordpress.com).
Spring 2017 // // 7
7-inch Touch
Display: David
found a way to
automatically
brighten and
dim the
display for
day and night
operation.
Black tape:
the ModMyPi
case leaked
too much
light, so its
holes were
blanked with
electrical tape.
TimePeace
Sometimes technology can be truly life-enhancing. TimePeace is a great
idea, extensively researched and thought through, and executed brilliantly
n 2015, David Penney’s father told him that no complex buttons and menus etc, although
I
RECIPE his stepmother had been diagnosed with these are found on most clock products,” he says.
Alzheimer’s. David went to visit, and one “So I used the Raspberry Pi Foundation’s 7-inch
O1x
Raspberry Pi of her comments resonated. “Her sense touch display. I also wanted a robust enclosure
of time doesn’t work properly,” he explains. that hides the electronics. The ModMyPi case for
O 1 x 7in “She asks many times a day what day of the week the display and Pi is OK but I would still prefer
Touch
Display it is.” She also woke in the night wondering something that seals firmly and has an option to
whether it was time to get up, and often felt hide all the sockets. I used black electrical tape
O1x that she was supposed to see someone or go over all the holes, which also stops the blinking
ModMyPi
case somewhere without being able to recall who or lights from the Pi from leaking out and keeping
where. David had a flash of insight: he could build a person awake at night!”
O 1 x roll
of black a special clock to help her. David also had to hack the display. “The 7-inch
electrical David undertook extensive research to identify display is also capable of dimming, but it isn’t
tape the best way to display the information, and then documented how to make it work,” he says. “So
he embarked on his build. “I wanted it to be an with clues from the Pi community, I managed to
appliance, not to look like a science project, so reliably dim and brighten the display in software,
then added a timer to tell it when to go dim at
night and when to brighten in the morning.”
David made two TimePeaces for his stepmother,
and the results have been very positive. “The first
night she woke, read ‘middle of the night’ on the
clock and went back to sleep,”
he says. CREATOR
David has now built three
devices, taking advantage of DAVID
PENNEY
Smart clocks
Amazon’s Alexa Voice Services
and other devices for voice control, and is working David is a former IT
director experienced
to tell you more on additional features in in financial services
useful stuff than software to help his and tech, interested in
just the time. stepmother further. cyber defence.
8 // // Spring 2017
Our favourite HOME PI PROJECTS
Gabian
Is it a bird? Is it a plane? No, it’s a flying machine – for fishing! It will help you
find where the fish are biting, drop bait and hook them for you, all remotely
uillaume Ramirez works with they’re spotted Gabian can then make repeated
Waterproof
case: after
CREATOR discovering the
hard way that
GUILLAUME electronics and
RAMIREZ
the sea don’t
Guillaume, 37,
mix, Guillaume
made his drone
is a production waterproof.
engineer with Airbus
Helicopters in Aix En
Provence, France.
Spring 2017 // // 9
Get the UK’s best-selling
Linux magazine
OUT
NOW!
THE TOP 20
Raspberry Pi apps
Discover how to do even more with your Raspberry Pi as Nate Drake
reveals our pick of the very best applications available for the Pi today
he Raspberry Pi is installed and many more can be search box at the top left of the Add/
Spring 2017 // // 11
TOP 20 Raspberry Pi apps
Minecraft Pi
Play the popular building game for free
Minecraft Pi is a version of the yourself from place to place. For
insanely successful Minecraft instance, to place a stone block
game written specifically for the immediately behind you, type:
Raspberry Pi. It is based on the x, y, z = mc.player.getPos()
Pocket edition, so may not have mc.setBlock(x+1, y, z, 1)
all the features of the full-blown Visit the official blog at http://
version. Gameplay is “Creative” bit.ly/minecraft-pi-guide for a
mode only, and multiplayer with worksheet of basic commands.
users of the regular Minecraft You can find Minecraft Pi
game is not supported. The pre-installed in Applications >
advantage to this, however, is Games on your Pi.
that no one can destroy your The Raspberry Pi will also
structures. happily run a Minecraft server,
If you want to get more from allowing you and your friends
Minecraft or just try Python to build your own virtual world
programming, press the Tab key provided you each have the
and open Python 3 (IDLE) from official version of the game.
Applications > Programming. There are a number of guides
From here you can type available to do this. We
commands to automatically drop recommend that you use the
Play the game, and make your first foray into Python blocks as you walk, automatically SpigotMC server software as it
programming by building Minecraft blocks. create structures, and teleport runs well on the Pi.
LibreOffice
Find all the office apps you need
Want to use office apps on your Another extremely useful
Pi, for free? LibreOffice provides feature is that with one click you
a familiar looking word processor can convert documents to PDF
(Writer), spreadsheet software format – useful because PDFs
(Calc), presentation program generally appear exactly the
(Impress) and even an app for same on every computer.
creating databases (Base). Help for specific programs
Need to share files with Mac and features is available at the
or Windows users? LibreOffice LibreOffice Community Support
bridges the gap: it supports ODF page at www.libreoffice.org/
(Open Document Format) by get-help/community-support.
default but can also open files If you like the app on the Pi, you
created in Microsoft Word, Excel can also download LibreOffice
and Powerpoint, as well as save for Mac or Windows from
files in Microsoft-compatible http://libreoffice.org.
.docx, .xlsx and .pptx formats The LibreOffice apps Base,
(among many others). Calc, Draw, Impress, Math and
Tired of Americanisms such Writer come pre-installed on the
as “color” appearing in your Pi. Note that the Draw program
work? Unlike Microsoft Office, can run slowly on older versions
The LibreOffice interface will be very intuitive to LibreOffice can install a version of the Pi – use the Raspberry Pi
anyone who has used office software before. that contains only UK English. 3 for best performance.
12 // // Spring 2017
Raspberry Pi apps TOP 20
Chromium
Surf the web in style with a shiny browser
Chromium replaced the former Foundation have included the
web browser Epiphany in the last h264ify browser extension,
major update for the Pi. As the which makes YouTube display
similarity of the name hints, it’s videos in a format that can be
related to Google’s Chrome web accelerated by the Pi’s hardware.
browser – Chrome derives most Also bundled with Chromium
of its source code from the open is the uBlock Origin extension,
source Chromium Project. One which blocks most annoying
consequence of this is that you popups and ads. They’re not just
can install many Chrome addons a pain but can slow down the Pi
such as the Google Hangouts dramatically if left unchecked.
plugin from the Chrome Web If you do not already have
Store (https://chrome.google. Chromium installed on your
com/webstore/category/ Raspberry Pi, back up any
extensions?). personal data, then open the
Chromium will support most of Terminal or connect via SSH and
your internet needs, although run the following commands,
you may find that playing certain one after the other, to upgrade
online games or streaming high to the latest version of Raspbian
quality video content is sluggish. complete with this new browser:
By default the Adobe Flash plugin is disabled. Click To assist with this, the good sudo apt-get update
“Always allow plugins” to enable them site by site. people at the Raspberry Pi sudo apt-get upgrade
Deluge
Download files via BitTorrent
The Pi supports a number of distributions can be downloaded
apps for downloading via this way), your ISP may restrict
BitTorrent, the peer-to-peer file or throttle BitTorrent traffic.
sharing protocol, but Deluge Consider using Deluge’s Blocklist
trumps them all in terms of the plugin to automatically block IP
sheer number of features. addresses of organisations who
If you run your Pi without a are likely to try to prevent you
monitor, Deluge can be accessed from using BitTorrent. See
via a web interface from another http://dev.deluge-torrent.
device. This is extremely useful if org/wiki/Plugins/Blocklist
you wish to download files while for full instructions. Blocklists
away from home. Simply open a themselves can be found at
browser and go to htt p:// www.iblocklist.com/lists.php.
ipaddressofyourpi:8112. Deluge You can install the Deluge
is protected by a password (the program using the Add/Remove
default is “deluge”). Instructions Software window. If you’re
are on the Deluge Wiki at http:// running your Pi without a
dev.deluge-torrent.org/wiki/ monitor and want to control
UserGuide/ThinClient. Deluge via SSH run the following:
While there is nothing illegal sudo apt-get install deluged
Access the Deluge web interface from another device in itself about downloading files deluge-console python-mako
by browsing to htt p://ipaddressofyourpi:8112. via BitTorrent (most Linux deluge-web
Spring 2017 // // 13
TOP 20 Raspberry Pi apps
VLC Player
Play and stream any type of media
To put it quite simply, VLC plays as YouTube clips from its
everything, from MP3 files, to Network tab.
Apple’s QuickTime format, to Another brilliant feature is
Windows Media Videos. This is the ability to convert files from
especially useful on the Pi as by one audio/video format to
default the Pi cannot play some another. This is especially useful
of the more exotic and non-free for people with Smart TVs that
media formats. VLC also has a can play only .avi video files.
handy plugin for your web Speaking of TVs, a Raspberry
browser to allow playing of Pi running VLC and plugged into
media files from websites. a TV can become a handy media
Although it is best known for centre, controlled by a web
being a universal media player browser. Enable this option in
with an unassuming interface, VLC’s preferences to allow you to
VLC has some extraordinarily select, pause and play music or
powerful extra features. For videos from another device.
instance if you wish to record Install VLC player via Add/
yourself using the Pi, VLC’s Remove Software. In order to
Capture Device option can play the range of video files
record whatever is running supported by VLC the system
on your desktop. VLC can also may ask you to agree to install VLC will play almost any media, and on a Pi connected
download online videos such some additional programs. to a TV can be the heart of a powerful media centre.
IceDove
Let your emails soar
IceDove is a version of the the cloud and send your
popular Mozilla Thunderbird recipient a link to them.
email program. Although the Pi You can extend IceDove even
does come with a built-in email further by heading to the Add/
client (Claws Mail), IceDove Remove Software window and
offers much more customisation. installing iceowl, which will
The mail setup wizard is very install a fully-featured calendar;
easy to follow, and all common another extension will also add
providers’ settings can be found support for Google Calendars.
in the Mozilla database. In most The default interface looks
cases you will simply need to rather dry but you can change
enter your email address and this by installing one of the many
password, and IceDove will then colourful themes. Go to Tools >
do the rest. Add Ons to see some of those
Aside from managing your on offer. There are also software
emails, it can also manage your add-ons for IceDove such as
news feeds and supports several Enigmail, which allows you to
chat services such as Google encrypt your emails.
Hangouts. IceDove also supports Install IceDove by going to
Filelink: as an alternative to Preferences > Add/Remove
sending large files, you have the Software and entering the IceDove is a more customisable email client, with
option to store attachments in name in the search bar. news feeds and chat, plus a range of available add-ons.
14 // // Spring 2017
Raspberry Pi apps TOP 20
Synaptic Package
Manager
Turbocharge your package management
Like Add/Remove Software available software for Raspbian
in Applications > Preferences, and update the Pi.
Synaptic is a pleasant graphical Another huge advantage of
front end for installing the vast Synaptic is that if you select a
number of programs available program for installation that
for the Pi. But if you already have requires others in order to work
something to install new apps, properly, it will automatically
why would you need Synaptic? mark these for download too.
First, Synaptic contains a good The buttons at the bottom left
many more categories than the help to narrow down the various
very broad ones offered by Add/ programs much more easily too.
Remove Software. Instead of one For instance clicking the Status
“internet” section, for instance, button followed by Installed in
you can select “Communication, the window above will list all
“Email”, “Networking” and so on. installed programs. Click Mark
Synaptic can also ensure that all Upgrades to automatically
you have the most up-to-date flag any programs that can be
version of each program. Click updated. When ready, click Apply Add/Remove Software is perfectly adequate. But
the Reload button to scan the to download the relevant files. Synaptic is much more, with useful extra capabilities.
Pidgin
Manage all your Messaging from one place
The popular cross-platform Pidgin can also be configured
messaging app Pidgin saves you in many ways. You can change
the trouble of managing multiple themes (icons, emoticons,
accounts like Google Hangouts, fonts etc.) by choosing from the
AOL Instant Messenger and thousands available online – see
Yahoo Messenger. All your https://developer.pidgin.im/
chats can be combined in one wiki/ThemingPidgin.
place. More chat protocols such For Pidgin plugins, see
as Skype and WhatsApp are https://developer.pidgin.im/
available via plugins (see below). wiki/ThirdPartyPlugins. Some
Sadly since Facebook dropped of these are quite benign and will
support for the open XMPP extend the messaging protocols
standard in 2014, Pidgin can Pidgin supports. The ultra
no longer be used to chat with paranoid can add the OTR (Off
Facebook contacts via the site. the Record) messaging plugin,
Pidgin does however also which will encrypt conversations
support IRC Chatrooms. By to allow you to chat privately
default it is configured for the over the internet.
huge Freenode network. Users Install Pidgin by going to
can join “channels” to discuss Preferences > Add/Remove
a huge number of topics from Software and searching for it Pidgin supports multiple protocols so you can chat
programming to jam making. using the bar at the top left. to a number of friends at once.
Spring 2017 // // 15
TOP 20 Raspberry Pi apps
GIMP
Edit all your photos professionally on the Pi
GIMP is an advanced image the level of transparency and
editor. It’s designed to be a colour of parts of any image.
serious alternative to some of Pi users can also make use
the expensive paid-for photo- of scripts written in Perl to
editing apps while still being automate common tasks – for
intuitive to use. GIMP contains example to bulk-convert a load
all the tools you’ll need for basic of .xcf images to .jpg and add a
image editing such as altering caption. You’ll find sample Perl
the contrast, cropping or cutting scripts plus plugins to extend
parts of an image. GIMP can also GIMP’s functions even further
open and convert various types in the GIMP Plugins Registry:
of image. This is particularly http://registry.gimp.org.
handy if you have a digital You might be surprised how
camera which takes high quality professional your images can
photos that you wish to reduce look after you spend just a little
in size to share over the web. time with GIMP. If you want to
Choose File > Export to make explore further, www.gimp.org/
them compact JPGs or similar. tutorials offers free tutorials.
More advanced features such Install GIMP by clicking
as selective colorisation are Preferences > Add/Remove
available through use of layer Software and searching for it You can select individual parts of an image to edit the
masks, allowing you to control using the bar at the top left. image further and/or export to a new image.
10
Dropbox Uploader
Sync, edit and delete your Dropbox files
There’s no official Dropbox client create a new app to allow the
on the Pi, although some other script to interface with your
cloud sharing services such as Dropbox account. Give it “full
Sparkleshare are supported. You access”. Once the app has been
can always access Dropbox by created, click Generate Token.
logging in using the Chromium Now copy and paste this into the
browser, but Andrea Fabrizi has Terminal window. The script will
created a command line script save it, and then will be able to
for basic Dropbox functions. access your Dropbox.
First connect via SSH or open A full list of all commands is
Terminal on your Pi and get the available at https://github.
necessary software with: com/andreafabrizi/Dropbox-
git clone https://github.com/ Uploader but the basic format
andreafabrizi/Dropbox-Uploader. for uploading is as follows:
git .dropbox_uploader.sh upload
Make the script executable pathtolocalfile /pathtoremotefile
and run it with these commands: For instance:
sudo chmod +x dropbox_ sudo ./dropbox_uploader.sh
uploader.sh upload /home/pi/letterlegal5.doc.
sudo ./dropbox_uploader.sh zip /docs/letterlegal5.zip
Select “Full Access” on Dropbox Uploader’s developer You’ll then need to visit www. The script displays a progress
page to allow the script to control your account. dropbox.com/developers and bar as the file uploads.
16 // // Spring 2017
Raspberry Pi apps TOP 20
11
SD Card Copier
Quickly and easily back up your entire Pi
As you start producing photos, a larger external drive for other
personal emails and intricate purposes, so consider devoting a
Minecraft structures on your Pi, USB stick solely to backing up/
you’ll want a reliable way to back transferring data.
everything up. While there are SD Card Copier is also very
various backup utilities available useful if you need more space
to install on the Pi, the built-in for new programs. Insert a
SD Card Copier will likely meet higher capacity SD card into a
your needs. It’s at Applications > card reader and connect to the
Preferences > SD Card Copier. Pi, then begin the copy process.
To begin the copy process, This will preserve all your
attach an external disk or other passwords, applications and
storage device and then select it other settings.
in the Copy To menu. Be warned If you have problems with
that the destination disk will be data corruption or media failure,
formatted before copying – any remove the current SD card and
files already on it will be lost. insert the backup one. You can
After copying, the resulting then use the utility in reverse,
drive will be an exact copy of the copying the contents of the
Pi’s SD card, right down to the current backup card to the
It looks simple, but SD Card Copier is very powerful. individual partitions. This can one you previously removed or
Back up any data already on the target drive before use. be problematic if you’re using restoring to a brand new card.
12
Zip Archiver
Create Zip files with a few mouse clicks
By default the Pi is capable of save the Zip file. Choose a
opening a range of compressed location, then click Archive Type
files such as Zip files. Simply at the bottom left and scroll to
right-click the file and choose the bottom to select Zip. Now
Extract Here. As you use the Pi click Create at the bottom right.
more, especially for email, you The Xarchiver program will
may well wish to compress files display a dialogue stating
as well. The Pi supports various “Adding to Archive” and the
Linux formats out of the box archive file will appear.
such as .bz2 and .tar, but these While adding support for Zip
are not particularly useful if you files, you may also wish to allow
wish to send a file or folder to the Pi to create and extract
Windows or Mac users. So install compressed files using the 7Zip
support for Zip compression by (.7z) format, which is more
clicking Preferences > Add/ efficient and supports options
Remove Software and searching such as splitting files and
for “zip”. The official name is encryption. Search for “p7zip”
“Archiver for Zip Files”. in the Add/Remove Software
Once it’s installed, you can window to do this. Once it’s
right-click on a file or folder and installed you will see .7z available
choose Compress. The system under Archive Type when you’re Install p7zip as well as Zip Archiver for compressing
will ask you where you want to compressing a file. and extracting using the ultra-efficient 7Zip format.
Spring 2017 // // 17
TOP 20 Raspberry Pi apps
13
FocusWriter
Pen a novel from the comfort of your Pi
Although the Pi does come with lines of text from The Matrix.
LibreOffice Writer pre-installed, There is also a more traditional
those who write for the love of “Writing Desk” theme.
it may find the options rather Although FocusWriter is
overwhelming, although not suitable for any kind of writing,
nearly as much as the urge to it’s clear that it has been made
quickly check on Facebook with those who love to write in
while working. FocusWriter is so mind. The Tools menu has timers
named because it runs as a full where you can set yourself goals
screen app, specifically designed as well as monitor your daily
to help you ignore distractions progress in terms of time spent
and get on with writing. writing or the number of words
Search for FocusWriter in the written. The Settings menu
search bar in the Add/Remove allows you enable Focus Text to
Software window. After installing highlight one or three lines, or
it you can launch the app from indeed an entire paragraph.
Applications > Office > The program can save
FocusWriter. Go to Settings > documents in plain text (.txt),
Themes to customise the Rich Text (.rtf) and the open .odt
appearance of your writing area. format. And did we mention that
Choose from several display options. Go to Settings > The “Old School” theme strongly FocusWriter makes typewriter
Focus Text to highlight individual lines or paragraphs. resembles the scrolling green sounds as you write?
14
USB Over IP
Access USB drives on your network
USB Over IP is a convenient way sudo usbip -D
to access drives over a network. Next connect your USB drive,
Once it’s installed on the Pi and and use the following command
set up, any device connected to to find its “busid”:
the network will be able to see usbip list -l
and modify files as if the drive A busid will be something like
were plugged into that device. 1-1.5. Bind it to your Pi with:
To install it, search for “usbip” sudo usbip --debug bind -b
in the Add/Remove Software (yourbusidhere)
window. The software also has to Once USBIP is installed on your
be installed on any client devices client device, you can run one
that are going to access the USB command from the Windows or
drive. Versions for both Windows Linux command line to make the
and Linux are available from USB drive accessible over the
http://usbip.sourceforge.net. network. See the SourceForge
Once installed, it needs only page for specific steps.
a few simple commands to start. Be aware that the USB device
Open Terminal or connect via will be available to anyone who is
SSH and start the usbip server connected to your network and
with the following commands: running the software. It also
sudo modprobe usbip-core doesn’t encrypt your data, so Your Bus ID may vary from those shown here. Use the
sudo modprobe usbip-host use it only on trusted networks. list command to discover your own device’s ID.
18 // // Spring 2017
Raspberry Pi apps TOP 20
15
DOSBox
Play the DOS classics with one handy app
If you grew up in the ’90s, you’ll no longer sold or supported by
remember DOS classics such as the copyright holder, meaning
Doom, Command and Conquer, prosecution is unlikely, but do
SimCity and the Ultima series. check that downloading games
Whether you’re nostalgic or is legal in your jurisdiction.
just curious, you’ll find that few Once you’ve downloaded the
machines are capable of playing Zip file of a game, extract it and
old DOS games natively. DOSBox copy the folder to /home/pi/
solves this problem by emulating dos-games. Launch DOSBox
old Intel x86 PCs, right down to from Applications > Games >
the DOS-like command prompt. DOSBox Emulator. Now you have
To install DOSBox, start by to mount the game. For instance
searching for “dosbox” in the to mount Neuromancer in the
search pane of the Add/Remove folder neuroman as drive C, type
Software window. After installing mount c /home/pi/dos-games/
it, create a folder in your home neuroman
folder named dos-games to Next, to access the drive, type
store your titles. C:, then dir to list the files. To run
Where can you find these? the game, simply type the name
One of the best known sites for of the .EXE file, for example
DOS classics is www.abandonia. NEURO. Press Ctrl+F1 inside any Neuromancer was all about the Matrix before the
com. Abandonware is software game to load the key mapper. Matrix was even cool. Relive the glory on your Pi today.
16
Guake
Become a Terminal virtuoso
No matter how accustomed you can tap F12 to have the Guake
are to graphical desktops and terminal drop down. Enter your
pointing-and-clicking, inevitably commands exactly as you would
there comes a time with the using the regular Terminal app.
Raspberry Pi where you will It’s much easier to pull up and
come to accept that using the dismiss, and you’ll also note that
Terminal is much easier. The the window is semi-transparent,
Pi’s built-in Terminal is adequate so you can see any apps running
but it can obscure your view of in the background.
the screen, and the black wall Right-click inside the Guake
of text can be foreboding to window to set its Preferences.
newcomers. Guake tries to These range from altering the
address these issues and others look and feel of the window to
by being easier on the eye and changing the keyboard shortcuts
much simpler to use. to show and hide Guake.
Guake is technically as a “top- Another huge advantage of
down” terminal. Install it via the Guake for budding programmers
Add/Remove Software window, is that it can open tabs which
then launch it from Applications are preconfigured to run Python
> System Tools > Guake programs. Usefully, Guake can
If you’ve played the game Quake you’ll recognise Terminal. A popup verifies that also open a new tab in the
Guake’s similarity to the game’s own chat terminal. Guake is running. By default you current working directory.
Spring 2017 // // 19
TOP 20 Raspberry Pi apps
17
Calibre
Convert, organise and share your ebooks
Calibre describes itself as a the metadata. This handy
“complete library solution”. It is feature allows you to type in the
perfect for anyone with a device correct author name and title.
capable of reading ebooks such Calibre can also search online
as the Amazon Kindle. for the correct book cover and
Install Calibre via the Add/ a plot summary.
Remove Software window, then Once a book has been
launch it from Applications > converted, you can then either
Office > Calibre. save it to a different folder on
On first run Calibre will ask the Pi or, if your device is
you some questions about your connected, effortlessly send it
e-book device and the format to the device’s main memory
it supports. For instance the using the buttons at the top of
Kindle can read both the open the Calibre window.
.mobi format and Amazon’s Another remarkably useful
own .awz3. You will then be able feature is Calibre’s ability to run
to add books to your library. A as an e-book server, which can
huge number of formats are be accessed by anyone via a web
supported. Before converting browser. Once your library has
into a format compatible with been set up, the Pi no longer
In the Calibre web interface, click on the cover of any your device, you can right-click needs a monitor, so you can run
book to download to your device. on one or more books to edit it “headless” if you wish.
18
Arduino IDE
Write code and upload to an Arduino board
The Arduino is a “microcontroller you can go to Tools > Boards to
motherboard”. Microcontrollers select from the dozens available.
are generally used to perform Install Arduino IDE using Add/
repeated actions – opening Remove Software by searching
doors, checking temperatures for “arduino”. To use it, go to
and so on. Arduino projects are Applications > Programming >
fantastic ways to get into both Arduino IDE. To start, you can
coding and electronics. While browse exciting sample projects
you can do this with the Pi itself, by clicking File > Examples.
the Pi is a full-blown computer, Like most programming
much more than is needed for platforms, Arduino can be
most such applications. extended further using Libraries.
The Arduino IDE (Integrated These provide extra functions
Development Environment) when working with new
makes it very easy to write code hardware or processing data.
and upload it to any Arduino For instance the LiquidCrystal
connected to the Pi. This is library enables you to control
usually done via USB, though connected Liquid Crystal
some boards can connect Displays. See www.arduino.cc/
wirelessly. By default the en/Reference/Libraries for a
To do more with a connected Arduino board, click Add software is preconfigured for the full rundown of the official
Library to import libraries downloaded from the internet. default Arduino Uno board, but Arduino libraries.
20 // // Spring 2017
Raspberry Pi apps TOP 20
19
YouTube Downloader
Download video clips from streaming sites
Although technically it’s possible “funnycatsandnicefish” as an
to use VLC Player (see page 14) MP4 file, you would enter:
to download and record video youtube-dl -o kitten.mp4
streams, the command line "https://www.youtube.com/
app youtube-dl makes it much watch?v=JlWlnBWVQLE"
easier to download videos from Be warned that the Pi may
streaming websites. The name is struggle to play high-definition
something of a misnomer as it is videos. These will also take up
actually compatible with several precious space. You can tweak
video sharing websites. the quality of your downloads
To install it, go to Applications with the -f (format) flag. For
> Add/Remove Software and instance, to ensure that the
search using the bar at top left video of Paris the fluffy kitten is
for “youtube-dl”. no more than 25MB in size, enter
Once installed it can be the above command like so:
launched at any time using youtube-dl -o kitten.mp4 -f
Terminal on your Pi. The basic 'best[filesize<25M]' "https://
syntax for downloading video is: www.youtube.com/
youtube-dl -o [name of output watch?v=JlWlnBWVQLE"
file] [YouTube URL] For a full rundown of all youtube-
For instance, to download a dl commands visit https://
video of Paris the fluffy kitten github.com/rg3/youtube-dl/ Download video clips using youtube-dl, then use the
from the YouTube channel blob/master/README.md indispensable VLC Player to play them.
20
Xpad
Smother your desktop with sticky notes
Xpad, which comes bundled contain important information
with some versions of Linux like vital internet links.
such as Lubuntu, is a handy app You can customise individual
for jotting down quick notes. notes even further by right-
To install it, go to Applications clicking on them individually and
> Preferences > Add/Remove selecting Properties. From here
Software and search for “xpad” you can choose to use the global
using the bar at the top right. Xpad theme or colour code a
Once it’s installed, launch Xpad note as you see fit. Click the +
from Applications > Accessories. button at the bottom left of any
Superficially Xpad windows pad to create a new note.
resemble Post-it Notes (other Right-click on the Xpad tray
brands of sticky label are also icon or any note to see the
available), but they can hold Note’s category. Each is named
unlimited amounts of text. Right- after the first line of text – for
click anywhere inside a window example “To Do”. Deleting notes
and choose Edit > Preferences to is just as simple. Just click on
change global settings. This will the wastebasket icon on any pad.
enable you to change the font, as Simply closing a note will not
well as the foreground colours. delete it, meaning you can have
You can also choose to lock your more notes than the available We don’t know if information wants to be free, but it’s
Xpad windows for editing if they space on your desktop. useful to have it to hand in customisable sticky notes.
Spring 2017 // // 21
POWER UP Super Pi
22 // // Spring 2017
Super Pi POWER UP
Spring 2017 // // 23
POWER UP Super Pi
This aluminium
case from FLIRC
has a built-in
heatsink, which
works wonderfully.
A TRUE DESKTOP PI
If you want your Pi to form the heart of an to purchase a pi-topPROTO accessory,
all-in-one device, then visit www.pi-top.com which plugs into the mag rail and slides
to learn more about the Pi-topCEED, a into place on it. There’s also an optional
desktop-friendly chassis with built-in speaker component for adding sound.
14-inch HD screen (1,366x768 resolution) You can pick up a PiTop CEED Pro in
and space behind for your Raspberry Pi green or grey from £119 including VAT
(you can purchase it with or without a Pi 3). from RS Components (https://uk.rs-
Fitting is incredibly easy – remove the online.com). It’s undoubtedly an
front panel from beneath the display to attractive way to house your desktop
reveal a generous space for your Pi and any Pi, although the screen is a little small.
add-on boards you want to include. Hook
up the Pi to the HDMI cable, place it on the
mag rail and slide it to the end, where it An attractive way to house
clips securely into place. HATs and other a desktop Pi, although the
add-ons are easy to install too – you’ll need screen is a little small.
24 // // Spring 2017
Super Pi POWER UP
The Pi 3 has one other major advantage over better results – the SanDisk Cruzer Ultra and The clever
earlier models: it supports USB booting. This Extreme 32GB and 64GB drives have been Pi-topCEED turns
means that with a bit of work (see Run Ubuntu reported as both compatible and recommended your Pi into an
Mate from USB, over the page) you can pair it with thanks to their superior performance. all-in-one desktop
computer – see
a USB flash or SSD hard drive to deliver a more If you’d like your Pi to turn heads, then check
opposite page.
responsive experience. Some users have reported out the True Desktop Pi box opposite for details
success powering SSD drives from the Pi 3’s USB of an all-in-one chassis that includes a 720p
port using a Y-splitter cable, but we found the drive HD display. Speaking of displays, the Pi 3
was unstable and threw up errors when creating can output 4K on a suitable monitor, but
the root filesystem. If you fall into this category, you’ll need to tweak the config.txt file to
you’ll need to power the drive separately using its add a suitable mode at 15Hz:
own dedicated supply. hdmi_cvt 3840 2160 15
If you’re in the market for a suitable USB drive, You may also want to consider another
the obvious choice is the PiDrive range from distro in place of the standard Raspbian
Western Digital (http://wdlabs.wd.com) if you’re – Ubuntu Mate (https://ubuntu-mate.
after a larger hard drive, but SSD and flash drives org/raspberry-pi) is a slick alternative,
will produce better performance. Despite the USB but is a bit more demanding. We
2.0 bus, it appears USB 3.0 flash drives produce cover both in the next section.
Boost performance
Want to use your Pi as a desktop replacement? Here’s what you need to do
ou’ve purchased your kit and you’re
Boot into Raspbian from USB problem might be down to the need for a longer To overclock
Instructions for preparing a Pi 3 for booting from delay at startup to allow the drive to be detected, your Pi 3 you’ll
USB 3.0 can be found at www.raspberrypi.org/ so followed the workaround at www.raspberrypi. need to edit the
documentation under Hardware > Raspberry Pi org/documentation/hardware/raspberrypi/ /boot/config.txt
file – it can’t be
> BootModes > Mass Storage Device. To put it bootmodes which involves formatting a SD card
done from the
simply, you’ll first update your Pi’s firmware with (any size will do) in FAT32 and placing an updated raspi-config tool.
the experimental boot files, then enable USB boot bootcode.bin file on it along with an empty file
mode. Reboot to test, then connect your USB you name timeout. With this in place, we were
drive and use parted to format it correctly with a able to run Raspbian from the USB drive.
100MB FAT32 partition and Linux ext4 partition. You may or may not notice an improvement in
You then create the boot and root filesystems, boot times, but you should quickly find that your Pi
mount the new filesystems and copy your is a little more responsive, which you can confirm
Raspbian system to it. Regenerate SSH host by benchmarking the drive using dd and hdparm :
keys, edit the boot files to look for the USB drive, $ dd if=/dev/zero of=~/test.tmp bs=500K
unmount your filesystems and then power off your count=1024
Pi. Remove the SD card, reconnect the power and $ sudo hdparm -t /dev/sda
if all is well you’ll be booting from your USB drive. By using dd , we get the drive’s sequential write
Sadly, the process isn’t guaranteed to work with speed by writing a 500KB file 1,024 times, while
all drives – we were unable to get our Kingston hdparm provides the drive’s sequential read
SSDNow 64GB drive mounted in a StarTech speed. We performed each test five times to get an
chassis to boot directly as a result. We thought the average score – the SSD drive managed 30MBps
Spring 2017 // // 25
POWER UP Super Pi
(write) and 33MBps (read), compared to 8MBps Sadly not all Pi 3s are equal, and you can’t
and 20MBps respectively for the SanDisk Ultra SD overclock using the official Raspbian configuration
card. It’s worth noting that these aren’t true real- tool (or raspi-config for that matter), but don’t let
life tests – random read/write times will see a that stop you, because you can easily overclock
smaller gap between the two – but a fast USB your Pi by editing the /boot/config.txt file.
drive will still be a step up, nonetheless. There’s actually three things you can overclock:
the processor, obviously, but also your Pi’s RAM
Overclock your Pi and GPU too. A list of suggested settings for all
If you’re looking to eke that bit more performance these can be found at https://github.com/
from your Pi, then obviously overclocking – that is, retropie/retropie-setup/wiki/Overclocking.
manually cranking the processor up to a higher We’d suggest sticking with the more modest
speed than its default setting – is the way to go. 1.35GHz overclock and skip the GPU overclocking
26 // // Spring 2017
Super Pi POWER UP
section (the gpu-mem setting refers to the PC. One of the remaining bottlenecks is the 1GB of Ubuntu Mate
amount of memory you allocate the graphics RAM – this is perfectly fine for one or two tasks, can be run from
card – 128MB or even 64MB should be adequate but you’ll need to keep your aims realistic and a USB drive too,
for basic desktop use) unless you’re looking to avoid opening too many applications or browser but you’ll still
need a microSD
boost your gaming performance. tabs at once. Train yourself to keep things lean
card for booting.
There are two things to consider. First, how do and mean, and you’ll be able to enjoy perfectly
you verify that the overclock settings are in place? adequate performance for basic desktop tasks
Use the following command to determine the such as web browsing (including using cloud
minimum and maximum clock speeds: applications) and office work.
$ lscpu | grep "MHz" One final tip: both Epiphany (Raspbian) and
Second, how can you tell if your overclock is Firefox (Ubuntu) browsers struggle to render
stable? Keep an eye on the CPU temperature by certain websites, particularly those loaded up
displaying it in the menu bar: right-click the menu with JavaScript. The simplest solution is to switch
bar and choose Add/Remove Panel Items. Click browser to Chromium, particularly if you’re
Add and select Temperature Monitor. You can then planning to make use of Google services like Drive
keep an eye on the temperature while you make
use of your Pi. Anything under 80 degrees is fine,
but with luck your cooling system will ensure that YOU CAN OVERCLOCK THE
even when overclocked your CPU temperature
remains under 60 degrees.
PROCESSOR, OBVIOUSLY, BUT
For a more in-depth look at overclocking, ALSO YOUR PI’S RAM AND GPU
including some other tweaks you can apply
(such as forcing your processor to always run in
performance mode), check out Jackenhack’s blog or Docs. Ubuntu Mate users can install Chromium
post at www.jackenhack.com/raspberry-pi-3- through the Software Center, but it’s not available
overclocking. There’s a mention of running a through normal means to Raspbian Jessie users.
custom Linpack script in the comments to No matter – just open a Terminal and enter the
stress-test your Pi, but we found that it locked up following to download and install it:
our Pi even without overclocking, and there’s a $ wget -qO - http://bintray.com/user/download
long discussion about what this means at http:// SubjectPublicKey?username=bintray | sudo apt-key
bit.ly/LinPackStressTest. add –
$ echo "deb http://dl.bintray.com/kusti8/chromium-
Desktop performance tips rpi jessie main" | sudo tee -a /etc/apt/sources.list
Even with its quad-core processor, the Pi 3 isn’t $ sudo apt-get update
going to provide you with the same level of $ sudo apt-get install chromium-browser rpi-
performance as even a modestly specified modern youtube -y
Spring 2017 // // 27
POWER UP Super Pi
ALTERNATIVE FORM-FACTORS
You don’t need to build a portable Pi around inch display and keyboard, follow Chris with case, Wi-Fi dongle, tweaked Raspbian
the official 7-inch touchscreen. If you’ve got Robinson’s guide at https://youtu.be/ install (with LCD drivers) on an 8GB
£225 to spare, you can purchase the Pi-Top, NMkhRK2lV0E – it’ll cost you under £100, microSD card with a 3m long power supply.
a full laptop chassis with keyboard, 13.3- but you’ll need to be a bit of a whizz with a The main issue here is with the screen size
inch HD screen (1,366x768) and smart hacksaw blade and glue gun as well as a – while it’s technically possible to run the
battery offering up to 10 hours of life – soldering iron. Raspbian desktop environment, you’ll
see www.pi-top.com/product/pi-top. A simpler – and cheaper – way to add need to optimise it for the smaller
Or you could go to the opposite extreme a 3.5-inch display to your Pi is through screen. There’s space for around six
and experiment with a 3.5-inch resistive SB Components’ LCD Control Case (from desktop icons, for example, and you may
touchscreen. For a guide to building your £26, shop.sb-components.co.uk), which find it’s more suited to Terminal use as
own Nintendo DS sized computer with 3.5- comprises a 320x240 resistive touchscreen well as mobile-friendly interfaces.
28 // // Spring 2017
Super Pi POWER UP
Spring 2017 // // 29
POWER UP Super Pi
Next steps
One of the biggest issues with Emby is gaining
access to your stored media. Start by creating a
mount point:
$ sudo mkdir /media/emby
If your media is stored on an NTFS-formatted USB
drive, you need to first add the following:
$ sudo apt-get install ntfs-3g
AUDIOPHILE-FRIENDLY MUSIC
Imagine an inexpensive, pocket-sized audio required software to download at the adapter (£22) and suitable case (£15.60).
player delivering superb quality digital website, www.pimusicbox.com. The Pi-DigiAMP+ delivers up to 35W stereo
sound through your home stereo or even a We paired a Pi Zero with the superlative to a pair of two-wire speakers, which
pair of headphones. No, we’re not talking Pi-DAC Zero (from £12, www.iqaudio. connect directly to its speaker terminals.
about your smartphone or tablet, but a co.uk) and the Pi MusicBox distro to deliver How about building an internet radio, or
standalone audio player streaming music a headless audio player based on Mopidy. turning any speakers Wi-Fi-capable to play
from Spotify, SoundCloud, Google Music, Find the project at www.mopidy.com. music from a connected USB device, NAS
web radio or local music files. That’s the If you’d like to build a standalone audio or mobile device? We tackled these two
thought behind Pi MusicBox, a Pi-based receiver, then you can pair your Model A/B projects in the last issue of Pi User. If you
project. You’ll find all the details and the Pi with the Pi-DigiAMP+ (£55), power missed it, visit http://bit.ly/pi-user-01
30 // // Spring 2017
Super Pi POWER UP
Spring 2017 // // 31
POWER UP Super Pi
32 // // Spring 2017
Super Pi POWER UP
Spring 2017 // // 33
The Top 20
Raspberry Pi issues
Things can go wrong with even the best technology. Here’s how to tackle
some of the most common glitches you’re likely to encounter with your Pi
he Raspberry Pi is elegant in its simplicity. This connected devices, corrupted microSD cards, and out-of-
Spring 2017 // // 35
TOP 20 Raspberry Pi issues
Pi continuously reboots
Pi unable to boot up? Check your power supply and SD card
1
One of the most www.raspberrypi.org/help/ at the top right of the desktop
fundamental issues with faqs/#powerReqs. if it is underpowered but can
the Pi may be that it fails Speaking of USB ports, also simply reboot if too much
to boot up properly at all. Usually bear in mind that the power current is being drawn.
the Raspberry Pi logo will appear, requirements for the Pi will vary Ideally, you should buy an
then the screen will transform depending on what devices are official Raspberry Pi power
into a block of rainbow colour attached. The Pi will usually supply from an authorised
as the Pi self-tests its graphics display a lightning bolt symbol dealer such as the Pi Hut. Where
processor. Then occasionally possible, try to connect the Pi
the Pi will either display scrolling directly to the adapter itself
text on a black screen or simply This Micro rather than through a USB hub.
USB 5V Supply is
reboot repeatedly and fail to Although insufficient power is
available for just
load the OS. the most common reason that a
£5 from the Pi Hut
The most common reason (https://thepihut.
Pi is stuck in a boot cycle, there
for this is that your power supply com/products/ are other reasons why this may
is simply not providing enough micro-usb-power- occur. If your SD card has been
juice. The Pi is powered by a 5V supply-for-the- formatted incorrectly or an
micro-USB cable. The amount raspberry-pi) update to Raspbian has gone
of current required will vary awry, the Pi may also reboot.
depending on your model. For Try installing NOOBS to your
the latest Raspberry Pi 3 Model microSD card and reinstall
B, use a 2,500mA supply to Raspbian if changing the
make sure the Pi switches on power supply doesn’t help.
and that all four USB ports are See www.raspberrypi.org/
powered. For a detailed list of documentation/installation/
the Pi’s power requirements visit noobs.md for help with this.
No HDMI monitor
No problem, just use composite video
2
Fortunately for users composite cable and
with older televisions, keyboard to your Pi. Power it
the Raspberry Pi 3 has on while holding down the
a combined 3.5mm audio/ Shift key for around 10 seconds,
composite video jack, which then release the key. Do not
means even TVs without an worry at this stage if you
HDMI port can be used as a don’t see anything.
display. You will need a 3.5mm To switch the Pi from
to RCA A/V Composite cable, HDMI to the composite
available from sites such as display, press number 3
ModmyPi.com. Whichever on your keyboard for PAL
supplier you use, make sure that televisions or number 4 for
the A/V composite cable has NTSC. Televisions bought in Make sure reboot the Pi as before holding
three RCA connectors, so both the UK and Ireland will almost your composite Shift, then hold down the
audio and video are supported. certainly use PAL, whereas cable has three number 1 key to switch back
If you have a standard those in North America will RCA connectors, to HDMI.
installation of Raspbian, then the probably use NTSC. like this one from In the unlikely event your TV
ModMyPi (www.
Pi should automatically switch to If the display appears uses the Japanese version of
modmypi.com/
using your composite video distorted or black-and-white, NTSC or the Brazilian version of
raspberry-pi/
when it doesn’t detect an HDMI most likely you have selected accessories/
PAL, or if you wish to change the
device. If you are using NOOBS the wrong standard. Reboot the audio-cables/ aspect ratio used by the Pi, you’ll
to install Raspbian, however, by Pi and repeat the steps above av-composite- need to modify the Pi’s config.txt
default it outputs only to HDMI. to try another format. cable-3.5mm-to- file accordingly. See http://
You can modify this during Should you later decide to 3-x-rca-3m). elinux.org/RPiconfig#Video
startup. First connect your invest in an HDMI television, for information on this.
36 // // Spring 2017
Raspberry Pi issues TOP 20
3
We mentioned opposite connect via SSH. If you haven’t
that on booting up, the Pi used SSH before, see problem 7
runs its own GPU (Graphics over the page. For recent
Processing Unit) self-test, which versions of the Raspbian OS, to
appears as a dazzling rainbow enable access this way you need
coloured screen. Occasionally to save a file named ssh onto the
the Pi may hang on this screen SD card’s /boot partition.
and refuse to load the OS. If you’re able to connect to
This can happen when the your Pi via SSH, run the following
Raspbian kernel image is two commands to attempt to
corrupted. An easy way to test reinstall the Pi kernel:
this is to use your computer to sudo apt-get update
install Raspbian onto a new sudo apt-get install raspberrypi-
microSD card, insert this new kernel
card into the Pi and try to boot. Once the update has
See www.raspberrypi.org/ the Pi’s SD card, insert it into If the Pi fails to completed, also edit the
documentation/installation/ a card reader, then connect load beyond this config file with the following:
installing-images for more this to a computer. The card’s screen, power off sudo nano /boot/config.txt
and insert the
information on this. second partition should contain Add the text boot_delay=1 on a
microSD card into
While this solution works well your /home/ folder. Make a new line. Press Ctrl + X, then Y,
your computer.
in theory, it can be a nuisance to copy of this to a safe place such then Return to save and exit.
have to configure your Pi all over as your computer’s desktop. Now try to boot the Pi again.
again. You might also have To try to repair Raspbian’s If the OS still won’t load, you’ll
personal files on the original kernel, you must run a system need to run a fresh install of
microSD card. If so, first back update. If the Pi will not boot Raspbian on another SD card
up your data: power off, remove normally, it’s best to try to as outlined above.
4
As the Raspberry Pi was Although it’s not essential for
invented in the UK, the mapping keys, you may also wish
default keyboard layout is to change your system locale,
British English. This can cause language and time zone to your
some headaches for users with own country. In the Localisation
US or International keyboards. menu select option 1 to list
Even when keyboards are various locales and languages.
manufactured in the UK, yours These use the two-letter country
may have a different layout or code (see below). You can of
extra keys. Fortunately the Pi course change this back to
can be configured accordingly. English at any time if you wish.
Open Terminal on your Pi or On the main menu, you can
connect via SSH and run the also choose option 2 to change
following command: your time zone. Raspi-Config
sudo raspi-config will first ask you to choose your
Use the arrow keys to choose general geographic area, such as Foreign Find the line reading
Option 4 (Localisation Options) Europe, before honing down to keyboard? XKBLAYOUT=”gb” and replace
and press Enter. Next choose specific countries. Change “gb” to “gb” with the two-letter code of
Option 3 (Change Keyboard If you have a foreign keyboard, the correct two- your keyboard country, such as
letter country “us”. You can find a full list of
Layout). This will allow you to usually selecting the correct
code for your
choose your specific model of locale will map the correct keys the two-letter country codes at
keyboard.
keyboard, such as “Apple”. Use to the Pi. If not, run the following www.worldatlas.com/aatlas/
the arrow keys to click OK to command to open the keyboard ctycodes.htm.
confirm your changes and save configuration file: Press Ctrl+X, then Y, then
the modified file. sudo nano /etc/default/keyboard Return to save and exit.
Spring 2017 // // 37
TOP 20 Raspberry Pi issues
5
The Raspberry Pi is If you’ve connected the Pi to The program itself takes only
designed to draw as little a touch screen, it’s usually not around 11MB. Once installation is
power as possible. For this too much trouble to tap it and complete, click the Pi Menu and
reason, by default the screen bring it back to life. However, if go to Preferences. You will see
will blank after around ten you are using a regular display there is a new option there
Click the
minutes of mouse and keyboard without a keyboard or mouse, named Screensaver. Click this,
Mode menu,
inactivity. This can be a huge then Disable the only way to wake the screen then click the drop-down menu
liability when you’re undertaking Screensaver to up is to connect a keyboard or labelled Mode, then Disable
various Pi projects, particularly stop the screen restart the Pi altogether. Screensaver in the main window.
where the Pi is being used to display powering Various well-meaning online If you wish simply to use
display the time or weather. off for good. contributors in Raspberry Pi an actual animated screen
forums have suggested some saver rather than disable it
command line hacking which altogether, note that the author
involves extensive use of the Pi of xscreensaver doesn’t
terminal and altering various recommend using this rather
values, which is not ideal for outdated version of the program.
newcomers to the Pi. You can When using xscreensaver you
in fact disable the screen saver may even see an alert to this
very easily from the Pi by effect. Consider installing a more
installing the screen saver recent screen saver utility such
management program as gnome-screensaver if you
xscreensaver. Open Terminal want something more colourful.
on your Pi and run the following To install this, simply run:
two commands: sudo apt-get update
sudo apt-get update sudo apt-get install gnome-
sudo apt-get install xscreensaver screensaver
Password problems
What is my password? Why can’t I see it?
6
Some newcomers to the to make sure it’s written
Raspberry Pi may be correctly. Next in the upper
surprised that no letters menu click Edit > Select All,
appear when typing passwords, then Edit > Copy. You can now
particularly in the Terminal paste the password into the Pi
program. This is a feature, not terminal when prompted by
a bug. Raspbian is based on holding Ctrl + Shift + V.
Debian Linux, and Linux is For multiple and/or lengthy
extremely security conscious, so passwords, consider using a
it doesn’t allow user passwords password manager such as
to be displayed. On the plus side, Keepass. Programs like Keepass
if this is a concern for you, you store all of your passwords in
needn’t worry – Raspbian is an encrypted database. This
behaving exactly as it should. database is protected by a Click the Add/Remove Software and enter
The default user password is “master key” – a single three dots next “Keepass2” in the search bar.
set to “raspberry” on first run, password which can be input to to the master Tick the first entry in the window
which isn’t too tricky to type. If retrieve the others. Password password field labelled “Password Manager”
to see what you
you do find you’re having trouble managers such as Keepass also and then click Apply at the
are typing. You
with this, first check that you allow you to right-click entries in bottom right.
can do the same
have the correct keyboard layout the database to copy and paste for other entries
Once it’s installed, you can
(see problem 4 on the previous the password into fields. This in the password then launch Keepass from
page). If this fails to resolve the can save an enormous amount database. Applications > Accessories. If
issue, go to Applications > of time and trouble. you need help getting started
Accessories > Text Editor and To install Keepass, go to visit the Keepass Forum at
type your admin password there Applications > Preferences > https://forum.keepassx.org.
38 // // Spring 2017
Raspberry Pi issues TOP 20
7
SSH (Secure Shell) is a Using your arrow keys, choose
set of network protocols Option 5 (Interfacing Options),
for securing connections then select it by pressing Enter.
between computers. In plain Next choose Option P2 (SSH).
English this means that you can Raspi-config will ask if you’re
use a utility on another device sure you want to enable. Press
such as a PC to control your Pi, Enter once again to confirm.
pretty much as if you were using You will see a confirmation
the Pi’s Terminal directly. Visit message stating “The SSH
www.raspberrypi.org/ server is enabled”.
documentation/remote- If you do not have a monitor,
access/ssh for information on don’t worry. Power off the Pi,
connecting to the Pi via SSH remove its SD card, insert it into
from different platforms such as a card reader, and plug this into
Mac (which has SSH built-in) or your computer. Find the /boot
Windows (which needs it added). partition and create a file there
Because your Pi has a default named ssh. You can use a text If possible, see a warning that the default
username and password, it editor such as Microsoft’s hook your Pi up password for the Pi user has not
could be targeted remotely by a Notepad or Apple’s TextEdit to to a monitor to been changed from “raspberry”.
hacker, and for this reason SSH do this but make sure that the enable SSH using To fix this, open Terminal and
raspi-config.
is disabled by default. If you can file has no filename extension enter the following command:
connect your Pi to a monitor such as .txt. Safely eject the SD sudo passwd pi
temporarily, you can enable SSH card and reinsert into your Pi. You’ll be asked to enter the
yourself. First open Terminal and SSH will now be enabled. new password twice. Note that
run the following command: The next time you load the Pi this command itself can also be
sudo raspi-config with a monitor attached, you will run over SSH.
Touchscreen troubles
Overcome the most common quibbles with the Raspberry Pi touchscreen
8
The official Raspberry Pi raspberry-pi-7-touch-screen- DSI ribbon – gently pull straight
7-inch touchscreen display assembly-guide) backwards with finger and
is an incredible add-on. Before attempting to thumb. The entire apparatus is
When combined with a battery assemble the screen, provide fairly delicate and, in keeping
pack and an on-screen keyboard, yourself with a flat, well-lit space. with the “bare bones” feel of the
it can even transform your Pi Make sure to run updates on the Pi, there’s no back case to the
into a mobile device. Pi to be certain you have the display, although you can buy
The touchscreen is designed latest version of Raspbian too: one separately if you wish.
so that the Pi can be connected sudo apt-get update The default setup can cause
via the DSI (Display Serial sudo apt-get upgrade issues if you want to use the
Interface) cable and screwed This handy The display comes with four GPIO pins for projects. The Pi
cable gives you
onto the back of the display. M.25 screws, so buy yourself a Hut has an innovative solution
use of the GPIO
Power is supplied by jumper suitable screwdriver. Make sure in the form of a Short MicroUSB
pins when using
wires which connect to the GPIO the touchscreen the display powers on correctly Power Cable which neatly
pins on the Pi so that it and the display. See before connecting anything attaches to the USB port, no
display can share power from http://bit.ly/ permanently. Be extremely messy wires required.
the same microUSB cable. pihut-microUSB careful when pulling out the If you wish to change the
Connecting the devices for information. small clamps which attach to the orientation of the touchscreen
requires a little time and display, open Terminal and run
patience. If you buy the display the following:
via the Pi Hut website, there is sudo nano /boot/config.txt
a link to assembly instructions Paste the text lcd_rotate=2 in a
(https://thepihut.com/ new line at the very bottom. Save
blogs/raspberry-pi- and exit. The display will reorient
tutorials/45295044- the next time you reboot.
Spring 2017 // // 39
TOP 20 Raspberry Pi issues
9
In September 2016, another machine to work with Player Wiki (http://kodi.wiki/
Adobe announced that it the Pi, but you need to be very view/HOW-TO:Install_Kodi_
will once again develop its comfortable with Linux and use on_Raspberry_Pi) for
Flash Player for Linux, having of the command line to do this. installation instructions.
previously abandoned the Instead, bear in mind that major If you are using Raspbian
project in 2016. This doesn’t sites such as YouTube and Daily with NOOBS, you can also
do much good for Raspberry Motion now stream video via simply restart the Pi holding
Pi users, though, because the HTML5, which the Pi supports. Shift to install the LibreELEC
player will not work with the Pi’s Flash is generally not required. Operating System, which is
Kodi Media
ARM processor architecture. player on the
The Pi is designed to be free specifically designed to display
There are unofficial plugins Pi can stream and open source. As such it does Kodi content.
for the Pi’s Chromium browser Netflix and Hulu not contain proprietary software If you wish to watch DVD
such as Pepperflash which can from a Windows for playing content encrypted by or Blu-ray discs, either via an
theoretically be copied from PC via PlayOn. various forms of DRM (Digital external DVD drive or from a
Rights Management) and “ripped” ISO image, you can also
streamed via providers such purchase an MPEG-2 and/or
as Netflix and Hulu. One VC-1 Licence key inexpensively
possible workaround if you from www.raspberrypi.com/
have a Windows PC in addition license-keys. In order to place
to your Pi is to install PlayON the order, you’ll need to provide
(available from www.playon.tv). your Pi’s serial number, which
This program enables you to you can find by opening Terminal
stream Netflix content from on your Pi or connecting via SSH
the PC to other devices such (see problem 7) and running the
as a Raspberry Pi running Kodi following command:
media player. See the Kodi cat /proc/cpuinfo
10
Since the Pi was first Foundation recommends using
launched, the cost of Guiformat (www.ridgecrop.
microSD cards with a demon.co.uk/guiformat.htm).
capacity of 64GB and more has Mac and Linux users can use
fallen, allowing for much greater their OS’s own disk utility to
amounts of data to be stored. If format the entire card to FAT32.
however you use the official SD Once this is done, continue
Card Formatter tool on the SD with installation of NOOBS onto
Association’s website (www. your microSD card by following
sdcard.org/downloads/ the steps at www.raspberrypi.
formatter_4) to format high- org/documentation/
capacity microSD cards, the Pi installation/noobs.md. Windows Another easy workaround for
might not recognise them. This Card still not recognised? users can use Raspberry Pi 3 users is simply
is because the tool uses the First visit the Pi Foundation’s the Guiformat to boot from a USB stick or hard
exFAT file format for cards over website for a list of other tool to prepare drive instead of an SD card.
the SD card. Mac
32GB in capacity, and this is not programs you can use to format Note, though, that this feature is
users can use
recognised by the Pi. a card (www.raspberrypi.org/ still experimental. You will need
the built-in Disk
In order to make sure your Pi documentation/installation/ Utility in macOS.
to enable USB boot mode on the
will recognise your high-capacity sdxc_formatting.md). If all Pi, as well as format the USB
card, first format it using the else fails, digital cameras use device in a specific way. For
official tool. Next use a third- a slightly different method for instructions, see the Raspberry
party tool to format the SD formatting microSD cards, so Pi website at www.raspberrypi.
card’s partition to FAT32, which you could try inserting the card org/documentation/
is recognised by the Pi. For and formatting it using your hardware/raspberrypi/
Windows, the Raspberry Pi camera’s built-in firmware. bootmodes/msd.md.
40 // // Spring 2017
Raspberry Pi issues TOP 20
Sound problems
Troubleshoot sound issues and select the correct speakers for output
11
If your Raspberry Pi codecs. Go to Applications >
is plugged into an Preferences > Add/Remove
HDMI television, Software and install VLC Media
sound will be output there and Player. This should enable your
should work out-of-the-box. If Pi to play almost all audio and
not, you will need to isolate the video formats.
issue to find out where the If the issue persists, then
sound problem lies. In the first double-check your Pi’s sound
instance, eliminate the obvious settings by opening Terminal
by clicking the volume control again and running the command:
during playback to make sure sudo alsamixer
the volume is turned up and is This retro interface allows
not muted. you to alter the volume of your Use the up/ sudo /etc/init.d/alsa-utils reset
If this fails to resolve the various sound devices (by down keys to Certain computer monitors
issue, find out whether this issue default there is just one) and control your connected by HDMI may not
is related to playing only certain even select another sound card device’s volume. output audio correctly. You also
Press F6 to
content by using Terminal to play if you have one. By default only may want to connect speakers
choose a different
some of the WAV files bundled playback devices are displayed or headphones to the Pi’s 3.5mm
sound card.
with the Pi. These files are saved but you can press F5 to include jack. If so, first open Terminal
in /usr/share/scratch/Media/ sound recording devices if you and run the following:
Sounds. For instance, run the so wish. sudo raspi-config
following command: If selecting the correct sound Choose Option 8 (Advanced
aplay /usr/share/scratch/Media/ device and increasing the Options), then Audio. This
Sounds/Vocals/Singer2.wav volume fails to fix the issue, try will enable you to switch the
If you hear sound, the issue is resetting your sound settings output between HDMI and the
likely to be related to media with the following command: headphone jack manually.
12
The Pi supports a error messages relating to it.
wide range of USB If the USB device is not listed
flash drives and other then there’s either a hardware
devices, and it’s usually a matter fault or it possibly requires more
of simply plugging and playing. If power than the Pi’s USB ports
however nothing happens when are able to supply. Consider
you first insert the device, try to buying a powered USB hub
hone down on the actual issue. from a Pi reseller.
Your first step should be to If the device is detected but
try the device with another non- still is not working, it’s possible
Pi computer such as a desktop that the Pi doesn’t have the Use dmesg or you cannot contact them,
PC to check whether it’s simply software drivers necessary to to check for don’t despair. There may be a
faulty. If it is, contact the seller interface with your USB device. any USB device community-maintained driver
or manufacturer about a To begin with, use Terminal to error messages. developed independently of the
Here a flash
replacement under warranty. run the following commands to manufacturer or the driver for a
drive has been
If it’s not faulty, open Terminal ensure you have the most recent similar device may work.
detected but was
on your Pi and run the following version of Raspbian: not unmounted
With the USB device still
command: sudo apt-get update properly. inserted run the following
sudo dmesg -C sudo apt-get upgrade command in the Pi Terminal to
Next insert your USB device and If updating your system fails to list all attached USB devices:
run the command resolve the issue, contact the lsusb
dmesg device manufacturer in the first Note down the device’s ID, e.g.
If your USB device has been instance to ask if there is a 1307:0163, and enter it into your
detected, then it will be listed suitable Linux driver. If the favourite search engine with the
here. You should also see any manufacturer says there isn’t words “Linux driver”.
Spring 2017 // // 41
TOP 20 Raspberry Pi issues
13
If you’re using the Pi device such as a mobile phone to change the wireless security
3, then Wi-Fi is built- to the same wireless network protocol to WPA (Wi-Fi Protected
in. If you’re using a to check if you have the same Access) or ideally WPA2.
separate USB wireless stick, difficulty. If possible, try to set If this fails to resolve the
follow the steps we’ve outlined If your Wi-Fi up a hotspot on your phone and issue, open Terminal on the Pi
network is not
under problem 12 on the attempt to connect to that from or connect via SSH and run the
listed, enter the
previous page to make sure the the Pi to further identify where following command:
settings here
stick itself isn’t the problem. manually. Use the issue lies. sudo nano /etc/wpa_supplicant/
Certain routers have an upper raspi-config If you are abroad, different wpa_supplicant.conf
limit on the number of devices to change the countries have varying This contains the name, settings
which can be connected to a country if the regulations on what Wi-Fi and password for all Wi-Fi
network. Try connecting a new code isn’t correct. channels can be used. You can networks connected to the Pi. If
configure the Pi to use these by your network is listed, verify that
opening Terminal and running the password and other settings
sudo raspi-config are correct. If not add your
Choose Localisation Options, network at the bottom of the
then Change Wi-Fi Country. You file in the following format:
will see a list of countries. Select network={
your current location using your ssid="your-network-ssid-
arrow keys. name"
The issue may be security. psk="your-network-password"
By default the Pi 3 cannot }
connect to any wireless network If you have an SD card reader
secured by WEP (Wireless this is also an excellent way to
Encryption Protocol). Contact connect your Pi to your Wi-Fi
the router manufacturer for help network without using a monitor.
14
One of the most for your specific gamepad on
common uses for the the GitHub page. For instance
Pi is as a retro games steps for the PS3 Controller
emulator. If like many others can be found at: http://bit.ly/
you wish to enjoy playing arcade RetroPie-PS3. The Raspberry
classics of the ’80s and ’90s, Pi 3 has built-in support for
your first port of call should be Bluetooth and will provide the
RetroPie’s GitHub page (http:// best performance. If you’re using
bit.ly/RetroPie-setup). other Pi models you will need a
Some users buy Pi bundles Bluetooth USB dongle to use
on sites like eBay which include wireless controllers.
the Pi itself, an SD card with For copyright reasons, Before into the computer and download
RetroPie pre-installed and some RetroPie does not come with using RetroPie the ROMs to there.
pre-installed games, known in any ROMs. If you have a legal make sure to The Internet Archive (http://
retro-gamer parlance as “ROMs”. copy of a ROM, the easiest read the “First archive.org) maintains large
Installation” page
If the microSD card doesn’t work method to transfer it to the Pi amounts of “abandonware”
on GitHub, which
out of the box, go through the is to create a folder named ROMs, which they claim are free
should resolve
RetroPie setup again to make retropie on a USB stick, then most common
to download. Make sure this is
sure you have the latest version. create another named roms issues. legal in your jurisdiction before
The latest version of RetroPie inside it. Safely eject the USB copying to RetroPie.
should automatically detect stick from your computer and For troubleshooting some
and configure most controllers insert it into the Pi. RetroPie will common sound, video and speed
connected via USB. If you want automatically create subfolders issues, visit the RetroPie wiki at
to set a wireless Bluetooth for various games consoles. You https://github.com/retropie/
controller, follow the instructions can then reinsert the USB stick retropie-setup/wiki.
42 // // Spring 2017
Raspberry Pi issues TOP 20
15
By default the Pi’s extends past what the monitor
display resolution is can display), then instead of
800x400 pixels. This disabling overscan, remove the
may well not cause any issues # at the start of the lines
but certain monitors are set up overscan_left, overscan_right,
for a higher resolution. On overscan_top and overscan_
startup the Pi will request a bottom, and manually adjust
monitor’s settings and if the Pi the values there, using negative
cannot find a suitable one, parts numbers if necessary to reduce
of the desktop may not display, the border size.
or the display may seem blurry, If the entire desktop displays
or possibly both. but is overly large or small, or
If you see a black border of the above steps fail to resolve
unused pixels, try to disable the issue, you may need to
overscan on the Pi. Open adjust your console size. Disable
Terminal or connect via SSH overscan as outlined above.
and run the command Make a careful Now find the line reading Next scroll down to the section
sudo nano /boot/config.txt note of any lines #disable_overscan=1 and use beginning uncomment to force
Before making any changes, you modify to the backspace key to remove the a console size. Remove the #
make a note of the original make sure you # at the start of the line. Press symbols at the start of the two
can revert to
settings in your config.txt file. Ctrl + X, then Y, then Return to lines beginning framebuffer to
previous settings.
That way if the display becomes save and exit. Reboot the Pi to set an alternative resolution. For
unreadable, you’ll be able to have the changes take effect. instance if the current height
connect via SSH or plug your If you have the opposite and width are 1280x720 you may
microSD card into a card reader problem in that parts of the wish to adjust this to 1024x768.
and restore the original settings. desktop are not visible (i.e., it Reboot to apply your changes.
Vanquishing VNC
Master the art of connecting remotely to your Pi’s desktop
16
VNC (Virtual on the colourful VNC icon to see
Network Computing) the connection details and the
is a way to control server signature, which is used
one computer remotely from to verify that no-one is trying to
another. This is especially handy spy on your connection.
in the case of the Pi as it allows If you have a web browser
you to use your computer that supports Java on your
keyboard and mouse. The most computer, simply navigate to
recent versions of Raspbian the address listed, e.g.
actually come with VNC Server http://192.168.4.87:5800.
software provided by RealVNC You will see a warning message To connect problem 7, page 39) and enable
pre-installed. This makes the first time you connect. to the virtual VNC by running the command
accessing the Pi much easier, Choose to continue and enter desktop, make vncserver
but for security this handy your Pi’s current username and sure to enter the This will start the VNC software.
feature is disabled by default. password. The desktop will entire IP address, You’ll see a message stating the
including the
In order to begin using it open appear in a new window and IP address of the virtual desktop,
colon and number
Terminal on your Pi or connect you can access it just as on for example:
e.g “:1”.
via SSH and run the command the Pi. If you don’t have Java- “New desktop is raspberrypi:1
sudo raspi-config enabled browser or prefer to (192.168.43.87:1)”
Go to Option 5 (Interfacing access the Pi from a mobile Make a note of this. Now in your
Options), then select VNC. Hit device, visit www.realvnc.com Java-enabled web browser go to
Enter while Yes is highlighted for links to suitable software. http://ipaddressofyourpi
and VNC will be enabled. If you’re running your Pi :5800. In the VNC Viewer enter
If you already have a monitor “headlessly” – without a monitor the IP address you noted to
attached to your Pi, double-click – then connect via SSH (see connect to the virtual desktop.
Spring 2017 // // 43
TOP 20 Raspberry Pi issues
17
Certain Pi projects, again manually. This is very easy schedule this using the tool
particularly those to do. To make a program launch Cron. Open the Terminal and
where the Pi is at startup, first open Terminal on run the following command to
continuously displaying your Pi or connect via SSH and open Cron:
information like the weather or run the command: crontab -e
This script
stock prices, work much better sudo nano /etc/rc.local Press Return to choose the
will launch
if they launch automatically. automatically
Find the line reading “exit 0”. default Editor. Scroll down to the
For instance if the Pi reboots on boot. Make It’s essential to place your very bottom of the file to add
after a power cut, it can be very sure to put any commands above this line. For your scheduled job. The basic
annoying to have to start the commands example, if you have a Python format for Cron is minutes/
various programs up all over above “exit 0”. script, you could paste the hours/day of month/month/
following above “exit 0”: day of week. Naturally you can
python /home/pi/stockticker.py & customise this however you
The ampersand at the end of want. For instance to schedule
the line tells the Pi to continue the script “check-temperature.
booting once it has run the sh” to run every hour, you’d add:
script. Press Ctrl + X, then Y, 0 * * * * /home/pi/check-
then Enter to exit and save temperature.sh
your changes. Save and exit in the usual way.
Some projects may require If you’re having trouble working
you to run a script at certain out how to write the scheduled
times of day. For instance you job in the timing format used
may have a script that by Cron, the helpful website
automatically checks the https://crontab.guru allows
temperature and sends you you to enter numbers to be sure
an e-mail summary. You can you have it exactly right.
Camera calamities
Iron out issues with official Raspberry Pi Camera Module
18
The Pi’s Camera slight click when the connector
Module V2 is designed is correctly in place.
to be easy to set up Once the camera is connected
and use, and is compatible with open Terminal on your Pi and run
the Raspberry Pi 1, 2 and 3. The sudo raspi-config
camera attaches via a ribbon Scroll to Option 5 (Interfacing
cable and usually works out-of- Options) and then press Enter
the-box. over the first option (Camera).
The Raspberry Pi Foundation Choose Yes to enable it.
website (www.raspberrypi.org/ If video is not working after
documentation/ you’ve enabled the camera, Assign at double-check your power supply.
configuration/camera.md) make sure you have connected least 128MB The camera draws around
cautions that the Pi Camera the camera ribbon to the CSI-2 of memory to 250mA of extra current. See our
Module is very sensitive to (Camera Serial Interface), not the GPU to be solution to problem 1 (on page
certain the Pi can
static. So it’s worth investing the DSI (Display Serial 36) for tips to ensure you’re
handle footage
in an earthing strap to ground Interface). Make sure also using a reliable adapter.
from the camera.
yourself before touching either that the ribbon connectors are Should the camera module
the camera or the Pi. Be seated straight in their sockets. still fail to load, try assigning
extremely gentle when pulling If the camera is enabled and more memory to the GPU. This
out the tabs on the end of each connected correctly, try running allows the Pi to handle video
connector to attach the ribbon the following commands to better. Open Terminal and run
cable. Gently push the tabs back ensure Raspbian is up to date: sudo raspi-config
on the camera end to lock the sudo apt-get update Choose option 7 (Advanced
cable in place or you may find it sudo apt-get upgrade Options), then Option A3
comes loose. You should hear a If the camera is still not working, (Memory Split) to set this.
44 // // Spring 2017
Raspberry Pi issues TOP 20
Unavailable software
Unable to install new programs, or unsure what programs to use? All is not lost...
19
Although the Pi no Ideally you should do this before
longer has a dedicated attempting to install any new
app store, clicking applications. It can’t hurt to run
Applications > Preferences > the following as well to make
Add/Remove Software will open sure you have the most recent
a window which enables you to version of the Add/Remove
choose from the various Software program:
programs available in the Pi’s sudo apt-get upgrade
software repositories. If you’re uncertain whether a
Categories are available on program is available for the Pi, Case in point: first to see if there is an ARM
the left, and you can click on use the search bar in the Add/ The official version of the software available.
individual programs to see a Remove Software window or run Dropbox client If there isn’t but the developer
more detailed description before the following command (be sure doesn’t run on has provided the source code of
the Pi but the
installing. Sometimes, however, to spell the program correctly): the program, you can attempt
open source
the Add/Remove Software sudo apt-cache search compiling it yourself on the Pi.
alternative
window may hang or say it is <softwarename> Sparkleshare is
This is tricky to get right, can be
unable to find a package. If the software seems to be compatible. time-consuming, and usually
If this happens it’s most likely unavailable for the Pi, use your requires additional software
because your software sources favourite search engine to see if libraries as well as the source
are out of date. Click Options at there’s a suitable alternative. Not code. Visit www.aboutdebian.
the top left of the Add/Remove all programs will work on the Pi, com/compile.htm for a basic
Software window and choose even if there’s a Linux version, introduction to transforming raw
Check for Updates. Alternatively because the Pi has an ARM code into a workable program.
open Terminal on your Pi or processor rather than Intel, like Use the most recent version of
connect via SSH and run: most desktop machines. the source code unless you’re
sudo apt-get update Check the developer’s website specifically told otherwise.
20
While we’ve covered occur with a cabled device?
some of the more If you conclude that the
common problems problem relates specifically to
with the Pi, there is a near the Pi itself, then consider
infinite number of ways in posting on the Raspberry Pi
which yours can be set up, so forums (www.raspberrypi.org/
there’s no way to cover every forums) to ask for help. Do this
eventuality. Whatever your even if you see that someone
problem, however, there are has posted about a similar issue, Providing see if you can contact the
some standard troubleshooting because they may have used links to any developer or find a user forum
approaches you can try. Even an older version of the Pi and/or accessories for that program. The same
if you’re not very experienced Raspbian. Your first post must be you purchased holds true for hardware devices,
enables other
with computers, try to eliminate pre-approved by a Moderator, so although the Raspberry Pi
users to check
likely or possible causes before do not be surprised if you don’t forums may be able to point you
the exact model
concluding that the Pi must see it right away. number.
in the direction of the correct
be physically faulty or that you Try to include as much software driver (see above).
have done something wrong. information as possible in your If after troubleshooting you
Does the problem occur post. If you are receiving long find that your Pi falls into the
when you use a different power error messages, use PasteBin 0.01 percent of devices which
adapter? Does running an (http://pastebin.com) to copy actually are faulty, contact
update or trying using a new and paste the text, then provide your Pi distributor to arrange
microSD card make any the link to this in your post. a replacement or a refund. Do
difference? If you use wireless If your problem relates to not contact the Raspberry Pi
peripherals such as a keyboard using one specific program and Foundation – it does not sell
and mouse, does the same issue the Pi otherwise works properly, the devices itself.
Spring 2017 // // 45
THE EASY WAY TO
LEARN WINDOWS
100%
JARGON
FREE
61
48 48 Play Doom
on your Pi
53 Make any
printer wireless
56 Create a Pi
Media Centre
61 TalkiePi: Make
a walkie-talkie
66 71 66 Protect yourself
with a firewall
71 Build a Pi-based
photo gallery
September 2016 // // 47
Spring 2017 // // 47
Love it or hate it,
Doom redefined the
gaming industry.
48 // // Spring 2017
Chocolate Doom PROJECT
Spring 2017 // // 49
PROJECT Chocolate Doom
DOOM DEATHMATCHES
Chocolate Doom supports multiplayer with minimal fuss. Whether you play multiplayer over the internet or via a LAN,
Unlike “Vanilla Doom”, you can play Chocolate Doom either one of the participating players must act as the server and host
over the internet or via LAN (local area network). To keep things the game. Rest assured that the host player will be able to play
simple, however, make sure all the players who wish to take part the game too. UDP port 2342 must be open on each player’s
are running Chocolate Doom and using the same WAD file router and/or firewall. (See “The Doom is in the Details” on the
before going ahead. next page for more info.)
To host a Deathmatch game on your Pi, open Terminal or
connect via SSH and run the following command:
chocolate-doom -server -privateserver -deathmatch
In order to join your game, internet players should run the
following command:
chocolate-doom -connect 1.2.3.4
Replace 1.2.3.4 with the public IP address of the host player’s
machine. You can find your public IP by visiting websites such as
http://whatismyip.com.
For players who are connected to a local network, life is even
easier: simply run the game in the usual way but add the
argument -autojoin, for instance:
chocolate-doom -WAD DOOM1.WAD -window 640x480 -autojoin
The multiplayer window will be displayed, showing the various
clients which are connected. Press the space bar when ready to
start playing.
Further help for Multiplayer Mode, if you need it, is available
from Chocolate Doom’s Wiki: www.chocolate-doom.org/wiki/
When all players have joined, press the space bar to begin. index.php/Multiplayer
Doom Enthusiasts refer to “Vanilla Doom” to The only area where Chocolate Doom differs
Pi bites distinguish between the official game engine for significantly from the original is when playing in
Budding coders
running Doom and any variants. The distinction is the multiplayer Deathmatch mode. One player’s
can view the important because the Doom Engine was modified machine has to act as a server, unlike in Vanilla
original Doom and re-used in several commercial games such as Doom where players would connect directly to
Source code Heretic and Hexen. each other. Fortunately this is very easy to set up
at https://
Since id released the source code of the Doom (see Doom Deathmatches above).
github.com/
id-Software/ Engine in 1997, a number of community developers
DOOM have also adapted it to their purposes. Chocolate Where’s all the Data?
Doom is one such project. To play Doom you’ll need both the engine and
Despite modifying the game engine, Chocolate some so-called WAD files. WAD (Where’s All the
Doom aims to reproduce the experience of playing Data) files contain game data such as details of
TeamTNT’s
Eternal Doom
the original version of Doom as much as possible. levels, graphics, sound effects and background
was praised for Any modifications to the original game engine do music. The idea behind WADs is to make it easy for
its rich graphics, not interfere with the authentic gaming experience. people to make custom levels and modifications
stunning More importantly Chocolate Doom strives to be for the game. WADS exist separately from game
architecture compatible with all Doom Expansion files (WADs) engines such as Chocolate Doom and must be
and huge levels. that were designed to work with Vanilla Doom. downloaded from elsewhere. There are two main
types of WADS. For the purposes of this project
we’ll focus on iWADs (short for internal WADs),
which contain data for entire levels.
When Doom initially came out, although
enthusiasts were keen to jump on the bandwagon
and start creating new graphics, sound effects
and so on, they couldn’t do much to change some
of the game’s fundamental values such as how
much damage was dealt by monsters. Since the
release of Doom’s source code and some
remarkable efforts by the community at large,
however, all aspects of the game can now be
changed and there are thousands of WADs. Some
of these are simply slight alterations to the game
itself, whereas others expand hugely on the
premise of the original game. One of the best
known of these “MegaWADs” is Eternal Doom,
which contains 32 full levels, each of which is
50 // // Spring 2017
Chocolate Doom PROJECT
Spring 2017 // // 51
PROJECT Chocolate Doom
52 // // Spring 2017
The Pi simply
needs to connect
to the printer
via USB before
you install the
software. You
do not need
to connect to
a monitor for
this project.
H Chateau Petrus 2012, petrol and USB port, to which you can connect any printer. Pi bites
milk have in common? The answer In this project we will explore how to connect your
Remember, if
is that, measure for measure, they Pi to an old-style wired printer via USB to make it you’re running
are all less expensive on average possible for anyone connected to your wireless short of mains
than printer ink. network to print to it. plug sockets and
The trend these days is that manufacturers have a micro USB
sell reasonably priced wireless printers but rather Printer preparations cable you can
power your Pi
costly ink. We do not mean to demonise printer One of the excellent features of this project is that from a USB socket
companies – the costs of raw materials such as it works with any model of Raspberry Pi, and you on a computer.
resin and oil have also increased in recent years – can even install additional software on the Pi after
but anyone who prints at home regularly knows you’re done. For a quick and easy setup use the
that this can blow a huge hole in your budget. Raspberry Pi 3 as this has built-in wireless.
Some people invest in laser printers, which – Aside from that you will need to connect the
while more costly up-front and typically used only Pi to the printer via a USB cable and switch both
for black-and-white documents – can hugely the Pi and the printer on before
reduce your printing getting started.
expenses. Older laser This project assumes that
printers in particular you are comfortable with
are very efficient... but accessing the Pi over The HP
many do not have SSH and that it is LaserJet Pro
support for wireless, already connected to P1102 is relatively
inexpensive but
and those that do your wireless network.
connects by
are sometimes not Once the Pi is USB only and is
compatible with the connected, we will incompatible with
most recent versions of install CUPS (Common Windows 10. Use
Windows or Mac OS. Unix Printing System) the Pi to turn it
Enter the Raspberry in order to discover and into a working
Pi. The Pi can connect to set up your particular wireless printer.
Spring 2017 // // 53
PROJECT Make any printer wireless
CUPS is
your printer. You can do this by opening the
developed by
Apple for its OS
CUPS web interface and clicking Manage
and other Unix Printers. Click on your own printer to get the
based systems, right address for it, which will be something like
such as Linux. https://192.168.1.2:631/printers/Canon_
It manages MG4200_series
print services If you’re using a Mac, try following the steps
for some of the on Apple’s support website at https://support.
most popular apple.com/en-us/HT202167. Enter the IP
versions such as address of the Raspberry Pi – for example
Ubuntu Linux.
printer. You don’t have to do this directly on the Pi 192.168.1.2 or whatever it is in your specific case
as CUPS can be accessed over a web browser on – to set up the printer. If the Mac fails to find the
any device connected to your home network (see printer, you may wish to follow the steps on the
Connecting to CUPS on the opposite page). excellent Pi3g Blog to set up an AirPrint Service
CUPS quite simply is a printing manager on the Pi: http://bit.ly/Pi3g-AirPrint.
which can transform your Pi into a print server, In either case if you’re asked to specify a print
capable of accepting print jobs across your protocol, the CUPS manual recommends to use
wireless network from other devices and then HP JetDirect, which is seen as the most reliable.
sending them to your printer. If you’re using Linux, setup should be very
This project is focused on printers that connect simple, as CUPS was made specifically for it.
over USB, but will also work for wireless printers However, almost every version of Linux has a
even if they no longer work with your particular different way of setting up printers. For more
operating system. On the whole, most Linux information, see www.linux.com/learn/how-
users tend to upgrade equipment less often manage-printers-linux.
than software, so you may find that your computer
will be able to print via CUPS even if it couldn’t Printer hicCUPS
connect directly to your printer. When connecting to the CUPS web interface for
the first time, you might receive a warning that
Post setup your connection is insecure. This is because your
Once you have followed the steps here and CUPS Admin page’s security certificate has only
Pi bites successfully printed a test page from the CUPS been signed by the Pi (known as a “self-signed
web interface, you will most likely want to add your certificate”) and not a third party certificate
If you don’t new wireless printer on your computer. authority. There is no cause for concern as you
yet own a laser
printer, try to find
The steps for doing this will vary depending on will have set up the page yourself, and you can
one that supports your setup. For Windows 10 users, it’s best to tell your web browser to make an exception for
duplex (double- follow the steps outlined on the Microsoft support CUPS to allow you to connect in future.
sided) printing. website http://bit.ly/Win-10-addprinter. If your Although CUPS has drivers for most printers, if
This saves on both
printer isn’t listed, simply select the option saying it cannot find yours then you will need to locate a
energy and paper.
so. You’ll be asked to type in the exact location of PPD (PostScript Printer Description File) for your
1 Install CUPS and other 2 Modify CUPS to allow 3 Add your user to
useful packages Remote Access admin group
Open Terminal on your Pi or connect This step is optional but Again in Terminal or over SSH enter
via SSH and run the command: recommended as it allows you the following command, replacing
sudo apt-get install avahi-daemon to access the CUPS web interface “yourusername” with the appropriate
cups cups-pdf python-cups from another browser on your user name:
The installation process will take some network. See “Connecting to CUPS” sudo adduser yourusername lpadmin
time as CUPS downloads drivers for for information. This will make sure you can
some common printers. administer printers.
54 // // Spring 2017
Make any printer wireless PROJECT
CONNECTING TO CUPS
By default, when you install CUPS on your Port 631
Raspberry Pi, the web interface can be Next, scroll down to the section reading
accessed only on the Pi itself. This can be a “Restrict Access to the Server” and look for
nuisance if you cannot connect the Pi to the the words “Order allow, deny”. Put a new line
printer, keyboard/mouse and a TV screen at after this with the following words:
the same time. Allow @Local
Fortunately it is possible to modify the Scroll down to the next section headed
CUPS configuration file to allow access from “Restrict Access to the Admin Pages” and
other devices on your home network. First once again after the text “Order allow, deny”
connect to your Pi over SSH and run the place the words “Allow @Local”. Finally
following command: scroll down to the next section, reading To enable remote access to CUPS, first type
sudo nano /etc/cups/cupsd.conf “Restrict Access to Configuration files”, and a hash sign on the two lines after “Only listen
Scroll down until you find the text “Only again insert “Allow @Local” after the text for connections from the local machine”.
listen for connections from the local “Order allow, deny”.
machine”. Type a # at the start of each of the Press Ctrl+X, then Y, then Return to save You will now be able to access the CUPS
next two lines to comment them out, then and exit. Restart the CUPS service to apply interface from any web browser connected
on a new line after this, type the following your changes with the following command: to your local network by visiting https://
text (see the illustration): sudo service cups restart yourpiIPaddress:631.
printer. This file simply details your printer’s After you’ve got
specifications such as paper size, available everything set
fonts, resolutions and so on. You may be able to up, you’ll be able
download this file from the printer manufacturer’s to manage your
printer just as if
website or get help by contacting its technical
it were connected
support number. directly to your
If no driver is available, or you still haven’t computer.
decided which printer to buy, the Open Printing
website, which is affiliated with the Linux
Foundation, has an extensive database of printers
that are compatible with Linux and therefore
should be compatible with CUPS running on the
Pi. Visit www.openprinting.org/printers for
more information. scan wirelessly by downloading and installing
If your device is a multifunction device printer- SANE (Scanner Access Now Easy). The Pi3g Blog
scanner or you also have a USB scanner you’d like has an excellent tutorial on this at http://bit.ly/
to use wirelessly, then you may also be able to Pi3g-scanner-share.
Spring 2017 // // 55
A preview of
things to come.
Kodi’s menus
are very easy
to navigate.
Videos will
continue to
play in the
background if
you’ve already
selected them.
Create a Pi-based
Media Centre
We show you how to make your Pi a one-stop media centre – for movies, TV
shows, music and internet streams – through the power of LibreELEC + Kodi
ouldn’t it be great if you could have website (www.raspberrypi.org/documentation/
56 // // Spring 2017
Create a Pi Media Centre PROJECT
Spring 2017 // // 57
PROJECT Create a Pi Media Centre
KODI CODECS
The licences to use the AVI and WMV codecs can be bought cat /proc/cpuinfo
inexpensively from the Raspberry Pi website. The MPEG-2 codec, Copy down the 16 digit number next to “Serial”.
which allows playback of .avi files, costs £2.40, and the VC-1 Next visit www.raspberrypi.com/license-keys and click on
codec, which allows playback of .wmv files, is £1.20. Bear in mind the name of the codec you’d like to buy. Enter your serial number
that there are a number of media files LibreELEC will play out-of- in the box marked “Serial”, then Add to Cart. Your licence key for
the-box and you will not need these codecs to stream video the codec will be sent to you via e-mail within 72 hours.
through YouTube and so on. Once you have received the licence key, connect to your Pi via
In order to proceed you will need your Pi’s serial number. To get SSH once again. Use the following commands to open your
this, open Terminal on the Pi or connect via SSH and run the configuration file:
following command: cd /boot
sudo nano config.txt
Next paste your licence code(s) at the bottom in the following
format:
decode_MPG2=0x00000000
decode_WVC1=0x00000000
Replace the “0x00000000” in each case with the actual licence
key you received by e-mail.
Press Ctrl + X, Y, then Return to save and exit. Reboot your Pi
for the changes to take effect. Kodi will now be able to play back
files in these formats.
Paste your Pi’s serial number, then click Add to Cart for each
codec you want to purchase.
Kodi will automatically check for new content The YouTube add-on is one among hundreds
Pi bites and use scrapers to download the necessary available. Browse the “Look and Feel” category to
metadata for you each time it starts. select a different skin for Kodi. You can also add
The LibreELEC
website also has
automatic downloads for subtitles from popular
a handy tool to A word on add-ons websites such as OpenSubtitles.org from the
automatically Kodi can download enhancements to allow it do Subtitles category.
download the OS much more than play media files. These can be If you do choose to install add-ons, try to make
to an SD Card. See
installed via the AddOn Manager. For instance to sure you install just one for each purpose. For
http://bit.ly/
LibreELEC-SD for install the YouTube add-on, go to the Kodi main instance there’s no need to have more than one
more information menu and go to System > Settings. Next choose scraper for movies and it can cause errors.
Add Ons from the menu on the left. Scroll down to
Video Add Ons, select this, then go through the list Remote Access
to select YouTube, then click Install. The Kodi server can be accessed remotely via SSH
Once the installation is complete you can and Samba file sharing, but this is more for adding
The YouTube
access YouTube from the main menu by going to new content and maintenance. If you wish to
search in action.
Complete the
Videos > Add Ons, then clicking YouTube. The first access the server in order to play content, head to
setup wizard to time YouTube runs within Kodi, you will be asked System > Settings > Services > Web Server. Click
access the main to sign in and choose your language and region. the option to “Allow Remote Control via HTTP”. You
menu and look From there you can select a video in your playlist may set a password here if you wish but by default
for fluffy kittens. or search for others. it’s blank. The web interface is quite simplistic by
default but can be used to have your Pi play
content without using a keyboard or mouse.
If you want to use the official Kodi Remote App
on your mobile device, you should also click the
Remote Control tab in this Settings > Services
window and highlight the option to “Allow Remote
Control by programs on other systems”. In order
to set this up, you will need to know your Pi’s IP
address. To view this, connect to the Pi via SSH
and run the command ifconfig . Alternatively
install the handy app Fing to your mobile device,
which will list the IP addresses of all devices
connected to your network.
AirPlay support
Thanks to changes made by Apple to its wireless
protocol, AirPlay is not very well supported any
more in Kodi. Users of iOS 9 or newer devices can
stream downloaded music via AirPlay by going to
58 // // Spring 2017
Create a Pi Media Centre PROJECT
System > Settings > Services in Kodi and changing Be warned – installing LibreELEC will replace
the Settings Level at the bottom left. Click the the Raspbian OS on your microSD card, along with
AirPlay tab on the left. Click “Enable AirPlay any files you created and/or downloaded. Either
Support” and disable “Enable AirPlay ‘Videos’ and obtain a fresh SD card with NOOBS installed or
‘Pictures’ Support”. The Pi should now appear as back up any files on your existing card before
an AirPlay device on your Apple devices. AirPlay setting up your media centre.
support is patchy, though, depending on your Should Kodi be unable to see your external
version of iOS, so do not be surprised if this drive, this may be because the drive requires more
doesn’t work. Visit http://kodi.wiki/view/ voltage than the Pi’s USB ports can deliver. Try
AirPlay for more information. again using a powered USB hub.
Spring 2017 // // 59
PROJECT Create a Pi Media Centre
Pay close If you have issues with playing certain video If you’re having video or audio issues, from
attention to files, this may be due to missing codecs. These are the main Kodi menu go to System > Settings
file names to computer programs for encoding/decoding large and select either “Video Output” or “Audio Output”
make sure the data files such as video. There are hundreds of to adjust your resolution or change your sound
metadata is
different codecs but they’re generally considered channels, among other options.
correct. Place
a necessary evil as they help to compress media Finally, make sure that you either have the
the year of the
film in brackets files to a size where they can be easily managed permission of the copyright holder to download
after the title. and shared over the internet. any films or TV shows, or that they are in the
The year 1968 Public Domain. Because of differing copyright
has been added Codec confusion laws there is no one definitive list of public domain
to the above film Some codecs are free, open and unpatented, such films, but the Internet Archive (www.archive.org)
to distinguish it as Ogg Vorbis, which can be used to encode music is an excellent place to start.
from the 1990 files. As a result, computer manufacturers can
remake. bundle them with devices so they can be played
out of the box. Other codecs are proprietary, in
that they can be downloaded and used only on
payment of a licence fee. In order to support the
principles of free and open software (and keep
Pi bites costs down), the Raspberry Pi doesn’t include
such codecs.
Select the In practice this can mean that if you try to play
Programs media files in quite common formats such as
category, then Windows Media Video (.wmv) or AVI (.avi), you
“Get More” from
may find LibreELEC doesn’t have the right codec
the Kodi main
menu for extra to play them. Follow the steps in Kodi Codecs on
apps to check page 58 to download and install them.
your e-mail, If movies and TV shows you add do not display Kodi can automatically check for new content and even
post to Facebook, correctly, make sure you have followed the naming
chat on IRC and
use scrapers, mini-programs which download metadata for
much more.
conventions as laid out in the Kodi Wiki, being sure TV shows and films for you. The default scraper is The Movie
to include the movie year. Database (themoviedb.org).
60 // // Spring 2017
Image credit: Daniel Chote, http://chote.com
TalkiePi: Make
a walkie-talkie
Nate Drake tickles your nostalgia bone with Daniel Chote’s awesome
TalkiePi project to create a retro-style Wi-Fi walkie-talkie
hose who have been following the The interface of the TalkiePi couldn’t be simpler.
Spring 2017 // // 61
PROJECT TalkiePi
62 // // Spring 2017
TalkiePi PROJECT
come in packs so you should be able to make as casing as well as the speaker cover for you. A
many TalkiePis as you’re likely to need. simple search online for 3D print services in the
Pi bites
UK will reveal any number of companies who are If you wish to
Buttons and pins happy to make as many or as few parts as you customise your
The basic setup for the GPIO pins is easy to grasp. need. The usual procedure is that you will fill in an TalkiePi further,
There’s an LED built into the pushbutton on the online web enquiry form and upload the STL files PLA doesn’t
work well with
front of the TalkiePi itself which lights up when to the 3D printing company’s website and they regular paint but
you’re transmitting. There are also two separate will contact you with a quote. One such firm we you can achieve
“online” and “participant” status LEDs. contacted to enquire about two sets of TalkiePi top good results
If this is your first project, it’s best to work casing, bottom casing and speaker covers quoted with acrylics
or nail polish.
through the steps on the website on your £142.54 for manufacturing and shipping the parts!
Alternatively use
breadboard before you solder anything. Also Considering that DIY 3D printers now retail for as coloured tape.
pay close attention to the GPIO diagram on little as £178, you may prefer to either invest in one
the website before you start. For full assembly or find a friend who will let you use theirs.
instructions, visit the main project page at
http://bit.ly/Wi-FiWalkieTalkie. Safety in Mumbles
If you decide to mimic the TalkiePi project, you Mumble servers are highly customisable, and it’s
don’t necessarily have to use a 3D-printed case, possible to create select groups or channels for
but it’s certainly much handier to have trailing everyone you wish to talk with. For instance, you
wires boxed up. The actual 3D designs for the may prefer that your friends playing World of
casing as well as the speaker cover are based on Warcraft can’t hear everyone who buzzes your
a retro walkie-talkie, and you can find them on front door intercom. If you do set up your Mumble
Daniel Chote’s GitHub page https://github.com/ Server (see Managing Mumble, over the page),
dchote/talkiepi/tree/master/stl. The STL make sure to group conversations together. You
(StereoLithography) file format is compatible with may need to use the go run command each time
most 3D printers. The TalkiePi project was done you switch channels.
on a Monoprice Select Mini 3D printer using PLA To prevent your conversations being monitored,
plastic with 100 percent infill. PLA has the you should also consider generating an SSL
advantage of giving off a pleasant sugary smell certificate for your Mumble client (see Certified
when printing as well as being quite sturdy. Mumbler below for information on how to do this).
Bear in mind that the casing was designed If you choose to install the standard Mumble
specifically for the US Robotics speakerphone client, it comes with its own certificate, but you
listed on the website, so other speakers may not can choose to generate another in your own name
fit as well. Carefully check the dimensions of your by running the certificate wizard – see www.
components to avoid wasting precious material. mumble.com/support/mumble-creating-a-
If you already have a 3D printer you will most certificate.php. This enables you to generate a
likely be comfortable enough from previous self-signed certificate, which is ideal for a small
projects to simply produce the parts yourself. If group of people. If you plan to open your Mumble
you don’t have a 3D printer, then it’s best to ask a server to the public, you may wish to obtain a
third-party company to make the top and bottom trusted certificate from a bona fide certificate
CERTIFIED MUMBLER
Mumble software, like the TalkiePi when asked press Return to choose the
program, can use certificates to connect default options such as location, e-mail
to Mumble servers. This avoids the need address etc. Next run the following:
for typing in passwords and allows you to openssl rsa -in key.pem -out nopasskey.pem
register accounts easily with new servers. Enter the password one last time. Finally
By default, this feature is switched off in run the following to combine your files into
TalkiePi as Daniel Chote’s own server, a single certificate:
which he set up for his children, doesn’t cat nopasskey.pem cert.pem > mumble.pem
require certificates. If you wish to use other Now switch back to the root user with:
Mumble servers, however, connect to sudo -i
your Raspberry Pi via SSH, then run su Then use the following command to edit
mumble to switch to the Mumble user and Mumble’s configuration:
cd ~ to switch to the home directory. nano etc/systemd/system/mumble.service
You’ll need to generate a container for Scroll to the following line:
your certificate with the command: ExecStart = /home/mumble/bin/talkiepi You can generate a certificate from the
openssl genrsa -aes256 -out key.pem Leave a space and type the following on command line or alternatively if you can
You’ll also be asked to enter a password. the same line, replacing “yourusername” connect your Pi to a monitor and use the
Next create the certificate itself with the with your user name: Mumble client’s easy certificate wizard.
following command: -username yourusername -certificate /
openssl req -new -x509 -key key.pem -out home/mumble/mumble.pem changes. The Raspberry Pi will now use
cert.pem -days 1095 Press Ctrl+x, then y, then Return to save a TLS certificate when connecting to
Enter the same password as before and and exit. Finally reboot the Pi to effect your supported Mumble servers.
Spring 2017 // // 63
PROJECT TalkiePi
64 // // Spring 2017
TalkiePi PROJECT
MANAGING MUMBLE
In order to make sure your setup is secure also think of a username you’d like to On the line beginning username you
you’ll need your own Mumble server. You register and set up a channel specifically may wish to insert a permanent username
can set this up yourself on a separate for you and your friends. (The default is between the quotation marks. Enter a
Raspberry Pi if you plan on communicating Root.) Next connect to your Pi via SSH or password only if your Mumble server
only over your home wireless network, for open the Terminal and run the following requires one.
example for an intercom. Alternatively, you command to edit TalkiePi’s configuration: If you have previously created a
can rent a Mumble server online. If you sudo nano /home/mumble/gocode/src/ certificate, find the line starting insecure
want to play around with a Mumble server github.com/dchote/talkiepi/cmd/talkiepi/ and change true to false. Press Ctrl+x,
of your own you can get a free one-month main.go then y, then Return to save your changes.
trial at www.mumble.com/free-mumble- Scroll down to the line beginning server Finally to start the TalkiePi software with
server.php. and replace the TalkiePi server address your new settings, run the following:
Once your server is set up, note down talkiepi.projectable.me:64738 with your go run /home/mumble/gocode/src/github.
the domain name and its port. You should own, e.g. natedrake.mumble.com:64248. com/dchote/talkiepi/cmd/talkiepi/main.go
Spring 2017 // // 65
The tiny
Raspberry Pi
can become your
bulwark against
online threats of
all kinds.
66 // // Spring 2017
Pi-based firewall PROJECT
DOMAIN DENIAL
Its full name, Uncomplicated Firewall, might to view an objectionable page’s IP address –
sound modest, but Ufw is a powerful firewall for instance:
and can be used to block access to certain host strawberryfunk.com
websites. Although technically you can also This will output the IP address of the site in
do this with dnsmasq, this would be a form question. Next, use ufw deny to block this
of “DNS hijacking”, which is a rather dastardly domain – for example:
procedure usually carried out by scammers. sudo ufw deny out from any to 205.178.189.29
The advantage of using Ufw is that it blocks You can check that the domain has
domains by IP address. This means you have successfully been blocked by using ping –
to write down only one rule per address rather for example:
than remember the various domains and ping -c 1 strawberryfunk.com
subdomains used by sites. Imagine trying to If you have set up Ufw correctly, ping will
block every variant of Facebook.com, for report that the domain is unreachable. Use ping to check that a domain has
instance – fb.com, m.facebook.com... the list Ufw can also block outgoing connections been successfully blocked. Some websites
goes on. to certain ports. For instance if you want to have more than one IP address, so block
It stands to reason, then, that in order to reduce the chance of your Pi being used to each of these in turn.
block websites by IP address you’ll need that send spam messages, you can disable Port 25
information. Open Terminal on your Pi or with the following:
connect via SSH and use the host command sudo ufw deny out 25
Spring 2017 // // 67
PROJECT Pi-based firewall
68 // // Spring 2017
Pi-based firewall PROJECT
Spring 2017 // // 69
PROJECT Pi-based firewall
70 // // Spring 2017
Build a Pi photo gallery PROJECT
While pictures
of your favourite
fruits and Turner-
esque sunsets
are innocuous
enough, you
may prefer to
be certain that
pictures of
your loved ones
stay private.
Build a Pi-based
photo gallery
We show you how to view, collate and organise your favourite
snaps by setting up an easy photo server on the Raspberry Pi
hese days most of us have thousands We’ll be using the most recent version of SFPG
Spring 2017 // // 71
PROJECT Build a Pi photo gallery
72 // // Spring 2017
Build a Pi photo gallery PROJECT
Spring 2017 // // 73
GET THE MOST FROM
YOUR RASPBERRY Pi
OUT
NOW!
WITH
FREE
DIGITAL
EDITION
76
78 80
78 How to install
Raspbian
81 82
80 Install NOOBS
with any OS
81 Use Linux to
install Raspbian
82 Using networks
and the internet
Spring 2017 // // 75
GET STARTED Get connected
Display me
have owned or used in the past. keyboard, a mouse, a display and Technically, the Raspberry Pi
That is to say, it has a processor, a compatible SD card. In today’s works with most types of
memory and storage and, in environment, it’s going to be displays using the correct cable
order for you to use it, it requires useful to at least have a wired or adaptor. It’s envisioned to be
being connected to all the usual internet connection around, or used with an HDMI monitor but
peripherals – a display, inputs a suitable USB wireless adaptor works with older monitors with
and more. For most people, this for wireless networking. The a DVI adaptor or an HD TV.
should be straightforward, but final touch would be desktop With the HDMI connector, both
there are some finer points that speakers. On a technical level, the Pi and the display should
you should know about – details peripheral support is provided automatically configure
about the correct SD card to by the Linux kernel that powers themselves correctly; we’ve
the Raspbian OS, but more on successfully used the Raspberry
that later… Pi on a 4K display without issue,
beyond manually setting the
Need input! higher 4K screen resolution.
Ever since the Model B+, the It’s possible to connect the
Raspberry Pi has been well Pi to an old TV or monitor
furnished with four USB ports. using an analogue composite
This ensures that it’s easy to connector – this is usually a
connect all the peripherals you round yellow RCA connector.
need. The base minimum of With the Pi, the 3.5mm jack
these is a USB mouse and that’s usually used for stereo
keyboard for standard input – audio output carries an extra
especially considering you’re line for the video. To access this,
able to get keyboards that you need a 3.5mm jack to stereo
provide additional USB ports, and composite RCA.
helping to save one or more on
ON THE CASE the Raspberry Pi itself. Sounds good
Pretty much any keyboard The Raspberry Pi is perfectly
We admit, it can be unnerving having a naked and mouse should work, but capable of producing plenty
Raspberry Pi sitting on your desktop, and it’s don’t expect support for any of audio, and later we’ll see
certainly true that it could short on random wires, unusual buttons (you’d be projects that enable the use of
screws or metal surfaces. So, a common extra that surprised at how many do the Pi as an audio streamer and
people get for their Pi is a suitable case. At this work, though...). media centre. You can get audio
point, there’s quite a range available, and many leave
The important thing to out of standard Pis in two ways.
the GPIO pins and other ports open for easy access.
remember is that even with just The first is over the HDMI line.
There are more exotic options that can mount the Pi
within a display, a desktop-style case that expands four USB ports – or the single When you plug the Raspberry
its capabilities, and even a laptop chassis, so you port on the Pi Zero – it’s easy to Pi into a display that also has
can take your Pi with you. Just be aware that this expand your USB connectivity speakers, audio generated by
means you can spend anything from £5 up to £100 with a hub. For devices that don’t the Pi is automatically sent over
or even more for your Pi case. require additional power, an the HDMI line, too.
76 // // Spring 2017
Get connected GET STARTED
The alternative option is to All Raspberry Pis use a normal desktop PC. The fact is, Connect it up
use the standard 3.5mm audio micro USB port to supply their the Pi was envisioned to be that and a Raspberry
jack, which can easily be plugged power. This has the advantage and so much more. A big part of Pi will form the
into most speakers. that, on the whole, you can its extra abilities comes through heart of a
power a Pi from almost any the bank of GPIO (General powerful but
Network and power phone power adaptor. The power Purpose Input Output) pins. We’ll very compact
computer setup.
We’re going to look into Pi requirements vary, depending on explore these later through fun
networking in more detail over which Pi you have and what and exciting projects, but for
the page, largely because we you’re doing with it. Old power now, it’s enough to know that
want to look in full at wireless supplies that provide only 5W these enable the Pi to control,
networking adaptors and the Pi should cope with a basic Pi monitor and power external
3’s built-in wireless capabilities, Model B setup, which draws devices and projects. You don’t
alongside the Bluetooth features 3.5W, but the more peripherals have to use them, but they’re
and how they work. Besides you add, the more power it always there if you want them.
this, all Model B Pis come with requires. The Pi 2 and 3 use 4W, Additionally, the Pi comes with
a wired Ethernet network port. so the draw is more critical. a camera interface – although
This can be plugged into any Ideally, you want a 10W (2A, 5V) you can also use standard USB
router, and boom – instant supply, which is more common cameras – plus there’s a
network access, including these days because modern dedicated digital touch display
internet access if that router tablets and phones also have interface, too.
is online. For the bare-bones higher power requirements. All you have to do now is
Model A Pis and Pi Zero, a USB At this point, you would have follow our installation guide over
wireless adaptor is required. your Raspberry Pi all set to be a the page and boot it up!
SD CARDS
The main storage for a Raspberry Pi is an out at 25MBps. It’s also not capable of
SD card, typically a microSD card, though utilising the technology of the latest UHS
the original Model B and Model A Pis used high-speed SD cards.
a full-sized SD card. On the whole, you With all that in mind, the key thing to
can just run out and buy any microSD look for in an SD card is to get one with
card and it should work, but it certainly fast read/write access, rather than pure
makes sense to ensure that the card you throughout. It’s also worth keeping an eye
buy will not only work, but will also be on the list of compatible tested SD cards
large enough and as fast as possible. at http://elinux.org/RPi_SD_cards.
Not all SD cards are made the same. You should also aim to get a card at
There are various speed categories, such least 8GB in capacity. The latest build of
as Class 6 (which denotes a minimum Raspbian – the main Pi OS – is now larger
6MBps write speed) and Class 10 than 4GB. That said, given the price of SD
(denoting 10MBps write speeds), along cards, it makes sense to go for a 16GB or
with the newer and faster UHS-1/2 (Ultra 32GB card. You need to balance the slight
High Speed). One thing to keep in mind increase in price against the fact that a
here is that the Pi’s SD controller maxes larger card is likely to be of use far longer.
Spring 2017 // // 77
GET STARTED Install
How to install
Raspbian
Before you can do anything on your Raspberry Pi, you need some software
for it to run. With a microSD card in hand, we guide you through the process
efore the Raspberry Unlike traditional computers, needs to be at least 4GB in
B Pi can do anything
(apart from sitting
there looking cute) it
needs an operating
system (OS). The most popular
the Pi has no internal storage,
so the OS needs to be loaded
from an SD card. The original Pi
models (models A and B) use
full-size SD cards, whereas
capacity. If all this seems too
technical, you may wish to look
at NOOBS (over the page).
Note that on macOS computers,
it’s also possible to write the
OS for the Pi is Raspbian, which newer models (B+, 2, 3 and Raspbian image using the dd
is based on Debian Linux. A Zero) use the smaller (and tool from the command line. If
number of other operating much easier to lose!) microSD you’re comfortable working
systems are also available for variety. SD cards pre-loaded this way, the procedure is very
the Pi. Some of these can be with an OS can be purchased similar to the Linux instructions
downloaded from the Raspberry from pretty much wherever the on page 81. Alternatively, check
Pi Foundation website (https:// Pi is available, and are commonly out the instructions on the
raspberrypi.org/downloads) included in bundles, but it is also Raspberry Pi Foundation website
and some can be installed using straightforward (and cheap) to at www.raspberrypi.org/
NOOBS (over the page). There’s make your own. This can be documentation/installation/
Ubuntu MATE (Pi 2 and 3 only), done using freely available tools installing-images/mac.md.
an ARM port of Arch Linux, the on Linux, macOS or Windows.
classic RISC OS, the OSMC If you already have a pre- Enjoy Raspbian
media centre, not to mention loaded SD card, you can skip this Once your SD card is ready
the RetroPie vintage gaming section entirely. If not, the most (whichever road you choose),
platform. There’s also Snappy straightforward way to get going you’re all set to boot up your Pi.
Ubuntu Core and even Windows with the Pi is to download the Remove the SD card from your
10 IoT Core. If you’re a beginner, latest Raspbian image and write computer, plug it into your Pi
Raspbian is good to start with. it directly to an SD card, which (along with all the other gubbins
– display, power, keyboard and
Raspbian mouse), power up and it should
should be your boot up to the raspi-config
first choice, but program. From here, you should
the other OSes expand the filesystem (if your
can be fetched
card is greater than 4GB),
and installed with
minimum fuss.
change the default password and
enable Boot to Desktop. Select
Finish and you’ll be able to
reboot to the Raspbian desktop.
There’s all manner of interesting
things you can play with right
away, including Minecraft,
Wolfram Alpha and Sonic Pi.
If you have a wired network
connection, then that will work
out-of-the-box. Some wireless
ones will as well, but for many,
this will be their first encounter
with the recalcitrance of Linux.
Just be patient, and remember,
Google search is your friend...
78 // // Spring 2017
Install GET STARTED
Spring 2017 // // 79
GET STARTED Install
Install NOOBS
with any OS
Possibly the easiest way to get a new OS up and running on your Pi can be
achieved using any operating system – as long as you know how!
OOBS (New Out Of so it will load the next time the – just plug in and turn on.
80 // // Spring 2017
Install GET STARTED
Install Raspbian
with Linux
If you’re running any flavour of Linux on your computer, then you have an
even easier life when it comes to getting Raspbian on to your Pi
inux users can get The Etcher
Spring 2017 // // 81
GET STARTED Networks
Using networks
on the Pi
Getting hooked up to a local network and the wider internet is easier
than you might think, as long as you have all the right bits...
veryone (and, it of the nitty gritty of networking You can confirm whether a
E seems, everything)
is online these days,
and that means that
if you want your
Raspberry Pi to do anything
from you, combined with the
need to add wireless dongles to
all Raspberry Pi models except
the latest Pi 3, which comes with
built-in wireless and Bluetooth.
USB device is working correctly
– other than the Raspbian
wireless being enabled – by
opening a terminal and typing
lsusb , then pressing Return.
“interesting” – even if that’s just The first thing you need to do This provides a list of all your
browsing Facebook – you need before buying a wireless adaptor USB devices, and one should
to get it networked. As with is to check whether the one you be something that sounds like
everything Raspberry Pi, it’s already have or plan to get will your USB Wi-Fi device.
Raspbian
now supports
made as hard as possible, to work with your Raspberry Pi. A second command, iwconfig
easy GUI- ensure you learn as much as That’s where http://elinux.org/ provides a list of working
based wireless possible along the way! No, RPi_USB_Wi-Fi_Adapters wireless adaptors connected to
connections – actually, the only complication is comes in – this is a huge list of your Pi. This offers a slightly
so modern! that Raspbian doesn’t hide any both verified adaptors and those more direct confirmation that
that cause issues. the USB dongle is connected
The good news is that a huge and working.
range works with Raspbian, An easy way to avoid any
thanks to its Linux kernel. It worry is to buy an official
comes with built-in support for Raspberry Pi Foundation Wi-Fi
a large number of adaptors. dongle. Designed to work with
Because of the way Raspbian is all Raspberry Pis and Raspbian,
built, an adaptor that doesn’t this eliminates any worries.
work with Raspbian might work There’s also the added point
with another Linux OS, such as that it helps fund the Foundation,
Arch or OpenELEC, because of too. You can get more details
the particular version of the from www.raspberrypi.org/
Linux kernel they ship with. products/usb-wifi-dongle.
Back in the day, you had to
edit text files to configure your
TCP AND YOUR SORE IP wireless dongle, but these days
Raspbian has been fully updated
If you’re new to PCs and networking, then the typically, an address would be something to provide a GUI (or Graphical
sudden talk of IP numbers and the like might like 192.168.0.1 or 192.168.100.23. Generally, User Interface) for connecting
be confusing. Let’s just say that local networks your home and business network has its to any wireless network. How
and the internet all use a very clever system own IP range – the broadband router you civilised! Wi-Fi connections can
called TCP/IP. On a pedantic level, that’s two – use to connect to the internet creates this be made via the familiar network
yep, two – communications protocols: TCP, automatically using something called a DHCP icon at the right-hand end of
alias Transmission Control Protocol; and the IP server, and uses Network Address Translation, the menu bar. If a working Wi-Fi
part, alias Internet Protocol. You don’t really or NAT, to route messages to and from your dongle is plugged in, left-clicking
need to know anything about it, other than local network and the wider internet. See, it
this icon brings up a list of
this: it assigns a unique number to each and does get awfully complicated very quickly!
available Wi-Fi networks, as
every device on the internet. This enables Usually, when we talk about IP addresses,
messages to get to and from your devices, it’s when you want to know the address of a shown in the picture on this
finding their way to the right place. device or server on your network or on the page. If no networks are found,
Each device gets an address made up of internet, or you want to give a device a specific it shows the message “No APs
four numbers, separated by full stops. Each address. Luckily, you won’t have to know much found – scanning...” Wait a few
number can be between 0 and 255. So, more than this! seconds more without closing
82 // // Spring 2017
Networks GET STARTED
BLUETOOTH DEVICES
With the addition of the embedded dual connecting to a wireless network. This
wireless/Bluetooth abilities in the Pi 3, goes for all Bluetooth devices, but you
Raspbian was updated to support first need to make them “discoverable” –
Bluetooth out of the box. Prior to this, you this enables other Bluetooth devices to
had to “hack” in the Bluetooth support, then attempt to connect with them, at
with the command sudo apt-get install which point you have to allow those
--no-install- recommends bluetooth and, connections or not, as the case may be.
once it was installed, use sudo service Left-click the Bluetooth icon in the top-
bluetooth status to enable it. right of the Raspbian desktop, select Make
While this was a simple case of installing Discoverable, then choose Add Device to
a manager tool, it’s far neater having it pull up a list of nearby Bluetooth devices.
around by default. If you use a smartphone Select the correct one and click Pair. With
you’re likely to have used Bluetooth, with keyboards and devices, you often have to
all the Bluetooth speakers, keyboards and enter a code on the device to finalise the
headsets available these days, but if not, connection. You’ll want to ensure that you The Raspberry Pi should pair with most
the good news it that it’s far simpler than choose Stop Discoverable afterwards. Bluetooth devices without an issue.
Spring 2017 // // 83
Pi CODE
Learn how to code in your language of choice
95
86
92
Spring 2017 // // 85
Design a game
using Scratch 2
Les Pounder shows how you can create a simple console game using a few
blocks of Scratch code and a creative imagination
he popularity of Scratch has soared Scratch which has been tweaked to also work with
T
since the Raspberry Pi was released. the Pi’s GPIO. But in late 2016 the Raspberry Pi
Children across the United Kingdom Foundation introduced an update of Raspbian that
have started their coding journey using now comes with the Pixel Desktop, the Chromium
this effective tool. Why is it so popular? web browser and Flash – a contentious inclusion
Scratch beautifully demonstrates the basics of given that it is not free software, but required so
Computer Science, loops, iteration, variables, that Scratch 2, the latest version, could be made
arrays etc. But Scratch manages to keep all of available. The Foundation, always keen to ensure
these concepts relatively simple and easy for the that they provide the relevant software for
user, typically a child, to use. When children first learners, chose to include Flash in order to ensure
use Scratch, they simply treat it as a set of that users had access to the latest version of
building blocks, connecting blocks together and Scratch aligned to the latest learning resources.
seeing what they can create. But over time and In this tutorial we’ll introduce a number of
with the help of the curriculum in our schools, coding concepts, such as inputs, loops, variables
children are learning key skills which can be and conditionals, by creating a clone of the
applied to all languages, all thanks to Scratch. Nintendo classic game Duck Hunt, which was
The Raspbian operating system, the de facto popular in the 1980s on the NES console. So let’s
standard for all versions of Raspberry Pi, comes start our project with an overview of the new
with version 1.4 of Scratch, an older version of Scratch 2 interface.
86 // // Spring 2017
Scratch CODING
Spring 2017 // // 87
CODING Starting Scratch
88 // // Spring 2017
Scratch CODING
Spring 2017 // // 89
CODING Scratch
90 // // Spring 2017
Scratch CODING
15 Conditional Rewards
Using a comparison block from Operators, we check that the value
stored in our “score” variable is greater than 50. (We chose this value
to give the player a chance to get a rewarding end result, but you can 16 Colour changing giant Unicorn
change this as you see fit...) If the player’s score is greater than 50 Unicorns are famous for looking fabulous, so using a repeat loop
then we go into the “If” condition code. from Control and two blocks from Looks, we change the colour
effect, cycle through colours, and change the size of the sprite by
25 percent. This happens three times before the loop ends and the
Unicorn gracefully glides to the centre of the screen.
Spring 2017 // // 91
First steps in Python:
Control structures
Mayank Sharma takes your fledgling Python skills further by introducing
new concepts and helping you write your first Python script
e introduced two types of variables but is rather used in conditions for loops
92 // // Spring 2017
Python CODING
nominal £0.99 fee. Children between 3 and 15 is waiting for you to enter something from the
years of age are charged £17.25. Seniors aged keyboard. Without the prompt, Python would
60 years and over get a concession and are just sit there waiting and the user would not
charged £19.35. All other visitors are charged know what was happening.
as adults at £21.50.
We’ll create a program that’ll read the ages Control structures
of all the visitors in a group and add up their A program is usually executed linearly from top
admission fees based on the above given criteria. to bottom, one line at a time. However, certain
When the user enter 0 to indicate that there are statements, referred to as control-flow
no more visitors in the group, the program will statements, have the power to change the path
then display the admission cost for the group. of the code execution.
First up we’ll store the different admission “While” loops are one of the most common
prices and age limits in variables, such as: control-flow statements. The “while” loop has a
condition that can be anything with a bool data
# The various admission prices type, and the code block will continue looping
baby_price = 0.99 until that condition is False. The condition can be
child_price = 17.25 as complicated as you like, as long as it comes
adult_price = 21.50 back to either True or False. However, in order
senior_price = 19.35 for the loop to eventually terminate, the code
block must include one or more variables that
# The applicable age limits can change inside the loop. Pi bites
baby_age_limit = 3 Secondly, many programs require you to go
child_age_limit = 15 through more than one thing at a time, such as 100,000
adult_age_limit = 60 in our case where we have to calculate totals Raspberry Pis
were sold on
based on multiple ages. One of the simplest the first day
# Variable to hold the total admission price ways to control the flow of a Python program of launch in
February 2012,
total = 0 is to branch off and execute different pieces and more than
of code depending on a condition. This is best 10 million units
In this block of code, we’ve first stored the done with the “if” loop. Like “while” loops, “if” have been sold
worldwide as
applicable admission prices as floating point statements take a condition that has to have the of September
numbers and the age limits as integers. We’ve bool data type. Also, “if” statements only execute 2016.
also created a variable that’ll hold the final one block of code. Once Python finds a condition
computed admission price. The line beginning that is True, it’ll execute that block and then exit
with # is a comment that explains the code. Any the “if” statement.
characters on the same line that follow the # That said, “if” statements can also have an
symbol will be ignored by Python. “else” statement and additional “elif” statements.
Next up we’ll ask the user to enter the age of Of these, “elif” is used to create an extra set of
a person in the group: conditions in the if-else statement. The “elif”
visitor = input ("Enter the age of the visitor (0 to clause is a combination of the “else” clause and
exit): ") a separate “if” statement. When an “if” condition
Python provides the input() function, which has is False, Python skips the indented block and
an optional prompt string parameter. When the looks for an “elif”, which it then evaluates. Once
input function is called, the program flow will be again, if this is determined to be True, Python
stopped until the user has given an input and has then executes the following block. When the “elif”
ended the input with the Return key. First it prints condition turns False, Python then moves forward
the string you give as a parameter, and then it and looks for another “elif” or an “else”. The “else”
waits for a line to be typed in. In the line above, block is executed if none of the conditions are
the entered value is assigned to the variable True. Note that “if” blocks don’t have to have an
named visitor, which we’ll use later. “elif” or “else” statements. If there’s no “else”
Note that while the parameter inside the statement, and none of the conditions are True,
parentheses after input is optional, it is very then Python simply exits the “if” block without
important since it prompts you that the program executing anything.
Spring 2017 // // 93
CODING Python
94 // // Spring 2017
Building your own
cities in Minecraft
Les Pounder shows you how some simple Python code can enable
anyone to create – and destroy – their own city in Minecraft
ack in the 1980s an ambitious game With our blank document open we start writing
Spring 2017 // // 95
CODING Minecraft
The inventory the Minecraft world. We start our functions by building has started. We then repeat the process to
contains lots creating a block of code that will destroy a locate the player in the world, but then we split the
of extra blocks 50-cubed area of the world. First we give the data stored in “pos” into separate x,y,z variables.
and items that function a name: “destroy”. Notice the colon at the The next three lines create variables width, height
you can use to
end of the line – this tells Python that the next line and length, each with a randomly generated
decorate your
should be indented. Our editor will automatically number as its value. We use randint and specify a
home and the
city around it.
do this for us. The first line of indented code range in which the number can be selected. In the
creates a variable called pos that will store the last line we set the blocks for an area starting from
position of the player in the world using the the player’s position and ending at the randomly
getTilePos command, which returns a coarse but chosen coordinates. We used a diamond block to
adequate position for placing blocks. Once we give our skyscraper a shimmering tower of glass.
know the player’s position, we next set the blocks, def skyscraper():
using setBlocks, from the player’s position (x,y,z) mc.postToChat('Building a skyscraper')
to 50 blocks away for each axis. This creates a 50 pos = mc.player.getPos()
cubed box containing air, effectively destroying x,y,z = pos.x, pos.y, pos.z
everything in that cube. width = randint(4,20)
def destroy(): height = randint(10,50)
pos = mc.player.getTilePos() length = randint(6,20)
mc.setBlocks(pos.x, pos.y, pos.z, pos.x+50, pos. mc.setBlocks(x, y, z, x+width, y+height,
y+50, pos.z+50, buildingblocks['air']) z+length, buildingblocks['diamond'])
Our next function creates rather than destroys. As well as skyscrapers we need a simple home
It creates a Skyscraper at the player’s position. for the people who live in the city, and our next
First it will post to the Minecraft chat screen that function, building, will build a modest sized home,
ready for you to decorate. Building works in the
same way as our skyscraper function, but it builds
SNAKE CHARMER only homes of a certain size, and out of
cobblestone. The key difference with this function
Python is a wonderful language. In this project we have used it to conjure is that after we create the cobblestone that makes
up new worlds and give us godlike powers. But the true power of Python the building, we create another smaller space
on the Raspberry Pi is that we can use any Python library in our projects.
within by creating a building one cube smaller in
This includes the GPIO Zero library, which enables easy use of the Pi’s 40
every axis, out of air, essentially hollowing out the
GPIO (General Purpose Input/Output) pins. So we can now have Minecraft
react to the physical world. For example in our project, the functions that home. We will leave doors and windows to you –
create roads, rivers and skyscrapers are triggered using a menu, but we just remember to press “e” on the keyboard to
can also use buttons, sensors and triggers in the real world to invoke these access the inventory for your belongings.
functions. Think of destroying a 50-cubed area of the world just by waving def building():
your hand in front of a sensor – true godlike powers can be yours with mc.postToChat('Building commencing')
Python! You can find out more about GPIO Zero by reading the official pos = mc.player.getPos()
documentation at http://bit.ly/gpio-zero x,y,z = pos.x, pos.y, pos.z
96 // // Spring 2017
Minecraft CODING
width = 10 of the player, just enough for the player to sink but
height = 5 not too deep that we get lost. Our player cannot
length = 6 drown, so you are free to explore the underwater
mc.setBlocks(x, y, z, x+width, y+height, world. When creating a river it is wise to remember
z+length, buildingblocks['cobblestone']) that water flows, and that if the river is created
mc.setBlocks(x+1, y+1, z+1, x+width-1, somewhere high, say a hill, then water will cascade
y+height-1, z+length-1, buildingblocks['air']) and flood the ground – but this can be used to
We have our buildings, now we need roads. This your advantage if you’d like a skyscraper waterfall!
function is a little different, in that it takes an def river(direction):
“argument” – in other words, we give the function mc.postToChat('Can I swim?')
Pi bites
an extra piece of information. In this case we tell pos = mc.player.getTilePos() In Minecraft Pi,
the function which direction to build the road in. x,y,z = pos.x, pos.y, pos.z if the player
The function replicates the chat message to the width = randint(1,5) tries to play full
screen, they
user, gets the position of the user, and sets the depth = 6 cannot access
width of the road to 6 blocks and the length to 100 length = randint(1,100) all items in the
(these can be changed to suit your needs). We if direction == "north": inventory. So
always play
then enter into a conditional test that will check mc.setBlocks(x, y, z, x+width, y-depth, Minecraft in
the direction given by the player. This uses two z+length, buildingblocks['water']) a window.
conditions, the first being if and the second elif, elif direction == "east":
short for “else if”. If the direction is “north” then mc.setBlocks(x, y, z, x+length, y-depth,
the road is built ahead of the player. Else if the z+width, buildingblocks['water'])
player types “east” then the road is built across Our functions are now complete and we move
their path. on to the next section of code. Here we create two
def road(direction): lines that use the chat window to welcome the
mc.postToChat('Roadworks commencing') player and advise them on what to do in the game.
pos = mc.player.getTilePos() mc.postToChat('Welcome to our Simple City.')
x,y,z = pos.x, pos.y, pos.z mc.postToChat('You are free to destroy and create
width = 6 using the menu')
length = 100 Next we create a variable called “answer” and
if direction == "north": into it we store the integer 0:
mc.setBlocks(x, y, z, x+width, y, z+length, answer = 0
buildingblocks['road']) Why do we do this? Well, in order for us to use a
elif direction == "east": “while answer” loop, we first need to create the
mc.setBlocks(x-1, y-1, z-1, x+length, “answer” variable, otherwise we cannot enter the
y,z+width, buildingblocks['road']) loop. This while loop will compare the value stored
Next we create the function that will build rivers. in “answer” and if it does not equal the value “8”
This is essentially the same as our road function, then the code in the loop will run.
including the ability to pass an argument, But where does this value come from? Well, we
direction, so that we can build roads in front of our create a menu, which has a number attached to a
path or across our path. But the river code differs function. This menu is a multi-line print function,
in that we can also set the depth of the water. We which is neater than creating a print function for
chose 6 blocks depth as it is three times the height each line. You will notice that at the end of each
Starting our
project launches
a simple menu
in the Python
shell and a quick
message pops up
in Minecraft.
Spring 2017 // // 97
CODING Minecraft
line is \n – this is an escape character and tells is highly likely the player chose “8”, which will exit
Pi bites Python to create a new line. After the print the menu by using the “else” condition. This will
function we update the “answer” variable with print “Goodbye” in the Python shell and print a
The “building”
function is input from the user. Here the user is asked to message in the Minecraft chat window.
intentionally choose a number, which is then stored in the if answer == '1':
bare-bones. So variable. For example if we wish to build a skyscraper()
to decorate your
home, press the skyscraper we press 1 and then Enter. This is elif answer == '2':
“e” key to open captured and stored in “answer” ready for the building()
your inventory
and select your
next section of code. elif answer == '3':
furnishings. while answer != "8": road('north')
print('Main Menu \n' elif answer == '4':
'1: Create a skyscraper\n' road('east')
'2: Create a building\n' elif answer == '5':
'3: Build a road, north to south\n' river('north')
'4: Build a road, east to west\n' elif answer == '6':
'5: Create a river, north to south\n' river('east')
'6: Create a river, east to west\n' elif answer == '7':
'7: Destroy a 50 cubed area around you\n' destroy()
'8: Exit the menu') else:
answer = input('What would you like to do? ') print('Goodbye')
Our final section of code is a conditional test, mc.postToChat('Exiting menu,
which will check the value stored in “answer”, our connection terminated')
variable that stores the player’s choice. If the value break
stored matches one of the hard-coded values then And that is all of our code complete. Make sure
it will run the respective function. For example if you save your work before continuing.
“answer” contained “4” then the correct choice In order to use our code, we first need to start
would be to run road(‘east’). If the value stored in a game of Minecraft – you can find it in the Games
“answer” is not a number between 1 and 7, then it menu. With Minecraft open we now need to go
back to the Python editor – but we can’t, our
mouse is stuck in Minecraft! Fear not, simply press
MUSICAL MINECRAFT the Tab key. This will release the mouse, and you
can now click on your code. Click on Run > Run
We used Python in our project, but did you know that you can also hack Module to start your code and then select an
Minecraft with Sonic Pi? Sonic Pi comes pre-installed on your Raspberry Pi and
option from the menu to build your own city
with it you can create music of any genre – and create Minecraft worlds. Sonic
made of blocks!
Pi was created by Dr Sam Aaron, a gifted computer scientist and musician.
Sam uses Sonic Pi to “live code” compositions for events, rewriting the Ruby
To get back into Minecraft, click on the
code live in front of an audience and reacting to the cues given by a live band. Minecraft window in the taskbar at the top of the
The Minecraft functionality was introduced into Sonic Pi as a result of a screen, and then move your mouse. Minecraft
conversation between Sam and Martin O’Hanlon, an expert in Minecraft. As should respond. If not, just click in the Minecraft
a result of this meeting we can use Minecraft as an input for a performance – game window and it will register your click.
for example changing music depending on the block that we are stood upon. Now go forth and build your own city – or
You can read more at http://sonic-pi.net destroy it!
98 // // Spring 2017
GET STARTED WITH
LINUX THE EASY WAY
OUT
NOW!
WITH
FREE
DIGITAL
EDITION
110 104
106
BEAUTIFULLY MADE
AND ROBUST, THIS ADDS
ETHERNET AND FULL-SIZE
102 Kano
Screen Kit
106 S.USV
Advanced
Pi
112 display
ZeroSeg LED
kit
N
In brief... Raspberry Pi means it’s well protected from controls board.
A portable 10.1- accessories are knocks and scrapes. The screen There’s also a retention space
inch Raspberry like buses: you comes as a kit which the user is to attach your Kano Raspberry
Pi screen that wait ages for a encouraged to build. This kit Pi case to the screen, creating
offers HD
resolution in a portable Raspberry Pi solution has a strong plastic frame into a rather nice single unit. The
strong and kid- and then they all turn up at which the screen is clipped, and screen is powered via a bespoke
friendly chassis.
The Kano ethos
once. We’ve seen many different the frame can be laid down on a micro USB cable that also
is to enable screens for the Raspberry Pi, table in a similar way to an old powers your Raspberry Pi.
learners to including the official 7-inch school desk or upright like a Building the screen takes just a
experience
building their screen, and the next one to traditional monitor. On the back few minutes; the only tricky bit
own computer turn up is this kit from Kano.
and this is
supported by
This company knows about
packaging and marketing, and
THERE’S NO SPEAKER, SO YOU’LL
a series of
workbooks
written with
the Kano Screen Kit comes in a NEED TO ATTACH ONE, NOR DOES
quality box with everything well
children in
mind. protected and labelled. The box IT HAVE TOUCH INPUT, BUT THE
also includes an assembly guide
written for young hackers,
PICTURE QUALITY IS EXCELLENT
designed to be similar to Lego
instructions, which enables of the screen is a driver board is attaching the driver board
users to start building as soon that connects it to a Raspberry case to the screen.
as the box is open. Pi via a conventional HDMI
The Kano screen measures cable, and attached to the driver Tough contender
10.1 inches diagonally and is board is a breakout cable which We tested the screen with the
latest Kanux distro and the
latest Raspbian image. For both
Features at a glance screens the initial view appeared
upside down, requiring us to lie
the screen down so that it
looked like an old school desk,
and then rotate the screen 180
degrees in the OS. In Kanux this
is achieved by going into the
System Settings and selecting
Display. In Raspbian you have
to edit the config.txt file found
in the boot partition and
manually add display_rotate=2
as the last line. For both distros
the desktop was displayed at
the correct size and no further
configuration was necessary,
Adjustable display Works with all but using the controls on the
Provides two display positions and handy The Kano screen uses an HDMI driver board,
controls on the back to get your screen just which means that it can also be used with back of the screen we could
right (and somewhere to stash a keyboard). other devices. quickly alter the setup of the
screen if needed.
The screen is a
balanced mix of
portability and
features. It’s clear
to read at most
angles and can
be powered along
with your Pi from
a USB adapter.
(Keyboard is
not included in
Screen Kit.)
The screen does not provide can take a fair amount of socket. The Kano Screen is not
any audio output, so you’ll need punishment, unlike other a cheap screen solution, but it
to attach a speaker/headphones screens on the market. is one of the most robust at this
to the jack on your Raspberry The Kano Screen is currently price point. It successfully
Pi, nor does it have touch input. priced at something of a sweet merges portability with usability,
Picture quality is excellent, spot: it’s not as cheap as the offering a lot of screen for
however, with the 10.1-inch official screen and doesn’t have a fair price.
screen running at 1,280x800, a touchscreen capability, but it
giving us 150 pixels per inch is built to last and right now
(PPI). The resulting image is it’s a good alternative for users Verdict
bright and clear, providing the and schools when compared to
ideal platform for hacks. other solutions, such as the Pi
Kano Screen Kit
Developer: Kano
The Kano Screen is a tough, Top (see overleaf). The lack of Web: kano.me
well built and well specified audio output will be an issue for Price: £120
product, and it’s clear that the some buyers, especially those
target market, young learners,
is well catered for as this screen
using the screen with the Pi
Zero, which has no headphone
Rating 8/10
Spring 2017 // // 103
REVIEW Pi-Top laptop kit
In brief
A Raspberry Pi
laptop solution
offering an
impressive level
of portability
and features
that are
aligned with
Features at a glance
the UK GCSE
curriculum. But
these features
come with a
hefty price tag
and a number of
rough edges to
a relatively new
software base.
That said, this
is a powerful Pi-Top isn’t quite
package for Practical package Applications
your typical laptop, The Pi-Top laptop case Standard Raspbian apps
those who can
work around and under the lid provides easy access to the are included, such as
the issues. it’s all Raspberry GPIO via a sliding panel LibreOffice and the
Pi powered. above the keyboard. Chromium web browser.
R Raspberry Pi
sports a plethora
of portable options.
September 2015
saw the release of the official
spongy and imprecise at times.
On the software side, you
get the pi-topOS, built upon
Raspbian Wheezy 7.8. Pi-topOS
acts as a layer on top of the
a couple of issues. Logging in as
an incorrect user prevented us
from re-attempting a login with
the correct details. A reboot
solved this issue, but it did
touchscreen, and other Raspbian OS. On first boot you take time. Also, an update
companies such as Kano offer are prompted to set up your bug prevented pi-topOS from
their own portable (or near- Pi-Top, which includes creating connecting to the update server
portable) setups – see the an online account. This is used despite constant reminders and
previous page. Pi-Top started life to save your learning progress to using an Ethernet cable to
as a crowd-funded project and the Pi-Top cloud-based learning connect to the router.
combines both hardware and system, which is aligned with Pi-Top also has its own
software. The hardware is a the UK Computing curriculum software, a game called CEED
sturdy plastic laptop shell for 13 to 15 year olds. Universe, which teaches coding
(supplied as a kit) and includes and making concepts via an
a 13.3-inch HD (1,366x768) LCD Learning interactive retro game – a great
screen with eDP interface, an experience idea that keeps children engaged
8GB SD card, a battery with Like Raspbian, the Pi-Top comes while learning key skills. It’s
a claimed life of 10 hours, and with a bundle of applications. reminiscent of Kano OS,
a Wi-Fi dongle. You can buy it These include Scratch, Libre which itself uses gamification to
with or without teach core
a Pi 3. The kit concepts.
is fairly simple FAIRLY SIMPLE TO ASSEMBLE CEED
to assemble
but might
BUT MAY REQUIRE ADULT HELP Universe is a
lot of fun and
require adult FOR A FEW FIDDLY BITS provides a
supervision great level of
for a few fiddly interaction for
bits, such as attaching the LCD Writer, Minecraft Pi, Sonic Pi children wanting to learn more.
screen to the driver board. and the Python editor IDLE. We The Pi-Top is a great idea and
The driver board handles tested IDLE 3, the Python 3 provides a portable Pi solution,
connecting the Pi to the built-in editor, with the RPi.GPIO library, but it’s not as high-quality as the
battery, recharging the battery the most popular library for price might lead you to expect,
via an included external power hardware hackers and makers. and the cost of $300 (around
supply, and sending HDMI Being based on Wheezy, IDLE3 £200) is high, with just a 30-day
video input to the LCD screen. was unable to access the GPIO warranty, for its target education
Connecting the GPIO of your Pi using the default user – it market. The software bugs will
to the driver board enables required opening a terminal and doubtless be tackled, but the
battery management, but will running the command via sudo cost is the main barrier.
cover all 40 GPIO pins; it can be – but we successfully built and
removed, enabling use of the tested a simple LED project. This
GPIO. The driver board and the is a step backward for those Verdict
Pi (located at the right of the used to the latest Raspbian
Pi-Top laptop kit
laptop) are covered by a slide Jessie image, but we’d expect
Developer: CEED Ltd
cover, for quick access to the Pi. this to be fixed in a future Web: www.pi-top.com
Access to the Pi’s USB and release. Of course, as it’s based Price: $300 with a Pi 3, $265 without
Ethernet ports is tricky but on Raspbian, you are free to
possible. The keyboard and install your favourite applications Rating 6/10
trackpad are fine for daily use via the package manager.
S.USV Pi Advanced
Les Pounder has always loved Star Trek and often pretends to be Captain
Kirk, but can Scotty provide more power? Maybe with this board...
he Raspberry Pi has configuration and installation which comes with a 300mAh
T
In brief... been used to power is handled via the Terminal, (milli-Amp-hour) battery. A
A flexible UPS many different and while being quite involved noticeable feature present only
(Uninterruptible projects, including and requiring a number of on the advanced model is the
Power Supply) some where it is a changes to the default inclusion of an alternative power
that provides
multiple power mission-critical component. Raspberry Pi configuration, source which can be used with
sources, such For these sorts of dedicated installation is straightforward any power supply rated between
as batteries
and solar power,
projects it is prudent to have a and well covered in the 7V and 24V. The software that
for critical secondary means of powering supporting documentation. handles the functionality of
Raspberry Pi the Pi, should the mains supply (Sadly the same cannot be the board is controlled by a
projects. The
board attaches suffer a sudden interruption said for all of the documentation background process, a daemon,
to the GPIO and or shutdown.
comes with an
extensive suite
An Uninterruptible Power
Supply (UPS) provides a
THE CLIENT TOOL PROVIDES THE
of software
tools that
enable
temporary solution to powering STATUS AND CONFIGURATION OF
your Pi. The S.USV HAT is
configuration
and compatible with all versions of THE BOARD AND POWER SOURCE
management
of even the
Raspberry Pi that come with
the 40-pin GPIO and features
VIA A TERMINAL INTERFACE
most minute
details of the a pass-through connector
board and the enabling the use of other – more on this shortly.) which provides the options
attached
sources of Raspberry Pi add-on boards. The S.USV board connects to start, stop and restart the
power. The S.USV HAT, being a HAT and communicates with the daemon process. Installing
compliant board, comes with Raspberry Pi using the I2C the daemon also enables the
an EPROM connected to pins protocol, requiring only two use of two buttons, S1 (used
27 and 28 of the GPIO, which GPIO pins for data, and an to turn off or reboot your Pi)
communicates with the additional 5V and GND and S2 (which can be used to
Raspberry Pi and handles initial connection to power the board. power up your Pi).
configuration. The rest of the We tested the Advanced version,
Power user
The software is installed to
Features at a glance /opt/susvd and comprises the
aforementioned daemon and a
client tool which can provide the
status and configuration of the
board and the attached power
source via a handy terminal
interface. The client tool has
options to read and set the
charging current for the battery,
and we used it to ensure that
the supplied 3.7V 300mAh
battery was charged and ready
Multiple power sources GPIO access for use. Also present are options
The Advanced version (tested here) has Some add-on boards prevent access to the
inputs for two power sources – an LiPo GPIO but the handy pass-through enables to create shutdown timers and
battery plus other sources you can also access to it for direct connection or the use timed boots, using the clock
connect as backups. of other boards. embedded in the board, and the
facility to upgrade the firmware the essentials of that promise – but is well worth considering. The S.USV
to ensure that your board is it just needs a little refinement There are other UPS boards on board fits very
running the latest version. to make it a better product. The the market, though, and when neatly on top
Sadly the documentation documentation is generally considering a purchase it would of all models of
Raspberry Pi with
for this board has a few issues, great and it covers every aspect be prudent to look around for a
40 GPIO pins.
chiefly found when trying to of installing and configuring the board that provides exactly the
enable the real time clock board; it is just let down by a functionality you require.
(RTC). We found a few faults few errors that cause “hiccups”
with the configuration for the user. On the plus side,
necessary to enable the RTC, this board provides full access Verdict
and this meant that we spent to all of the GPIO pins – and
S.USV Pi Advanced
rather too much time to enable since it uses I2C you can easily
Developer: SEProtronic GmbH
such a simple, yet key, piece of add more boards to your Web: www.s-usv.de/index_en.php
functionality. Hopefully this can Raspberry Pi projects with Price: Basic €29.99 (about £26),
be fixed in future revisions of little fear of conflicts. Advanced (tested) €54.99 (about £48)
the documentation. This is a powerful UPS board
This board promises so
much, and it does deliver on
that offers so much flexibility. It
has a few documentation issues
Rating 7/10
Spring 2017 // // 107
REVIEW Enviro pHAT
In brief
A Raspberry Pi
Zero sized add-
on board that
offers sensors
to read
temperature,
pressure, light
levels, colours,
orientation
and compass
headings.
Designed to
provide data via
a robust Python
library which
can be easily
integrated into
existing
projects. The
board uses only
the I2C pins of
the Raspberry
Pi, enabling
other boards
to be used as
unique methods
of output.
Features at a glance
The Enviro
pHAT is a
compact sensor
board designed
to fit atop the Sensors Analog input
Raspberry Pi The Enviro pHAT has The Raspberry Pi GPIO
Zero and sit with sensors for temperature/ does not have an analog
a flush profile, pressure, light/colour and input by default. The
enabling small, motion/orientation. These Enviro pHAT comes with
neat projects. are simple to integrate into its own ADC for extending
any Python project. the number of sensors.
Enviro pHAT
Les Pounder loves data and is always looking for new ways to integrate
real-time data into his projects. Perhaps this board can fulfil his needs?
he Pirates of Sheffield magnetometer. So with this The Enviro pHAT comes into
Pi Zero Ethernet
RJ45 and USB Hub
Les Pounder tests a community-produced board that provides 100Mbps
Ethernet and full-size USB ports for the Pi Zero. But is it worth the price?
hen the connectors to be used. Next PP6, PP22 and PP23). The
W
In brief... Raspberry Pi to the USB ports is a single board is compatible only with
A community Zero first came Ethernet port rated for 10/100. v1.3 of the Pi Zero, released in
made project out, many All of the USB and Ethernet early 2016. This is because of
that enables applauded the ports are routed via a LAN9512 the placement of PP1 and PP6
full-size USB
and Ethernet reduced cost but some were USB control chip – the same being different on the previous
ports to be unhappy with the micro USB chip used on all Pi models prior version, 1.2. With any luck, this
added to the
Pi Zero. A solid
port and lack of Ethernet. Many to the release of the Raspberry shouldn’t matter to many users,
PCB and no different community boards Pi B+ in 2014. considering that v1.3 has now
configuration were created to address this
enable this
board to be issue, including this one. The
used for
permanent
Raspberry Pi Zero Ethernet NO SOFTWARE INSTALLATION OR
RJ45 and USB Hub Shield is a
projects,
or used project created by an individual CONFIGURATION IS REQUIRED –
temporarily
for configuring
maker in Scotland and available
for sale via the open hardware
DRIVERS FOR THE CONTROL CHIP
a project. Pogo
pins provide
a temporary
marketplace Tindie.com.
It’s created using a four-layer
ARE ALREADY IN RASPBIAN
yet stable
solderless printed circuit board and has
connection been made with great attention The board attaches to the been with us for much longer
between board to detail. On the board, there Pi Zero using pogo pins that than the short-lived 1.2. With
and Pi Zero.
are two USB 2.0 ports mounted lightly connect to the USB and the board attached to the
on their side with sufficient power test pads present on the underside of your Pi Zero you
clearance for cumbersome USB underside of the board (PP1, still have access to all 40 of the
GPIO pins. The board is secured
using the included fastening kit,
which we found a little fiddly
Features at a glance but ultimately not that difficult
to install.
Zero effort
Once the board is attached, all
you need to do is connect your
accessories and power up using
the Pi Zero micro USB power
port. Here is where we hit
another issue. Once the board
is attached, the Pi Zero’s own
micro USB port, normally used
for keyboards and mice etc, is
now non-functional and all
connections have to be made
using the add-on board. This
USB and Ethernet Pogo pins isn’t a deal breaker by any
The LAN9512 USB/Ethernet controller chip Use light pressure to create a temporary
is used on all models of Pi up to the B+. As contact between the board and the gold test means but it would have been
a result, it works out-of-the-box with no pads on the underside of the Pi Zero. nice to have three USB ports,
additional configuration required. even if one was micro USB.
The Raspberry
Pi Zero Ethernet
RJ45 and USB Hub
Shield is remarkably
well made for a
community product.
On the positive side, there’s and full-size USB ports to need to use a Pi Zero in your
no software installation or your Pi Zero. The fact that it’s project and you need USB and
configuration needed, largely compatible only with the current Ethernet, then this is the board
thanks to the LAN9512 USB v1.3 of the Pi Zero should not be for you.
control chip, for which drivers a real drawback, but something
are already present in Raspbian. to be aware of for any potential
For advanced Pi users there are purchaser. The price might Verdict
breakout points for the 5V and however be an issue. Because
Raspberry Pi Zero Ethernet
GND pins present on the GPIO. this is made by an individual,
RJ45 and USB Hub Shield
This means that power can be the cost of each board is higher
Developer: Marcel
provided using an alternative than you’d expect of boards Web: http://bit.ly/
connection to the micro USB. mass-produced in a factory. PiZeroEthandUSBHub
Beautifully made and robust, Adding on the cost of shipping, Price: $22 (about £18)
this board isn’t cheap, but it plus the initial cost of a Pi Zero,
does deliver an effective and
elegant way to add Ethernet
takes us over £20 and into Pi 2
and 3 territory... But if you really
Rating 9/10
Spring 2017 // // 111
REVIEW ZeroSeg
ZeroSeg
Les Pounder looks at a kit that can The ZeroSeg kit is fun to build. Sure,
there’s a few tricky bits of soldering
be used to add a classic ’80s display to your Pi involved, but that’s part of the challenge.
rowing up in the Steady hands and good eyesight primer for you to get to grips
In brief...
A dual seven-
segment LED
display
controlled using
a MAX7219 SPI
G ’80s, we remember
the humble seven-
segment display
that flashed “12:00”
on our family’s first VCR. This
are required.
The board has two four-digit
seven-segment displays (so
eight characters in all) and two
tactile switches. The displays are
with the board. They address
common use cases such as
scrolling text, simple date, time
and temperature data.
Within a few minutes we were
chip and a simple method of output controlled using a MAX7219CNG scrolling text across the displays
straightforward
Python library, provided enough information chip designed for driving 8-bit and we hit a little snag: “@” or
which presents to use the VCR, from just seven LED displays via an SPI interface “w” cannot be displayed. This
a humble yet LEDs per character. In the 21st – something the Pi is capable of is no fault of AverageManVsPi,
powerful
platform for century we have OLED displays using for communication. This but a design limitation of seven-
makers. As a kit and basic holographic displays, common chip is also used to segment displays. This apart, for
that requires
some soldering,
but there’s still a place for the drive 8x8 grids of LEDs for projects where you need simple
the board offers seven-segment display. digital signage and it’s nice to output – say a camera timer,
a cost-effective The ZeroSeg is an add-on see that it’s housed in a holder, system monitor or IoT coffee
entry for those
interested in board for all 40-pin Raspberry Pi allowing replacement should pot monitor – this board is ideal,
using the models but is designed primarily the need arise. To use the board and at only £10 it’s a great
display and its for the Pi Zero and fits neatly you need to install a number of opportunity to dust off your
two tactile
switches to atop it. The board was originally drivers and libraries, and all this soldering iron and build your
control a designed by a community
headless
Raspberry
member, AverageManVsPi, who
has started a small range of
WITHIN A FEW MINUTES WE HAD
Pi project.
boards aimed at the beginner. TEXT SCROLLING ACROSS THE
The ZeroSeg comes as a self-
assembly kit and requires DISPLAYS, THOUGH NOT @ OR W
soldering. While this is mostly
trivial there are a few moments, is well documented in a concise own kit. It might not do anything
such as soldering the displays PDF download, which also unique – you could just build
next to the plastic housing of includes assembly instructions. your own seven-segment display
the female GPIO header, where on a breadboard – but this is a
it can become a little tricky. Neat display fun, inexpensive board providing
With the set-up complete, we a functional (although limited)
can start using ZeroSeg. The method of output that can be
Features at a glance Python library for this board is a used in many different projects.
fork of Richard Hull’s MAX7219 If you’ve never used a seven-
library, tweaked for ZeroSeg use. segment display, try it and learn
The library is Python 2 only, how our old VCR talked to us.
though; it would be better to see
a Python 3 library as standard.
The tactile switches can be Verdict
used with RPi.GPIO and GPIO
ZeroSeg
Zero Python libraries, and we
MAX7219 Design hear whispers of seven-segment
Developer: AverageManVsPi & Pi Hut
The common chip is used Careful thought has led to Web: http://bit.ly/ZeroSeg
to drive the dual seven- small components being display compatibility being Price: £10
segment display and it
connects to the Pi using
an SPI interface.
on the back and their
solder joints covered by the
larger, front facing parts.
added to GPIO Zero, enabling
even easier hacks. The example Rating 8/10
scripts provide enough of a
The Picademy
The Raspberry Pi Foundation rolls out
more free training for educators in 2017
he Raspberry Pi was created to help courses available for 2017. They are at The
T
children learn programming skills TramShed in Cardiff on 21/22 February, the
from a young age, so it’s no surprise MadLab in Manchester on 14/15 March and 2/3
that the Raspberry Pi Foundation has October, the Learning Hub @ Birmingham Airport
always had close links to schools and 10/11 April and 4/5 December, and The Raspberry
education. In fact, the Code Club Pi Foundation in Cambridge 15/16 May. There will
concept (www.codeclub.org.uk) – where an also be dates in May and November in London at
enthusiast teams up with a school or library to a location to be confirmed.
run an after-school club for kids aged 9-11 using A Picademy course lasts two days, and is a
specially created resources – was a big hit last mixture of digital making workshops, project-
year. There are now 75,000 children in the UK based learning and hacking. The Pi Foundation
regularly attending 5,000 code clubs. are keen to stress that you don’t need to have
Another of the had any previous
initiatives the Pi
Foundation have set
PICADEMY GIVES TEACHERS experience to
attend the
up recently to help
educators get to
THE SKILLS AND KNOWLEDGE Picademy, just a
love of computing
grips with the Pi is TO USE A PI, WHATEVER THEIR and an enthusiasm
the Picademy, a free for teaching it to
CPD (Continuing COMPUTING EXPERIENCE kids. So, if you
Professional work in education
Development) and think you’d
programme that aims to give teachers the skills benefit from the course, then head to https://
and knowledge they need to use a Raspberry Pi www.raspberrypi.org/picademy/picademyuk/
in their place of work, no matter what level of apply and fill in the application form.
computing experience they have. The only bad news is that the courses tend to
2016 was a great year for the Picademy, with be over-subscribed, so make sure you spend a
540 people graduating the courses, but the decent amount of time on your application, giving
Raspberry Pi Foundation want 2017 to be even them the chance to see who you really are and
better. They have just released details of the why the course would benefit you.
www.lifehacker.co.uk
twitter.com/lifehackeruk facebook.com/lifehackeruk
Discover
the world of
Raspberry Pi
The latest Pi projects,
news and reviews