You are on page 1of 6

NEW RASPBERRY PI ZERO W OUT NOW!

The official Raspberry Pi magazine Issue 55 March 2017 raspberrypi.org/magpi

BUILD A DIGITAL MAKE AN


WHOOPEE CUSHION ALEXA ROBOT
Have a laugh with Take voice control
physical computing with Amazon’s Alexa

RETRO
GAMING
BLISS
Build this handheld gaming masterpiece
with the brand new Raspberry Pi Zero W

BACK UP YOUR ADVANCED


RASPBERRY PI GPIO CONTROL
Kee our le ae Improve your projects

Also inside:
PI ZERO NOW HAS
> THE TINY PI-POWERED SMARTPHONE
> UPGRADE YOUR TV WITH A PI HTPC
WIRELESS!
And it’s hidden
> 3D MODELLING ON RASPBERRY PI inside this month’s
Issue 55 • Mar 2017 • £5.99

> KODI 17 REVIEWED AND RATED big-build project 03

THE ONLY MONTHLY MAGAZINE WRITTEN BY AND FOR THE PI COMMUNITY 9 772051 998001
Contents
Issue 55 March 2017 raspberrypi.org/magpi

TUTORIALS COVER FEATURE


> PI 101 – BUILD A HTPC 38
Make the ultimate Kodi media centre

> PI 101 – BACK UP YOUR PI 40


Keep your important files safe

> VOICE-CONTROLLED ROBOT 42


Build an Alexa-powered Pi robot

> INTRO TO C 9 – USER INPUTS 46


Get user input and implement it in your C code

> MAKE 3D MODELS ON YOUR PI 48


Create a squid in Glise on Raspberry Pi

> SONIC PI SOUND DESIGN


Make new sounds by removing synth elements
52 14
> ADVANCED GPIO ZERO 54
Use Source/Values to make your code more efficient

BUILD A RETRO
HANDHELD
> MAKE A WHOOPI CUSHION 56
Create an electronic farting machine

> REMOTELY MONITOR PROCESSES 60


Create a process dashboard with email alerts

COUNTERFEIT GOOGLE
IN THE NEWS CASES SURVEY
PI CURRICULUM

New school curriculum uses digital making


6 Don’t get caught out
by these fake Pi cases
10 Google wants to know
if Pi users want AI tools
13
4 March 2017 raspberrypi.org/magpi
Tutorial WALKTHROUGH
GERMANO CESARI
CEO and Glise lead developer
at twistednormal ltd. Writes
code for a living, smokes ribs
for pleasure.
twistednormal.com

MODEL A SQUID
WITH GLISE How to get started with 3D modelling and turn your Raspberry Pi
You’ll into a personal graphic workstation
Need uring the last few years, 3D applications Set up and install
> Raspbian D have been behind many achievements
in computational and video hardware,
You must first activate the e perimental penGL
drivers – find out how on the Raspberry Pi website
> Glise
magpi.cc/ addressing whole new branches of computer graphics. here: magpi.cc/2knRTvS. You might also want to
2kqaIiq Once known as 3D modelling applications, these increase the GPU memory to 128MB.
> Experimental packages are now best described as fully edged Download Glise for Raspberry Pi from
GL drivers modelling suites, with ever-higher hardware twistednormal.com, right-click on the downloaded
magpi.cc/
requirements and steeper learning curves. We want to installer, and select Package Install.
2knRTvS
take a step back and focus on pure 3D modelling using Avoid any L E Glise key binding con ict they
> Three-button
Glise, a new free modeller with minimal hardware both use Alt+mouse drag). You can either edit
mouse
requirements and a painless interface. Built from ~/.config/openbox/lxde-pi-rc.xml and comment
scratch, it turns a Raspberry Pi into a true modelling out the whole <context name="Frame"> section, or
tool. So let’s get started and see what your Raspberry simply press the unction Windows key when using
Pi can do! the Alt key to move the camera in Glise.

We will create a coarse sketch,


add ns e es and en ac es Extrude faces and bevel e ne o mode and ad s
then tweak as needed ed es o add e es ns the pose using soft selection
and tentacles and ea mode

48 March 2017 raspberrypi.org/magpi


