Book Image

Getting Started with Raspberry Pi Zero

By : Richard Grimmett
Book Image

Getting Started with Raspberry Pi Zero

By: Richard Grimmett

Overview of this book

Raspberry Pi Zero is half the size of Raspberry Pi A, only with twice the utility. At just three centimeters wide, it packs in every utility required for full-fledged computing tasks. This practical tutorial will help you quickly get up and running with Raspberry Pi Zero to control hardware and software and write simple programs and games. You will learn to build creative programs and exciting games with little or no programming experience. We cover all the features of Raspberry Pi Zero as you discover how to configure software and hardware, and control external devices. You will find out how to navigate your way in Raspbian, write simple Python scripts, and create simple DIY programs.
Table of Contents (16 chapters)
Getting Started with Raspberry Pi Zero
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Preface

For many years, robots and other advanced electronic wonders could only be seen on the television, movies, or in university or military labs. In recent years, however, the availability of new and inexpensive hardware and also free and open source software, has provided the opportunity for almost anyone with a little technical knowledge and imagination to build these technical wonders. The first wave of projects were fueled by Arduino, an inexpensive and simple-to-program microcontroller. The next wave was carried further by the introduction of the Raspberry Pi, an even more capable processor powered by the Linux operating system.

Now there is an even less expensive, powerful microprocessor: the Raspberry Pi Zero. This little processor packs a processor powerful enough to run Linux into a small and even less expensive package. This capability, coupled with some additional power, inexpensive hardware, and free open source software provides a platform for projects that range from simple wheeled robots to advanced flying machines.

What this book covers

Chapter 1, Setting Started with Raspberry Pi Zero, is designed to go through the details of setting up a useful development environment on Raspberry Pi Zero. The chapter begins with a discussion of how to connect power and continues through setting up a full system, configured and ready to be connected to any of the amazing devices and SW capabilities to develop advanced robotics applications.

Chapter 2, Programming Raspberry Pi Zero, reviews, for those who are already familiar, basic Linux, editing, and programming techniques that will be useful through the rest of the book. You'll learn how to interact from the command line, how to create and edit a file using an editor, and basic Python programming.

Chapter 3, Accessing the GPIO Pins on Raspberry Pi Zero, discusses the GPIO capabilities of Raspberry Pi Zero by building and controlling some simple LED circuits.

Chapter 4, Building and Controlling a Simple Wheeled Robot, discusses one of the amazing things you can do with Raspberry Pi Zero, controlling a simple wheeled robot. This chapter will show you how to add motor control, so you can build your very own autonomous mobile robot.

Chapter 5, Building a Robot That Can Walk, tells us about another impressive robotic project, an autonomous robot that can walk. This is done using servos whose position can be controlled using Raspberry Pi and some additional USB-controlled hardware.

Chapter 6, Adding Voice Recognition and Speech – A Voice Activated Robot, tells us about a voice-activated robot. One of the significant new features of today's computer system is the ability to input commands and provide output without a screen or keyboard. A few years ago, the concept of a computer that can talk and listen was science fiction, but today it is becoming a standard part of new cell phones. This chapter introduces how Raspberry Pi Zero can both listen to speech and also respond in kind. This is not as easy as it sounds (pun intended) and you'll be exposed to some basic functionality, while also understanding some of the key limitations. You'll take a standard toy and turn it into a responsive robot.

Chapter 7, Adding Raspberry Pi Zero to an RC Vehicle, tells us about another astounding capability of Raspberry Pi Zero, the ability to add "sight" to you projects. Raspberry Pi Zero makes this very easy by supporting open source software and readily available USB webcams. By adding this and a remote control, you can build a remote control vehicle that can go around corners, into rooms, wherever you'd like to go.

Chapter 8, Playing Rock, Paper, or Scissors with Raspberry Pi Zero, tells us about how we can use our toolkit to build and control a robotic hand that can see and respond to the world around it. In this case, you'll program your hand to play rock, paper, and scissors.

Chapter 9, Adding Raspberry Pi Zero to a Quadcopter, talks about the fact that building a robot that can walk, talk, or play air hockey is cool, but one that can fly is the ultimate goal.

What you need for this book

You need a Raspberry Pi Zero. You can refer to the software list along with the code bundle of the book.

Who this book is for

This book is designed for the beginner. It requires little more than a vivid imagination and a desire to learn the basics of programming and hardware configuration.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "To install Nmap, type sudo apt-get install nmap. To run Nmap, type sudo nmap -sp 10.25.155.1/154."

A block of code is set as follows:

a = input("Input value: ")
b = input("Input second value: ")
c = a + b
print c

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

a = input("Input value: ")
b = input("Input second value: ")
c = a + b
print c

Any command-line input or output is written as follows:

cd /home/pi/Desktop

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking on the Scan selector scans for all the devices connected to the network."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.

  2. Hover the mouse pointer on the SUPPORT tab at the top.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box.

  5. Select the book for which you're looking to download the code files.

  6. Choose from the drop-down menu where you purchased this book from.

  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows

  • Zipeg/iZip/UnRarX for Mac

  • 7-Zip/PeaZip for Linux

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/GettingStartedwithRaspberryPiZero_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.