Chapter 4. Avoiding Obstacles Using Sensors
You've constructed your biped robot. Now, your robot can move around. But what if you want the robot to sense the outside world, so you don't run into things? In this chapter, you'll discover how to add some sensors to help avoid barriers.
Specifically, you'll learn:
- How to connect Raspberry Pi to an IR (infrared) sensor
- How to connect Raspberry Pi to a USB sonar sensor to detect the world
- How to connect Raspberry Pi and its GPIO to a sonar sensor to detect the world
Connecting Raspberry Pi to an infrared sensor
Your robot can now move around, but you'll want to be able to sense a barrier or a target. One of the ways to do this is with an IR sensor. First, a tutorial on IR sensors is required. An IR sensor has both a transmitter and a sensor. The transmitter sends out a narrow beam of light, and the sensor receives this beam of light.
The difference in transit ends up as an angle measurement in the sensor, as shown...