MODEL A SQUID WITH GLISE Tutorial

Fig 1 Basics of tweaking a face:


a) selection and handle
b) translation
c) scale

What we are going to do gizmo on its lower-right corner. By default, Glise


3D modelling is an iterative process where you push, will use a single, full-screen modelling canvas. If you STICKY
pull, and tweak vertices, edges, and faces. But how do want to change the default layout, check the online
KEYS
you turn simple, geometrical primitives into an alien documentation at Layouts, iewports and ialogs’. Start a tool,
spider, a ying mussel, or a panda playing a banjo Creating a cube is straightforward: use a right keeping its
shortcut
As any good artist, you will start by sketching out mouse button R click anywhere in a modelling
pressed, and
the basic proportions of the model using a very coarse canvas to open the pop-up menu, and select Create leave tool
mesh, which has only few components and allows ube. ow that there is an object in the scene, mode by
releasing it.
you to make big changes quickly. As your modelling you can move the camera by pressing the ALT key
No need for a
session progresses, you’ll work on increasingly and dragging the left mouse button L to rotate, RMB click.
comple details, adding new, smaller components, the middle mouse button to pan, or the R
either locally or by subdividing your whole model.
We’re going to draw a squid, since they’re relatively
easy to model, yet comple enough to let us cover
Focus on the modelling
several fundamental concepts.
canvas, which is where all
Modelling basics
Instead of going ahead with an endless list of actions the magic happens
to perform, like ‘click there’, ‘open that’ and the
like, let’s go through the fundamental concepts to zoom. Whenever the Alt key is pressed, drag
and procedures needed to sketch the squid head, the mouse to move the camera. Any time you want
which, surprisingly enough, you’ll be able to model to centre the cube, just press pace and it will be
all by yourself once you’ve grasped the basics. You framed in the current canvas. Practise with these
might want to check the online documentation at controls: moving the camera and framing things must
magpi.cc/2knLzo2 and you definitely should while become second nature. See ‘Navigation’ in the online
practicing, to get more in-depth information about documentation for more camera controls. TWEAK
the topics discussed here. All this is fine and dandy, but you won’t get very
MODE
Glise’s main window may contain several far just by rotating a camera around a cube. o we’re Press Ctrl+Shift
independent viewports, each holding either a scene going to tweak a face, which is, yes, modelling! Left- and LMB/
MMB-drag
manager, a Python console, or a modelling canvas click on a face to select it. As the face turns yellow, a to translate/
an ambient occlusion renderer is also available on -a is handle is placed right on its centre Fig 1-a). scale a
Linu and Windows . ince we’re not going to deal You can now L -drag any of the arrows to translate preselected
component
with scene management or Python programming, the selection along a direction Fig 1-b , or L - without
we will focus on the modelling canvas, which, as the drag the centre of the handle to move it freely. Try selecting it
name implies, is where all the magic happens. You it! Dragging an arrow with the middle mouse button r an u ing
he han le
can easily spot a modelling canvas from the little a is will make you scale the selection along a direction.

raspberrypi.org/magpi March 2017 49


Tutorial WALKTHROUGH

single right mouse button click to e it tool mode.


Again, trl Z is your friend if you mess things up.
ongratulations - you know a lot of stuff now!

Sketching the head


So you know how to create a primitive, rotate the
camera, tweak components, and e trude faces. elieve
it or not, you can easily model our target shape in
Fig 2 all by yourself. You can skip this if you managed
to model something close enough. Otherwise, this
is how to proceed in five easy steps create a cube,
e trude a side face slightly outward, scale it smaller,
and e trude it inward. cale the opposite face smaller.
sn’t modelling awesome
We know what you’re thinking: if that’s a squid
Fig 2 Coarse head MMB-drag the centre of the handle for a uniform head, what on earth have we been eating on’t
sketch reference:
a om he on scale on every a is Fig 1-c . Left-click on an empty worry; let us introduce you to the wonderful world of
om he ac area to clear the selection. Play with the handle subdivision. Subdivision is the process of applying a
and get comfortable with translating and scaling, specific set of rules to generate a more comple mesh
change the type of components you can select and from a simpler object. Glise handles each object as
tweak press A, , , G to switch to points, edges, if composed of two distinct yet entangled entities:
a base mesh and its subdivided surface. When you

