Skip to main content

The MagPi - October 2018

Page 1

BUY IN PRINT WORLDWIDE MAGPI.CC/STORE

Issue 74

October 2018

magpi.cc

The official Raspberry Pi magazine

BUILD A LAPTOP Media Centre Kits

Code Space Invaders Recreate this classic in Python

Plus Grow veggies with the Aquaponic Garden Play Rock, paper scissors with AI Table football scoreboard

Haunted

Hacks CreePi projects for Halloween

magpi.cc/store

WIN!

Digital making on the go with Raspberry Pi

Make a Washing Line Sensor Keep your clothes dry

New Picade | Top 10 Cases | QuickStart guide


Code

Design

Configure

Analyze

Now free for home projects A professional control system development tool

CDP Studio is a development platform for industrial control systems, now coming with a free version for non-commercial use. The system can run on a Raspberry Pi, supports C++, open source libraries and has a large feature toolbox including GPIO, I2C and MQTT. Its built in GUI design tool and features lets you code less and do more. Free download on www.cdpstudio.com

CDP Technologies AS Nedre Strandgate 29 P.O. Box 144 NO-6001 Ă…lesund, Norway

Tel: +47 990 80 900 info@cdptech.com www.cdpstudio.com


WELCOME

WELCOME to the new look MagPi

Lucy Hattersley Editor

EDITOR

R

egular readers will notice a big change this month. We’ve been working hard on this issue for many months; so, welcome to your amazing new look version of The MagPi. We believe The MagPi is the best computer magazine on the newsstand. Every issue is packed with physical computing advice, code, and the most amazing projects from the greatest computer community on Earth. So how do you make the best computer magazine even better? Throughout this edition, you’ll find bigger photographs of brilliant community projects; the latest Raspberry Pi product information; cleaner and clearer fonts for both text and code; and a fresh new design that’s brighter than ever. We’ve made space for bigger features on the most important Raspberry Pi computing projects, tutorials, and reviews. In short, The MagPi is better than ever. We hope you love this new look as much as we do.

Lucy Hattersley Editor of The MagPi. Lucy codes, crafts, and creates wonky robots. She speaks French (badly) and mangles the piano. One day she’ll get that pet dog. magpi.cc

PAGE

30

PS: We’re 75 issues young next month. Stay tuned!

magpi.cc

03


CONTENTS

Contents > Issue 74 > October 2018

Cover Feature

20 Build your

own laptop

20

Regulars

06 News 66 Technical FAQ 94 Your letters 98 Final word Project Showcases

08 12 14 16 18

Aquaponic Garden PiCam Marine camera FRILLER robot Table Foosball Rock, Paper, Scissors

PiCam Marine camera

16

Table Foosball

12

32

Pygame Zero Invaders

DISCLAIMER: Some of the tools and techniques shown in The MagPi magazine are dangerous unless used with skill, experience, and appropriate personal protection equipment. While we attempt to guide the reader, ultimately you are responsible for your own safety and understanding the limits of yourself and your equipment. Children should be supervised. Raspberry Pi (Trading) Ltd does not accept responsibility for any injuries, damage to equipment, or costs incurred from projects, tutorials or suggestions in The MagPi magazine. Laws and regulations covering many of the topics in The MagPi magazine are different between countries, and are always subject to change. You are responsible for understanding the requirements in your jurisdiction and ensuring that you comply with them. Some manufacturers place limits on the use of their hardware which some projects or suggestions in The MagPi magazine may go beyond. It is your responsibility to understand the manufacturer’s limits.

04

magpi.cc


CONTENTS

80

Top 10 Pi Cases

14

Tutorials

32 Pygame Zero Invaders 40 Pi Bakery: Matrix – part 2 46 Laundry-saving rain detector 50 Minecraft with Wolfram 56 Make games in C – part 10 60 Pi QuickStart guide The Big Feature

68

FRILLER robot

78

76

Reviews

76 Picade 78 Kitty Ears 80 10 best Raspberry Pi cases 82 Learn C with Raspberry Pi Community

Kitty Ears

WIN One of Five Pi Switch Caps

Picade

86 Interview 88 This month in Raspberry Pi 92 Events

96 In association with

with an OLED display and weather pack!

magpi.cc

05


THE WORLD OF PI

EMF festival powered by Raspberry Pi network LimeSDR guarantees no rain on the parade of electronic making, reports Rosie Hattersley

T

he Electromagnetic Field festival (emfcamp.org) has become a magnificent summer highlight among makers, scientists, engineers, and crafters. Held over the August bank holiday weekend in the grounds of Eastnor Castle, Herefordshire, Electromagnetic Field (EMF) is a magnificent celebration of all things inspirational and DIY design and makable. Organisers describe it as a “camping festival with a power grid and highspeed internet access; a temporary village of geeks, crafters, and technology enthusiasts.� Come night-time, EMF turns into a brightly lit festival more akin to a traditional music weekender.

