Book Image

Raspberry Pi Robotics Projects - Second Edition

By : Dr. Richard Grimmett
Book Image

Raspberry Pi Robotics Projects - Second Edition

By: Dr. Richard Grimmett

Overview of this book

<p>This book starts with the essentials of turning on the basic hardware. It provides the capability to interpret your commands and have your robot initiate actions. In this second edition, you will learn more specifics on how to use the Raspberry Pi’s GPIO pins to communicate with and control a wide range of additional hardware.</p> <p>Teaching you to use the Raspberry Pi from scratch, this book will discuss a wide range of capabilities that can be achieved with it. These capabilities include voice recognition, human-like speech simulation, computer vision, motor control, GPS location, and wireless control. You will then learn how to combine these capabilities to create your own robotics projects. By the end of the book, you will be able to employ the Raspberry Pi to build some intricate and enthralling robotics projects with ease.</p>
Table of Contents (18 chapters)
Raspberry Pi Robotics Projects Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Chapter 7. Avoiding Obstacles Using Sensors

In the previous two chapters, we covered wheeled, tracked, and legged movement. Now your robot can move around. But what if you want the robot to sense the outside world, so it doesn't run into things? In this chapter, you'll discover how to add some sensors to help avoid barriers.

Your robot will take quite a beating if it continually runs into walls, or off the edge of a surface. Let's help your robot avoid these so that it looks intelligent.

In this chapter, you will cover the following:

  • Gathering the hardware

  • Connecting Raspberry Pi to an infrared (IR) sensor to detect the world

  • Connecting Raspberry Pi to a USB sonar sensor to detect the world

  • Using a servo to change the position of your sensor so that a single sensor can view a large field, eliminating the need for additional sensors

To find obstacles, you'll need some sensors. There are two choices and in this chapter I am going to show you how to interface with an infrared sensor and a sonar sensor...