When you model a base mesh, model a base mesh, Glise automagically takes care of
its subdivided surface in real time. You may change

Glise automagically takes care the display mode of a modelling canvas by pressing
1 to see only base meshes, 2 to see only subdivided

of its subdivided surface


surfaces and work directly on them the default , or
to see both.
Now press PgUp twice to increase the display
faces, or mi ed , and remember that a simple trl Z appro imation level of the surface of our sketch.
will undo any unwanted change. Check the online sn’t it starting to look like a s uid eep in mind
documentation at ‘Preselection, Selection & Soft that each level will eat four times more memory and
Selection’ and ‘Handles & Tweaking’ to learn more video memory) than the previous, so depending on
about selections and tweaking. the comple ity of your model, you might not want
Now one last, quick step: select a cube face and to go further than a couple of levels. Use PgDn to get
press . You’re currently using the e trude tool back to the previous level. See ‘Introducing Glise’ and
to perform a face e trusion. ove the mouse left ‘Display’ in the online documentation to learn more
and right to slide the newly created face and use a about what we’ve just covered.

Fig 3 dd n ns
a) edge selected
b) after edge bevel
c) during face extrusion

50 March 2017 raspberrypi.org/magpi


Tutorial
Eyes, fins, and tentacles TOOLS AND
Well, we’re done now with our rough sketch,
PRESELECTION
and it’s time to proceed to the ne t level. We want
to add a few details. Unfortunately, our base mesh Most tools
also work on
the one you actually model is basically still very
preselection.
close to a simple cube. We can’t e trude fins and There is often
tentacles from a cube’s face, because we need no need for
a selection
components to work with, and in the middle of a
to operate
face there’s only, well, a face. So follow us, and on single
everything will be clear in a minute: press F to components.
switch to object selection mode, select our object,
and press hift Pg p aka Refine’ . This will replace
Fig 4 Adding tentacles:
our base mesh with the first appro imation level a) vertices selected
of its subdivided surface, which will keep its shape. b) after vertex bevel
c) during face extrusion
Now our model has way more components, and we
can have our fins in the right place. ut wait s uids
have a symmetrical body. Let’s work on one side
and have Glise take care of the other! We just have
to properly set up symmetry on our squid: press S
to switch to edge selection mode, and select one
of the edges dividing the left side from the right.
Press Alt ymmetry ompute rom Edges
and that’s it. sn’t symmetry great f instead you
received an error message, check that the edge
you selected really lies on the centre of the model.
There are also other ways to compute symmetry
– check ‘Symmetry’ in the online documentation
to learn more.
ack to the fins now that we’ve refined our
model and enabled symmetry, select an edge like
Fig 3-a and press B to use the edge bevel tool.
Slide the mouse like in Fig 3-b and right-click to
e it tool mode. ow select the newly created face
and e trude it as in Fig 3-c. We’ll make something
similar for the tentacles, but we will work with
vertices press A to switch to verte selection
mode, select the vertices as in Fig 4-a, and press
Ctrl+B to use the bevel tool on those. Right-click to
e it tool mode when you’re close to Fig 4-b. Then
all we need to do is e trude the newly created faces
as in Fig 4-c. Create the eye by using the bevel tool
on a single verte and deleting the resulting face
with Del.
ow it’s just a matter of tweaking a bit and
working on a few further e trusions, and your final
result will be very much like the squid in our picture.
t doesn’t have to be e actly the same – it must be
what you want it to be. LOCAL
PIVOT
What now? Local Pivot
Well, this is uite a comple subject, and this short forces the
tutorial wasn’t meant to cover everything. There camera to
are tons of books, online tutorials, and videos on rotate around
the centre
each single topic related to 3D modelling. Still, the of the scene,
tools you used in these pages can be found in any 3D ignoring
software package, and the fact that you’re doing this selections.
Press L
on your Raspberry Pi is awesome! Now draw and be o  oggle
creative, but above all, have fun!

raspberrypi.org/magpi March 2017 51

You might also like