Chapter 8. Robot Control with Distance Detection

In Chapter 7, we used the infrared LEDs and receivers to detect whether an object is in the BOE Shield-Bot’s way without actually touching it.  Wouldn’t it be nice to also get some distance information from the IR sensors?  There is a way to accomplish some rough, close-range detection with the very same IR circuit from the previous chapter. It’s just enough information to allow the BOE Shield-Bot to follow a moving object without colliding into it.    

Determining Distance with the IR LED/Receiver Circuit

This chapter uses the same IR LED/receiver circuits from the previous chapter.

You will also need:

(1) ruler
(1) sheet of paper

  • If the circuit from the last chapter is still built on your BOE Shield-Bot, make sure your IR LEDs are using the 2 kΩ resistors.
  • If you already disassembled the circuit from the previous chapter, repeat the steps in Chapter 7, Activity #1.  Also, make sure to use TestBothIrAndIndicators to verify that the system is working properly.
  • Download Chapter 8 Arduino Code