06

magpi.cc

EMF festival powered by Raspberry Pi network

A LimeSDR mounted base station providing GSM for EMF festival-goers ixteen Pi-powered S base stations, boxed up and ready to deploy at the festival


THE WORLD OF PI

Weatherproofing the boards was essential, given the British weather Inside the base station is a Raspberry Pi 3B+ and LimeSDR board

But electrical and electronic kit does not obviously lend itself to being assembled and demonstrated in a rural field, particularly when said field is situated in the British countryside. Chancing the great British summer with millions of pounds’ worth of people’s highly personal tech

T he base stations combined a LimeSDR Mini board with a Raspberry Pi 3 Model B+ at stake is a foolhardy venture. Not only that, but even festival-goers’ badges are tech-heavy. Entry depends on a badge that is also a full-blown microcontroller, with WiFi and an LCD screen, that participants can take home and reprogram.

Mobile connectivity

Sensibly enough, the organisers of EMF not only recruited a mobile communications network provider to ensure internet connectivity for festival-goers, but they also weatherproofed the entire shebang. Lime Microsystems (limemicro.com) put together a self-contained GSM network and wireless infrastructure consisting of 16 weatherproof base stations. The base stations combined a LimeSDR Mini board with a Raspberry Pi 3 Model B+ host running Linux on

a fully open-source GSM base station (BTS) stack and Osmocom cellular network software. The mounted base stations enjoyed a mains power supply, via a 24 V adapter and DC-DC converter, making it critical that their Raspberry Pi enclosures were fully waterproof and allowed no moisture to ingress. The upshot: the festival’s technological mavens could confidently show off their innovations and ideas with no fear of rain stopping play.

EMF festival powered by Raspberry Pi network

magpi.cc

07


MAKER

PROJECT SHOWCASE

Aquaponic Domestic Garden

Diego Braga An IT DevOps engineer with a passion for automation and IoT projects.

@braghettos

Growing veggies indoors when you’re not always there is easy when you have a Raspberry Pi and a guard fish. Rob Zwetsloot learns more

“L

iving in a big city has pros and cons,” Diego Braga tells us. “One of the cons I suffered most is not having a small organic garden.” Diego lives in Milan, in a small apartment with a smaller balcony that he spends a lot of time away from. That didn’t stop him wanting to grow some fresh veg for himself, though, and he looked at hydroponic gardens to see if that was a solution. “One of the cons of this approach is that you need to feed fertiliser in the water, and that’s

S itting in a corner of the living room, the mini garden takes up very little space

08

magpi.cc

Aquaponic Domestic Garden

something that, even if it can be automated, is not self-sufficient,” Diego explains. “In 2015, EXPO Italy took place and in a pavilion there was an aquaponics system in which plants and fishes were living close and feeding each other. I started to study the aquaponics system and it blew my mind: two different ecosystems (the aquarium with fishes and plants in the solid earth) can feed each other. The waste of one is the nourishment of the other. That was what I wanted.”


PROJECT SHOWCASE

The plants get light from the various lamps surrounding the system

Fish waste is pumped up to the plant to be used as fertiliser

Quick FACTS > Diego spent two and a half years making his garden > The fish’s name is Qwerty > Every night, the garden sends a report to Diego about the soil

A little fish manages to help keep the system in balance, getting nutrients from the plant as well as helping it grow

> Monitoring the garden from his phone was one of his requirements > It’s also designed to be aesthetically pleasing, part of the furniture

Aquaponic Domestic Garden

magpi.cc

09


PROJECT SHOWCASE

T here are a lot of sensors required to keep the system working well

A prototype setup

for the system using IKEA parts

Diego figured all he’d then have to automate is the cleanliness of the aquarium, and decided to do it and collect sensor data via IBM Watson’s IoT platform. It took him a while to figure out how. “First of all, I had to study a solution to keep the aquarium clean. The fish waste is the perfect nourishment for the plants and this waste lies on the bottom of the aquarium. One night I had an inspiration: use an X-Y plotter and, instead of

writing on a surface, use a submersible pump to collect all the waste and deliver it to the plants.”

Pump it up Building the shelves

to house everything properly takes some custom work

10

magpi.cc

Aquaponic Domestic Garden

Using an IKEA shelf with the aquarium at the bottom and pot on the shelf above, the waste water is pumped up to the plant, which then uses it and pH-balances the water, while gravity allows nutrients to drop down to the fish.


Turn static files into dynamic content formats.

Create a flipbook
The MagPi - October 2018 by Flexibooks - Issuu