Adventures In Raspberry Pi
4.5/5
()
About this ebook
Even if your kids don't have an ounce of computer geek in them, they can learn to code with Raspberry Pi and this wonderful book. Written for 11- to 15-year-olds and assuming no prior computing knowledge, this book uses the wildly successful, low-cost, credit-card-sized Raspberry Pi computer to explain fundamental computing concepts. Young people will enjoy going through the book's nine fun projects while they learn basic programming and system administration skills, starting with the very basics of how to plug in the board and turn it on.
Each project includes a lively and informative video to reinforce the lessons. It's perfect for young, eager self-learners—your kids can jump in, set up their Raspberry Pi, and go through the lessons on their own.
- Written by Carrie Anne Philbin, a high school teacher of computing who advises the U.K. government on the revised ICT Curriculum
- Teaches 11- to 15-year-olds programming and system administration skills using Raspberry Pi
- Features 9 fun projects accompanied by lively and helpful videos
- Raspberry Pi is a $35/£25 credit-card-sized computer created by the non-profit Raspberry Pi Foundation; over a million have been sold
Help your children have fun and learn computing skills at the same time with Adventures in Raspberry Pi.
Related to Adventures In Raspberry Pi
Related ebooks
Adventures in Raspberry Pi Rating: 4 out of 5 stars4/5Raspberry Pi 5 Projects for Newbies: A Simplified Guide to Creating Projects with the Raspberry Pi 5 Rating: 0 out of 5 stars0 ratingsHow Tanks Work Rating: 0 out of 5 stars0 ratingsXYZ-DoKu Puzzles - Middle School Through Middle Age (and Beyond) e Age (and Beyond): "THE CORONAVIRUS RAGE" Rating: 5 out of 5 stars5/5Spring Boot 3.0 Crash Course Rating: 0 out of 5 stars0 ratingsWindows 8.1 Bible Rating: 0 out of 5 stars0 ratingsCoding for Kids: Scratch and Python Basics-Learn to Code the Fun Way! Rating: 0 out of 5 stars0 ratingsSimple electronics with GPIO Zero: Take control of the real world with your Raspberry Pi Rating: 5 out of 5 stars5/5The Official Raspberry Pi Beginner's Guide: How to use your new computer Rating: 4 out of 5 stars4/5Raspberry Pi Mechatronics Projects HOTSHOT Rating: 5 out of 5 stars5/5Raspberry Pi | 101: The Beginner’s Guide with Basics on Hardware, Software, Programming & Projec Rating: 0 out of 5 stars0 ratingsPython Programming with Raspberry Pi Rating: 0 out of 5 stars0 ratingsRaspberry Pi Projects for Kids Rating: 0 out of 5 stars0 ratingsRaspberry Pi 3 Model B for Beginners: Explore What Raspberry Pi 3 Model B Can Do Rating: 0 out of 5 stars0 ratingsRaspberry Pi Blueprints Rating: 0 out of 5 stars0 ratingsHello Raspberry Pi!: Python programming for kids and other beginners Rating: 0 out of 5 stars0 ratingsRaspberry Pi :The Ultimate Step by Step Raspberry Pi User Guide (The Updated Version ) Rating: 4 out of 5 stars4/5Raspberry Pi: A Beginner's Guide to Raspberry Pi Programming Rating: 0 out of 5 stars0 ratingsArduino Development Cookbook Rating: 4 out of 5 stars4/5Raspberry Pi for Python Programmers Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsAdventures in Arduino Rating: 5 out of 5 stars5/5Raspberry Pi For Dummies Rating: 0 out of 5 stars0 ratingsUnderstanding the Basics of Raspberry Pi: A User Guide to Using Raspberry Pi Rating: 2 out of 5 stars2/5Raspberry Pi for Secret Agents - Third Edition Rating: 0 out of 5 stars0 ratingsRaspberry Pi LED Blueprints: Design, build, and test LED-based projects using the Raspberry Pi Rating: 0 out of 5 stars0 ratingsRaspberry Pi: The complete guide to raspberry pi, including raspberry pi projects, tips, troubleshooting, and more! Rating: 0 out of 5 stars0 ratingsRaspberry Pi User Guide Rating: 4 out of 5 stars4/5
Children's Technology For You
Mrs. Frisby and the Rats of Nimh Rating: 4 out of 5 stars4/5How Do Electric Motors Work? Physics Books for Kids | Children's Physics Books Rating: 0 out of 5 stars0 ratingsFallout: A Tale of Mutation Rating: 5 out of 5 stars5/5Minecraft: Masters of Minecraft - The Awakening Rating: 5 out of 5 stars5/5The Day the Screens Went Blank Rating: 5 out of 5 stars5/5Energy: Physical Science for Kids Rating: 5 out of 5 stars5/5Cell Biology 7th Grade Textbook | Children's Biology Books Rating: 5 out of 5 stars5/5Waste of Space Rating: 5 out of 5 stars5/5Entrepreneur Kids: All About Social Media: All About Social Media Rating: 0 out of 5 stars0 ratingsMy First Book of Knots: A Beginner's Picture Guide (180 color illustrations) Rating: 0 out of 5 stars0 ratingsSpaced Out Rating: 5 out of 5 stars5/5The Kid Who Came From Space Rating: 4 out of 5 stars4/5Physics for Kids : Electricity and Magnetism - Physics 7th Grade | Children's Physics Books Rating: 5 out of 5 stars5/5Unicorns and Germs Rating: 5 out of 5 stars5/5Make Your Own Amazing YouTube Videos: Learn How to Film, Edit, and Upload Quality Videos to YouTube Rating: 5 out of 5 stars5/5Simple Machines : The Way They Work - Physics Books for Kids | Children's Physics Books Rating: 5 out of 5 stars5/5Minecraft: 70 Top Minecraft Mods That Your Friends Do Not Know (But Wish They Did!) Rating: 4 out of 5 stars4/5George and the Big Bang Rating: 4 out of 5 stars4/5Pokémon Collectors’ Handbook: Your Guide to Becoming the Ultimate Pokémon Trainer! Rating: 5 out of 5 stars5/5The Everything Kids' Scratch Coding Book: Learn to Code and Create Your Own Cool Games! Rating: 4 out of 5 stars4/5George's Cosmic Treasure Hunt Rating: 4 out of 5 stars4/5My Life as a Youtuber Rating: 5 out of 5 stars5/5Game Logic: Level Up and Create Your Own Games with Science Activities for Kids Rating: 0 out of 5 stars0 ratingsForces: Physical Science for Kids Rating: 5 out of 5 stars5/5Getting Started with Coding: Get Creative with Code! Rating: 0 out of 5 stars0 ratingsFinally Heard Rating: 4 out of 5 stars4/5100% Unofficial Roblox Mega Hits Rating: 0 out of 5 stars0 ratingsHacks for Minecrafters: Redstone: The Unofficial Guide to Tips and Tricks That Other Guides Won't Teach You Rating: 5 out of 5 stars5/5
Reviews for Adventures In Raspberry Pi
3 ratings0 reviews
Book preview
Adventures In Raspberry Pi - Carrie Anne Philbin
Introduction
Are you an intrepid adventurer? Do you like to try new things and learn new skills? Would you like to be a pioneer in creating technology? Do you own a Raspberry Pi, or are you considering getting one? If the answer is a resounding Yes!
then this is the book for you.
What Is the Raspberry Pi and What Can You Do With It?
The Raspberry Pi is a computer. A very small computer. In fact, it is roughly the size of a credit card. Don’t be fooled by its size; as we know, good things come in small packages. However, the Raspberry Pi does not come in a package at all. It does not come in a case (although you can build one, as discussed in Adventure 1) and its circuit board and chips are fully visible, as you can see in Figure 1. You can plug a Raspberry Pi into a digital TV or monitor and use a USB keyboard and mouse with it, making it very easy to use, and because of its size you can easily transport it anywhere.
The Raspberry Pi gives you the opportunity to build and control a device that does what you want it to do. For example, you can deploy your very own robot arm, controlled by a program that you have written. You can design and create your own role-playing game, or produce beautiful computer art or music, all by using code.
9781118751251-fgin01.tifFigure 1 The Model B revision of the Raspberry Pi, about the size of a credit card
Just because the Raspberry Pi is small doesn’t mean you can’t do big things with it. Here are just a few examples of some incredible Pi projects:
• Launching teddy bears into space using high altitude ballooning (www.raspberrypi.org/archives/4715)
• The ultimate bird feeder—it’s solar-powered, takes photographs and tweets images of birds! (www.raspberrypi.org/archives/4832)
• Crazy customised Halloween costumes like Doc Brown from Back to the Future (www.raspberrypi.org/archives/4856)
• A robotic sailboat (www.raspberrypi.org/archives/4109)
• Pi-controlled sculptures like the 15-foot tall Mens Amplio with a brain that lights up (www.raspberrypi.org/archives/4667)
In the final chapter of this book, you’ll use your Pi to build a jukebox that plays your favorite tunes and displays track information on an LCD screen. And with the skills you learn throughout the book, you’ll be ready to dream up your own exciting projects—and create them.
Who Should Read This Book?
Adventures in Raspberry Pi is for any young person who has an interest in making things happen using computing. You might perhaps be unsure of how to get started or want to further your current skills. Whatever your reasons, this book will be your guide for a journey with your Raspberry Pi, the most important item in your backpack. Your trek will take you from setting up your Pi, through learning the basics of programming, to discovering how to create your own project. By the end of your adventures you will have acquired the skills you need to become a pioneer of technology!
What You Will Learn
This book will help you discover some of the amazing things you can do with your new Raspberry Pi, and introduce you to many of the developer tools and projects available to you. With this book, you will learn how to set up and use your Raspberry Pi easily so that you can experience its potential for yourself. You’ll learn the skills you need to design and create your own computing projects.
You’ll find out that you can give instructions to your Raspberry Pi in a variety of ways, using different programming languages and tools. The adventures in the book allow you to experience programming using Scratch, Turtle Graphics, Python, Sonic Pi and Minecraft Pi.
You will also learn some computing (and electronics) concepts that you can apply to other devices and programming situations. Many fundamental computing concepts are similar for all programming languages, so once you understand the basics of programming in one language you can apply that knowledge to others very easily.
What You Will Need for the Projects
First and foremost, of course, you need a Raspberry Pi. If you don’t already own one, you can buy a Raspberry Pi from a distributor in your country by visiting the official Raspberry Pi website (www.raspberrypi.org) and following the links listed under the BUY A PI
banner. You will also need a monitor or other screen, a mouse and a keyboard to connect to your Raspberry Pi.
Each chapter—adventure—in the book notes any special items you need to build the project covered in that adventure. Along with your Pi, some projects require Internet access to enable you to download software or other materials. You’ll need headphones or speakers to listen to the music you make in Adventure 7. For the projects in Adventures 8 and 9, you will need some specific cables, wires, LEDs, resistors, and other hardware. You can purchase these items from your local electronics store, or from various online retailers.
As final ingredients, you’ll need some curiosity and a willingness to try new skills!
How This Book Is Organised
Every chapter of the book is a separate adventure, teaching you to use new skills and concepts while you create a project. The book is organised so that as you progress, the concepts and projects get more complex, building on what you learned in earlier adventures. Each chapter begins with an introduction to the language or tool for that adventure, provides instructions for downloading, installing, and setting up whatever you need, and usually gives you a short task to help you become familiar with the tool. After you’ve got the basics, I lead you step by step through the instructions for the main project.
In Adventures 1 and 2, you learn how to get started with your equipment and use common text commands, perhaps for the first time. These two chapters are necessary for the beginner Pi explorer, as further adventures will depend on the skills covered here.
The two most common ways to program a Raspberry Pi are to use the Scratch or Python languages that come preinstalled on the Pi’s main operating system, Raspbian. Adventures 3, 4 and 5 get you started with the basics of these languages. In Adventure 3, you use Scratch, a simple drag-and-drop programming language, to design and create your own computer game, while getting an introduction to the programming concepts of loops and variables. Adventure 4 is a bridge between Scratch and the more conventional programming language, Python. In this adventure, you use Turtle Graphics to create shapes and spirals with both programming languages. In Adventure 5, you learn how to create an adventure game program that asks for user input, uses lists, imports functions and prints text to the screen, all using text commands written in the programming language Python.
Adventures 6 and 7 take programming on the Raspberry Pi further by looking at two developer tools that you can download and use with the Raspberry Pi: Minecraft Pi and Sonic Pi. Minecraft Pi enables you to interact with and adapt the popular computer game Minecraft, using Python code to build your own transporter. With Sonic Pi, you can create electronic music by writing programs.
Another exciting aspect of using the Raspberry Pi is that it gives you the option to add on to the main board by using GPIO pins. Adventure 8 looks at the GPIO pins in more detail, introducing you to electronics and computer programming while you build a program that uses a marshmallow to make a light blink (yes, you read that right).
Adventure 9 draws on the computing concepts and skills learned through completing the preceding adventures in this book to create one big project—a jukebox. In this chapter, you learn how to plan, design and create a project from start to finish.
Finally, the Appendix suggests where you might go next to learn more about the different aspects of computer science and Raspberry Pi—including how to locate or set up your own club to share project ideas with others.
The Companion Website
Throughout this book you’ll find references to the Adventures in Raspberry Pi companion website, www.wiley.com/go/adventuresinrp. (It’s a good idea to bookmark that site so you can return to it as and when you need to.) The website includes video tutorials to help you out if you get stuck, and code files for some of the more extensive projects.
Conventions
Throughout the book, there are some special boxes to guide and support you. They use the following key:
definitions90.epsThese boxes explain complex computing concepts or terms.
tipsandtricks90.epsThese boxes are hints to make life easier.
newwarning90.epsThese boxes include important warnings to keep you and your Raspberry Pi safe when completing a step or project.
whathappens90.epsThese boxes feature quick quizzes for you to test your understanding or make you think more about the topic.
carrieannesays90.epsThese boxes provide explanations or additional information about the topic at hand.
video.epsThese boxes point you to videos on the companion website that will walk you through the tasks at hand.
You will also find two sets of sidebars in the book. Challenge sidebars ask you how you might expand on the projects in the book to make changes or add new features. Digging into the code sidebars explain some of the special syntax or programming language, to give you a better understanding of the computer languages.
When following steps or instructions using code, especially in adventures using Python, you should type in the code as set out by the instructions. Sometimes you need to type a very long line of code, longer than will fit on a single line in this book. If you see a code continued symbol at the end of a line of code, it means that line and the following line are part of a single code line, so you should type them as one line, not on separate lines. For example the following code should be typed on one line, not two:
print("Welcome to Adventures in Raspberry Pi by code continued
Carrie Anne Philbin")
Most chapters include a Quick Reference Table at the end to sum up the main commands or concepts from the chapter. You can refer to these guides when you need a refresher on the commands.
Whenever you complete a chapter, you unlock an achievement and collect a new badge. You can collect badges to represent these achievements from the Adventures in Raspberry Pi companion website (www.wiley.com/go/adventuresinrp).
Reaching Out
In the Appendix you will find ways to take your Raspberry Pi knowledge further, with references to websites, organisations, videos and other resources. Many of those resources include forums where you can ask questions or get in touch with other Raspberry Pi users.
You can also contact me by sending me a message through my website, www.geekgurldiaries.co.uk.
Time to start your adventures!
9781118751251-unin02.tifAdventure 1
You Have a Raspberry Pi. Now What?
In the pages of this book you’ll discover how to do great things with your Raspberry Pi. You’ll create art and music, programs, games, even create your own jukebox! But first, you need to get your system working.
If you are new to Raspberry Pi, the initial tasks of getting it set up and running might seem a little daunting but it is not that complicated to do. By setting up the Raspberry Pi yourself you will learn more about how it and other computers work. You will encounter technical jargon and procedures that you may not have come across before. In this chapter, I show you how to set up your Raspberry Pi so it is ready for you to use for the first time. I explain what hardware and software you need, and tell you how to put it all together into a working system. You’ll also learn how to create a backup copy of your system in case you need to replace it at some stage in the future.
definitions90.epsHardware refers to the physical elements of the computer that you can see and touch. This includes everything inside the computer case, known as components.
Software is the term given to the programs that run on the computer system. Programs are what make the hardware work, for example by making a calculation or organising your files. There are two main types of software: systems software, which runs and manages your computer; and application software, which performs a specific task or function.
What Hardware Do You Need?
Of course, the first thing you need is a Raspberry Pi. If you have used games consoles or computing devices before, you’ll notice something different about Raspberry Pi—it doesn’t come with a power supply, a charger or any connecting cables. It doesn’t have a storage device to keep your programs on either, or even a case!
So, to get started, you will first need to get the following hardware together (see Figure 1-1):
• A Raspberry Pi
• A micro USB power adapter
• A USB keyboard and mouse
• A desktop computer or laptop with an SD card reader/writer—this is to enable you to prepare an SD card with the software you need to run your Raspberry Pi
• A 4 GB SD card, like the kind you find in a digital camera
• An HDMI cable—you will be using this with an HDMI TV or monitor
• A monitor or TV
9781118751251-fg0101.epsFigure 1-1 The essential hardware you’ll need before you can use your Raspberry Pi.
definitions90.epsHDMI stands for High-Definition Multimedia Interface. HDMI devices are used to transfer video and audio data from a source device—such as your Raspberry Pi—to a compatible HDMI device like a digital TV or monitor.
USB stands for Universal Serial Bus. You have probably used a USB port on a computer to plug in a webcam or a portable memory device like a memory stick.
An SD card, or Secure Digital memory card, stores data or information. SD cards are most often used in digital cameras, to store images that can then be transferred to a computer using an SD card reader.
What Other Equipment Is Helpful?
The following additional accessories are not vital but you might want to consider acquiring some of them to improve your Raspberry Pi experience.
• A case—To protect your Raspberry Pi from damage and make it easier for you to carry, think about buying a case like the PiBow shown in Figure 1-2, designed and manufactured by Pimoroni (http://shop.pimoroni.com/products/pibow). The great thing about this case is that it’s colourful and fun, and the ports are also labelled to remind you where each cable should be inserted.
9781118751251-fg0102.tifReproduced by permission of Pimoroni
Figure 1-2 The PiBow case can help protect your Raspberry Pi.
If you don’t want to spend cash on a case, why not create your own by using the Raspberry Pi Punnet? This template can be printed onto card, and then cut out and folded into a box. You can really let yourself get creative here and customise your case using pens, paints, stickers or coloured card to create a masterpiece. You can download the template from this site: http://squareitround.co.uk/Resources/Punnet_net_Mk1.pdf.
Want a sturdier case? Build one with Lego blocks! You can find instructions to build the Lego Raspberry Pi case shown in Figure 1-3 on the official Lego website at http://www.thedailybrick.co.uk/instructions/Building%20Instructions%20[Raspberry%20Pi%202].html.
9781118751251-fg0103.tifReproduced by permission of The Daily Brick
Figure 1-3 Build a Lego case for your Raspberry Pi.
• A few spare SD cards—It’s worth having a few extra 4 GB SD cards just in case the one you’re using becomes corrupted or stops working for any reason. They are also useful for backing up your files and projects—I explain how to do this at the end of the chapter.
• An SD card