intRoduction Have you ever considered that you could buy a computer for 35 And no we’re not talking about an ancient computer from a pawn shop We’re talking about the Raspberry Pi a computer board about the size of a credit card But don’t be fooled by its fragile appearance it’s much more powerful than it seems The Raspberry Pi was developed in the United Kingdom by Eben Upton founder of the Raspberry Pi Foundation Upton and his colleagues noticed a decline in the skills of students applying to study computer science at the University of Cambridge and real ized it was because newer generations of students had grown up with computers that were easy to use The students never needed to learn how computers really work and didn’t have much oppor tunity to program or tinker Upton developed the Raspberry Pi as a way to promote teaching basic computer science in schools This is why the Pi is a bare board rather than a computer in a case so everyone can see the components of a computer More than ten million Raspberry Pi boards have been sold since it was first introduced in 2012 The Raspberry Pi has become popular not just among students but also electronics hobbyists tinkerers computer scientists and kids of all ages The Raspberry Pi can work as a regular computer you can surf the web send emails write documents watch videos and so on but that’s not its main purpose The Pi is something that you can experiment with hack and play with to build your own pro grams and inventions The Raspberry Pi and similar boards made it not only possible but easy to get involved in the world of electronics and programming resulting in an outpouring of creative inventions all over the globe Now it’s your time to invent something Who Is ThIs Book For This book is suitable for any beginners who want to make the most of the Raspberry Pi whether that’s kids who want to discover the world of electronics and programming parents and educators who want to help teach children and students or hobbyists and makers who want to use the Raspberry Pi to bring their ideas to life xvii intRoduction
We don’t assume any previous knowledge about the Raspberry Pi circuits or programming If you do have some basic skills this book will help develop them further and give you ideas for what to do next ABouT ThIs Book 20 Easy Raspberry Pi Projects is a collection of 20 projects to build with the Raspberry Pi We believe that the best way to discover new concepts is through practice and a project book is an excellent way to get started The book starts with a quick introduction to the Raspberry Pi and the Python programming language and then jumps into the proj ects The book follows a learn-by-doing approach which means you don’t need to spend countless hours learning theoretical concepts before actually building something cool You’ll learn by building fun and interactive projects like a home surveillance system and a Wi-Fi controlled robot You’ll also design user-friendly interfaces to control electronics make Internet of Things projects build a website create your own games and much more Don’t worry if you don’t have any experience programming or making circuits Each project gives you step-by-step instructions to set up the circuits schematic diagrams and the code to program the Pi You can copy the code from the book or you can go to https www nostarch com RaspberryPiProject and download it Your Pi learning shouldn’t be restricted to the projects in this book and that’s why all projects have a Taking it Further section where we offer suggestions for developing your projects further and combining concepts learned throughout the book to build more com plicated and interesting things We hope that by the end of the book you’ll have the necessary skills to bring your own project ideas to life WhAT D o You NeeD For ThIs Book The projects in this book were designed using the Raspberry Pi 3 board If you have an older model of the Pi board you can still follow along but projects will be easiest to build with a Raspberry Pi 3 Older versions have lower performance and really old versions have fewer GPIO pins We don’t know when or if a Raspberry Pi 4 will be released but so far all Raspberry Pi releases have been compatible with older boards so future versions should also be compatible with the proj ects in this book xviii intRoduction
Most of the projects in this book involve using the Pi to interact with the outside world using circuits This means that besides the Raspberry Pi you’ll also need some electronics components At the beginning of each project we provide a list of the required parts as well as an indication of the cost of the components and an estimated time for the build Projects with one symbol will likely cost less than 10 in components while projects with two symbols may be between 10 and 50 this is a wide range but the components prices vary depending on where you buy them You can also refer to the Project Component List on page 9 which is a complete list of all the components needed for this book if you want to buy them all at once orgANIzATIoN oF ThIs Book This book is divided into seven parts The Primer is an introduction to the Pi and is mandatory for properly setting up your Raspberry Pi and the parts that follow contain the projects Here’s how the parts are organized primer In this part we’ll show you what you need to get started with the Raspberry Pi and set it up for the first time We’ll also introduce you to the basics of Python the pro gramming language used throughout this book LEDs You’ll start by making projects with LEDs If you’re a begin ner in the world of electronics this part will teach you the basic concepts of circuit building Displays In this part you’ll learn how to use several types of displays to make your electronics projects more interactive These proj ects are not just about displaying sample text you’ll also learn how to gather data from the web and program a pong game sensors These projects use several types of sensors Sensors are awesome because they allow your projects to react to and interact with the world There are sensors for almost anything you may think of You’ll learn how to use a tem perature sensor a PIR motion sensor and much more xix intRoduction
cameras The projects in this part use the Raspberry Pi camera mod ule You’ll learn how to take photos with the camera and how to stream video and then use your skills to build cool projects like a burglar detector and a home surveillance system Web applications Here you’ll build your own website and then learn how to control the Raspberry Pi GPIOs remotely by build ing your own web server You’ll also explore Node-RED a powerful tool for building IoT applications easily Games and toys The projects in this part make things for you to play with You’ll build a digital drum set program and design your own game using Scratch and build a Wi-Fi robot you can control using your smartphone At the end of the book you’ll also find some reference informa tion including a GPIO guide for all available Raspberry Pi boards to date and a resistor color chart you can use to identify different resis tor values The projects in this book are independent which means there isn’t a specific order to follow along and you can pick any project you feel like building at any time We hope you’ll have fun creating the projects in this book and enjoy the learning process xx intRoduction