ebook img

BDM’s Raspberry Pi: Tricks, Hacks & Fixes Guides (2018) PDF

196 Pages·2018·76.74 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview BDM’s Raspberry Pi: Tricks, Hacks & Fixes Guides (2018)

BDM’s T N E D N E P E D N % I 0 0 1 BDM’s Raspberry Pi Tricks, Hacks & Fixes Everything you need to master the Raspberry Pi… The Raspberry Pi is without doubt This book covers the initial set up, guides the most utilised computer of recent you through the minefield of getting years . It’s been a part of thousands of the Raspberry Pi to boot into a workable projects and sent to places that most of desktop system, teaches you how to us only dream about visiting . It’s used use the operating system and avoid the for science, engineering, mathematics, common pitfalls . We also look at coding space travel, communications, weather tricks with Python and FUZE BASIC . There monitoring and prediction, gaming, are project ideas and hacks that will help programming, education and as a you get on your way to mastering the standard desktop . Raspberry Pi and advice on what to do should you come across Pi problems . Inside this Raspberry Pi – Tricks, Hacks & Fixes book we show you how to get Whatever your goals are with the the most from your Raspberry Pi . With Raspberry Pi, this book, and a little the best tips, tricks and guides available, imagination, are all you need to join you can be up and running and planning the other 19 million Pi users around the your unique project within days . world and realise your digital  dreams. BDM’s Raspberry Pi - Tricks, Hacks & Fixes Editorial and design are the copyright © Papercut Limited. No part BDM’s Raspberry Pi – Tricks, Hacks & Fixes is an independent ISBN 978-1-907306-62-4 of this publication may be reproduced in any form, stored in a publication and as such does not necessarily reflect the views Published by: . . . . . . . . . . . . . . . . .Papercut Limited retrieval system or integrated into any other publication, database or opinions of the producers contained within. This publication Editor: . . . . . . . . . . . . . . . . . . . . . . . .James Gale or commercial programs without the express written permission is not endorsed or associated in any way with The Linux Art Director & Production: . . . . .Mark Ayshford of the publisher. Under no circumstances should this publication Foundation, The Raspberry Pi Foundation, ARM Holding, Production Manager: . . . . . . . . .Karl Linstead and its contents be resold, loaned out or used in any form by way Canonical Ltd, Debian Project, Lenovo, Dell, Hewlett-Packard, SEDudebisti ogErdniai:t lo: . . .r . .: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .PRRaouubssli n BW eDaarrreedw, ,D Mavairdt iHn aSymwitahr,d L ena Whitaker ooLifum rtsritaeedlvdee rswe ositenhr ovthueets ttqhhueea plriitugybh lotis fn htoehtre ’ts oi nw bfroeirt mhteeanltd ipo rener smwpeios nspisroiobnvl.ei dW feoh, riPl eaa npwyee r cpurtid e AApll pcloep aynrdig hSatsm, tsruandge mora arknsy a ansds orceigaitset eorre adf fitrlaiadteem coarmkps afonry .t he mistakes or inaccuracies found within the text of this publication. respective companies are acknowledged. Relevant graphic Digital distribution: For all advertising and promotional Due to the nature of the software industry, the publisher cannot imagery reproduced with courtesy of Lenovo, Hewlett- Packard, Pocketmags .com, opportunities contact: guarantee that all tutorials will work on every version of Raspbian Dell, Samsung, FUZE Technologies Ltd, and Apple. Apple App Store & Google Play enquiries@bdmpublications .com OS. It remains the purchaser’s sole responsibility to determine Additional images contained within this publication are the suitability of this book and its content for whatever purpose. reproduced under licence from Shutterstock.com. Images reproduced on the front and back cover are solely for Prices, international availability, ratings, titles and content design purposes and are not representative of content. We are subject to change. All information was correct at time of advise all potential buyers to check listing prior to purchase for INTERNATIONAL LICENSING confirmation of actual content. All editorial opinion herein is that print. Some content may have been previously published in Papercut Limited has many great publications and all are available for licensing of the reviewer as an individual and is not representative of the other volumes or BDM titles. worldwide . For more information go to: www .brucesawfordlicensing .com; publisher or any of its affiliates. Therefore the publisher holds no email: bruce@brucesawfordlicensing .com telephone: 0044 7831 567372 responsibility in regard to editorial opinion and content. Papercut Limited Copyright © 2018 Papercut Limited . All rights reserved . Registered in England & Wales No: 4308513 @bdmpubs BDM Publications www.bdmpublications.com Contents Raspberry Pi - Tricks, Hacks & Fixes 32 Using the Raspbian OS 64 Getting to Know Unix 34 Take a Tour of PIXEL 66 What is Unix? 36 Exploring the Command Line 68 Understanding Unix 38 Getting Raspberry Pi Online 70 Using the Unix Filesystem 40 Setting Up a Static IP Address 72 Listing and Moving Files 42 Connect Remotely with VNC 74 Creating and Deleting Files 44 Using the Built-in Applications 76 Create and Remove Directories 46 Using APT to Install and Remove 78 Copying, Moving and Renaming Files Programs 80 Using the Man Pages 48 Using the File Manager 82 Editing Text Files 50 Transfer Files Using FTP 84 Getting to Know Users 52 Using the Archiver App 86 Ownership and Permissions 54 Using the Task Manager 88 Useful System and Disk Commands 56 Get More from the Terminal App 90 Managing Programs and Processes 58 Using the Leafpad Text Editor 92 Input, Output and Pipes 60 UsingLibre Office to Create 94 How to Customise Unix Documents 62 Edit Images with GIMP 6 Raspberry Pi Hardware & Setup 8 Say Hello to Raspberry Pi 10 Get to Know the Raspberry Pi 12 Up Close with the Raspberry Pi 3 B+ 14 Kit You’ll Need and How to Set it Up 16 Set Up Raspberry Pi Using a Mac 18 Set Up Raspberry Pi Using a Windows PC 20 Set Up Raspberry Pi Using Linux 22 Copying NOOBS Files from Linux 24 Using NOOBS to Set Up Raspberry Pi 26 Installing Image Files with Etcher 28 Editing the Config.txt File 4 BDM’s Raspberry Pi - Tricks, Hacks & Fixes Contents 146 Raspberry Pi Projects 148 Create a Music Streaming Box 150 Create a Media Server 152 Build a Retro Games Console 154 Raspberry Pi Portable Games Console 156 Set Up a Time-lapse Webcam 158 Build a Web Server 160 Create a Supercomputer 162 Build a CamJam EduKit Robot 164 Controlling Your Robot 166 Add Sensors to Your Robot 168 Turn an RC Toy into a Robot 170 Using GitHub 172 Raspberry Pi Add-ons and Extras 174 The Best HATs for Your Raspberry Pi 180 Raspberry Pi Kits 182 Raspberry Pi Cases 184 Raspberry Pi Robots 186 Raspberry Pi Screens and Displays 188 Android Apps for Pi Users 190 Essential Software 192 Common Raspberry Pi Problems 96 FUZE & Introduction 120 Getting Started with Python to Coding 122 Starting Python for the First Time 98 Introducing the FUZE Project 124 Your First Code 100 Setting up the FUZE 126 Saving and Executing Your Code 102 Getting Started with FUZE BASIC 128 Executing Code from the Command Line 104 Coding with FUZE BASIC – Part 1 130 Numbers and Expressions 106 Coding with FUZE BASIC – Part 2 132 Using Comments 108 Coding with FUZE BASIC – Part 3 134 Working with Variables 110 Using a Breadboard 136 User Input 112 Using the FUZE IO Board 138 Creating Functions 114 Using a Robot Arm with FUZE BASIC 140 Conditions and Loops 116 FUZE BASIC Examples – Part 1 142 Python Modules 118 FUZE BASIC Examples – Part 2 144 Python Errors www.bdmpublications.com BDM’s Raspberry Pi - Tricks, Hacks & Fixes 5 Raspberry Pi Hardware and Setup 6 BDM’s Raspberry Pi - Tricks, Hacks & Fixes Raspberry Pi Hardware and Setup INDEX Raspberry Pi Hardware and Setup Using the Raspberry Pi should always start with understanding the hardware. There are several versions of the Raspberry Pi available: Pi 1 Model A+, Pi 1 Model B+, Pi 2 Model B, Pi 3 and Pi Zero. Confused? You needn’t be, as we’ll explain what each one can offer you. The Raspberry Pi may be diminutive in size but it’s a surprisingly powerful computer. This little powerhouse is capable of so much but first we need to make sure we have everything needed to get up and running. Throughout this section we help you figure out what’s needed in terms of connectivity, the extra hardware and of course the operating system itself. From there we look at getting the Raspberry Pi set up and ready to use, regardless of whether you’re working with a Windows PC or Apple Mac. By the end of this section you’ll have a Raspberry Pi running the latest version of Raspbian (the official RPi operating system) and brimming with potential. 8 Say Hello to Raspberry Pi 20 Set Up Raspberry Pi Using Linux 10 Get to Know the Raspberry Pi 22 Copying NOOBS Files from Linux 12 Up Close with the Raspberry Pi 3 B+ 24 Using NOOBS to Set Up Raspberry Pi 14 Kit You’ll Need and How to Set it Up 26 Installing Image Files with Etcher 16 Set Up Raspberry Pi Using a Mac 28 Editing the Config.txt File 18 Set Up Raspberry Pi Using a Windows PC www.bdmpublications.com BDM’s Raspberry Pi - Tricks, Hacks & Fixes 7 Raspberry Pi Hardware and Setup Say Hello to Raspberry Pi Let’s take a look at the best-selling British computer ever: the Raspberry Pi! This bare-bones machine just looks like any other piece of circuitry, until you realise it’s a full-blown credit- card sized computer ideal for learning programming and home hacking. The Raspberry Pi is a British built low cost computer that enables There’s no hard drive on the Raspberry Pi, instead the operating everybody to learn computing, start programming and explore basic system is installed on an SD Card (the cards typically used in electronics. It’s the size of a credit card but capable of running a full cameras). The operating system is installed onto the SD Card by operating system and doing everything a desktop does. copying the files to the SD Card using a computer. We’ll show you how to set up Raspbian JESSIE with PIXEL (and other OS’s) using a More importantly, with the Raspberry Pi you install your own Mac, Windows or Linux computer. operating system, connect all your devices and create your own programs using languages like Scratch and Python. There’s no case Once you have an OS installed on the SD Card you can set up your so you can hook up electronic circuits to the pins and control them Raspberry Pi. The Raspberry Pi is connected to a monitor via a HDMI to get input and output, so you can hack together electronic projects socket whilst a keyboard and mouse is attached to the USB socket. at home. A smaller Micro USB connection is used to provide power to the device. Most Raspberry Pi models feature an Ethernet connection, Setting up a Raspberry Pi is pretty simple, and throughout this book and an Ethernet cable is connected from your Raspberry Pi to a we’ll take you step-by-step from unboxing your Raspberry Pi to socket on your modem router. setting it up and getting started. The Raspberry Pi 3 has built in wireless networking and Bluetooth, There are many different models of Raspberry Pi available and each making it easy to get online. You can attach a USB Wi-Fi dongle or has slightly different features (see opposite). Ethernet adaptor to older models. The fundamentals of each Raspberry Pi are similar though. Each First it will help to know which Raspberry Pi you are using. This model is a lightweight computer on a single board that’s roughly can be tricky as there have been several distinct models so far. the size of a credit card. Each Raspberry Pi board features a The layouts opposite will help you determine which Raspberry Pi processor made by ARM, which is similar to the models you find in you have. a mobile phone. The ARM processor is fast and lightweight but it runs a different set of software than you might be used to. There are This book covers all the different models, and they offer largely many different operating systems (OS) available, but for most of this similar features, although newer models offer additional extras. book we’ll focus on one called Raspbian JESSIE with PIXEL, which is Once you know which Raspberry Pi you own, you can get it up the OS recommended by the Raspberry Pi Foundation. and running. 8 BDM’s Raspberry Pi - Tricks, Hacks & Fixes Say Hello to Raspberry Pi Raspberry Pi 3 Model B+ Raspberry Pi 2 Model B Raspberry Pi 1 Model B+ The new Raspberry Pi 3 Model B+ was launched on International Pi day 2018, 14 March. This is an improved version with a faster 1.4GHz 64-bit quad-core ARM Coretx-A53 processor, a dual-band 802.11ac wireless LAN and Bluetooth 4.2 controller, faster Gigabit Ethernet, improved mass storage USB booting, improved thermal management and Power-Over-Ethernet support. All other aspects of the new Raspberry Pi are the same as the previous Pi 3 and as such, all the previous content you come across is compatible. This is the board we recommend you buy if you’re new to the wonderful world of the Raspberry Pi. The older Raspberry Pi 2 model still found on sale. It has the same form factor as the Raspberry Pi 3 with 4 USB Ports, Ethernet connection and Micro USB. Raspberry Pi 1 Model A+ It may look the same but it has a slower 900 MHZ quad-core ARM Cortex-A7 CPU and 1GB RAM. This brings it close in line to many low-end desktop computers. Complicating matters slightly is the existence of a Raspberry Pi Model 1 B+, which is identical in layout to the Raspberry Pi Model 2 but with an even slower ARMv6 700MHz processor. If you are confused which type you own then type cat /proc/cpuinfo at the command line. If it lists four ARMv7 processors you are using a Raspberry Pi 2, if you see just one with ARMv6 then you have the older Raspberry Pi Model 1 B+. Raspberry Pi Zero It’s worth knowing that unlike desktop computing, it isn’t always the case that you need or want the most powerful Raspberry Pi available. Projects that require very low power consumption, and that aren’t dependent on Ethernet or USB work best with the Model A+, as it uses between 0.5W and 1W to operate. The new Raspberry Pi Zero is a super small, super cheap computer However, the newer Model A+ has many features also found on that costs just £4. It’s half the size of the model A+ but has a the more recent models. In particular it has 40 GPIO pins; the surprising amount of power, including a 1Ghz single-core CPU and first 26 pins are in the same layout as the Model A and B. It 512MB RAM. It has the full 40-pin GPIO header but you’ll need to also replaces the older SD Card socket with the neater Micro SD buy the pins separately and solder them in. It uses the same variant. Unlike the Raspberry Pi 3, it has just a single USB port Micro-SD card as the other Raspberry Pi devices, so you can swap and no built-in Ethernet connection. It uses a smaller form factor SD cards between them. Last but not least, it draws an incredibly with the GPIO pins on one side. You don’t need to solder them in low amount of power (Micro USB) making it ideal for small power though. It’s a good compromise between the Raspberry Pi 3 and devices. The ports are smaller than you’d find on the larger Pi Zero. You can usually pick one up for around £20. If you’re a Raspberry Pi though, so you’ll need a mini-HDMI adaptor as well as newcomer it’s a better idea to buy the Raspberry Pi 3 instead a micro-USB adaptor to connect devices. A four-port USB Hub and and get the extra ports and wireless networking. Ethernet adaptor will come in handy too. www.bdmpublications.com BDM’s Raspberry Pi - Tricks, Hacks & Fixes 9 Raspberry Pi Hardware and Setup Get to Know the Raspberry Pi The Raspberry Pi is a marvellous microcomputer used to learn coding and for hacking home projects. It’s small, cheap and easy to get started with; here’s what you need to know about the Raspberry Pi. 40 GPIO Pins The GPIO (General Purpose Input Output) pins can be accessed directly on the Raspberry Pi. These are used in projects to connect the Raspberry Pi to electronic circuits and control electric devices. Some can be turned on and off while the Raspberry Pi is running. ARM-Powered At the heart of the Raspberry Pi 3 is a Broadcom BCM2837 System on Chip (SoC). It contains a powerful 1.2GHz 64-bit quad-core ARM Cortex-A53 CPU. This is 50-60 percent faster than the Raspberry Pi 2 and ten times as fast as the original Raspberry Pi. DSI The Display Interface (DSI) can be used to connect a display directly to the Raspberry Pi board. SD Card Slot USB Power Instead of a hard drive you use A standard Micro USB power supply is used an SD Card with the Raspberry to provide power to the Raspberry Pi. You Pi. The Raspberry Pi 3 (pictured don’t get a power supply but can use any here) uses a Micro SD Card. Some 5V 2000mA Micro USB power supply and older Raspberry Pi models use a compatible cable, or buy an official power regular SD Card. supply separately. 10 BDM’s Raspberry Pi - Tricks, Hacks & Fixes

Description:
Learn to get the most from the amazing Raspberry Pi! With a Raspberry Pi you can achieve so much: learn to program in a variety of languages, set up a media hub, conduct realtime experiments, build a smallform supercomputer or even a retro arcade cabinet. NASA use Pis onboard the International Space
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.