Why the raspberry pi The Raspberry Pi is a 35 credit card size computer that was created to provide people with an inexpensive introduction to programming programming and electronics Despite its small size and low cost each Pi is a fully functional computer that can do pretty much everything you would expect from running programs to word processing and web browsing Raspberry Pi is a great platform to learn robotics with It’s cheap small easily powered and incredibly accessible You can program a Pi in almost any language you can imagine and embed it into all sorts of electronics projects A Pi hits just the right sweet spot between power and simplicity meaning you can create robots without limitations Since it was launched out of Cambridge UK in 2012 the Raspberry Pi has gained a massive worldwide following and community community Millions of people share their progress projects and ideas online which makes it easy for beginners to improve and learn from someone who knows more There are also many in-person events where you can chat and show off your achievements These are usually lovingly called Raspberry Jams and they take place around the globe What is in this Book This book is project-based and revolves around a two-wheeled robot that I’ll show you how to make from scratch You’ll improve this robot project by project adding components and coding new functionality At each stage of the book I’ll provide comprehensive instructions and explanations of each build and the program behind it You can also download the full code and resources for free from https nostarch com raspirobots Any updates or further notes from the book can also be found there Take a look at what’s in store for you in each chapter Chapter 1 Getting Up and Running takes you on a tour of the Raspberry Pi and its features I also show you how to install the operating system and set it up for use over your local network using SSH In this chapter you’ll meet the terminal and write your first Python program
Chapter 2 Electronics Basics introduces electricity what it is and how we can harness it You’ll find two beginner projects in this chapter that are great for starting off your adventures before you start making robots By the end you’ll be able to make circuits that blink an LED and respond to a button Chapter 3 Building Your Robot begins your robotic journey Here you’ll start to build your robot We’ll build the base with motors and wheels and you’ll find lots of guidance about the different parts of your robot and how to wire it up Chapter 4 Making Your Robot Move gives your fully constructed constructed robot the power of movement with complete remote control using a Nintendo Wiimote You’ll use Python code to make your robot move first in a simple pattern and then by just tilting and orienting a Nintendo Wiimote Mario Kart style Chapter 5 Avoiding Obstacles gives you your first taste of robotic autonomy In this project you’ll use an ultrasonic distance sensor to give your robot the ability to sense and avoid obstacles in its way You’ll never crash again Chapter 6 Customizing with Lights and Sound allows you to customize your robot with super-bright lights and speakers You’ll be able to program your own dazzling light shows and connect a 3 5 mm speaker to your Raspberry Pi so that your robot can emit noises like a car horn Chapter 7 Line Following shows you how to use sensors and code to make your robot follow a black line It will be racing around a track all by itself in no time at all Chapter 8 Computer Vision Follow a Colored Ball is the most advanced project of this book and introduces image processing one of the most high-tech areas of computer science In this chapter chapter your robot will use the official Raspberry Pi Camera Module and computer vision algorithms to recognize and follow a colored ball no matter where it is in your robot’s environment
Who is this Book For Learn Robotics with Raspberry Pi is a book for anybody who is interested interested in robots programming and electronics No assumptions are made about ability and I steer well clear of confusing unexplained jargon throughout People of all ages and backgrounds can learn something from the easy-to-follow projects and guidance Where should y ou Buy p arts Over the course of this book and the projects it contains you’ll need various bits and pieces electronic components making materials and a few more tools Don’t worry though everything is affordable and widely available There will be specific advice in each chapter but in general everything you need can be picked up online on sites such as eBay and Amazon All of the electronic components in the book can be purchased from online shops like eBay https www ebay com or dedicated online electronics stores such as Adafruit https www adafruit com Pimoroni https shop pimoroni com The Pi Hut https thepihut com CPC Farnell http cpc farnell com and RS Components http uk rs-online com web This list is by no means exhaustive and you may find cheaper closer online retailers in your own country You might even be fortunate enough to have a local electronics hardware hardware store where you can grab your stuff I’ll introduce and explain the exact parts you’ll need in each pro ject but here’s a full list of everything you’ll use in the book Chapter 1 Raspberry Pi 3 Model B HDMI cable USB keyboard mouse 5 V micro USB power adapter 8GB microSD card 400-point breadboard Chapter 2 An LED with appropriate resistor M-F F-F M-M jumper wires Momentary push button
Two brushed 5 V to 9 V motors with tires Chapter 3 A chassis for your robot I make mine out of LEGO Six AA battery holder Six AA batteries I recommend rechargeable LM2596 buck converter module L293D motor driver chip Chapter 4 Nintendo Wii remote For earlier models Bluetooth dongle for Pis prior to Model 3 Zero W Chapter 5 HC-SR04 ultrasonic distance sensor A 1 kΩ resistor and a 2 kΩ resistor Chapter 6 NeoPixel stick with headers A small 3 5 mm speaker Chapter 7 Two TCRT5000-based infrared line-following sensor modules Chapter 8 An Official Raspberry Pi Camera Module A colored ball You’ll also find these tools materials handy along the way Variety of screwdrivers Hot-glue gun Multimeter Soldering iron Wire stripper Sticky tack Velcro 3M Dual Lock let’s Get started In short robots and Raspberry Pi are awesome Now that that’s out of the way and we’re acquainted it’s time to get going Just turn the page to begin your robotic adventures