Adding distance sensors
If your robot is to appear intelligent, gathering information about the world around it will be crucial. So, let's add some sensors that can provide you information about the distance and location of barriers.
There are basically two kinds of distance sensors, IR and sonar sensors. Both send out a signal and then measure a response to calculate the distance of the object from themselves. You can use either sensor, so you'll learn how to add both to your project. Let's cover sonar sensors first.
Sonar sensors
A sonar sensor uses ultrasonic sound to calculate the distance of an object. The sound wave travels out from the sensor, as illustrated here:
The device sends out a sound wave 10 times a second. If an object is in the path ...
Get BeagleBone: Creative Projects for Hobbyists now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.