Chapter 7 - Navigating with Infrared Headlights

The BOE-Bot can already use whiskers to get around, but it only detects obstacles when it bumps into them. Wouldn’t it be convenient if the BOE-Bot could just “see” objects and then decide what to do about them? Well, that’s what it can do with infrared headlights in this chapter. Each headlight is an infrared LED inside a tube that directs the light forward, just like a flashlight. Each eye is an infrared receiver that sends igh/low signals to indicate whether it detects the infrared LED’s light reflected off an object.  You will program the robot and create an IR detection circuit for object detection and avoidance. The result will be autonomous navigation.


By the time you complete this section you will be able to:

  1. Understand what an infrared sensor is and how it is used.
  2. Explain what IR light is and why you can't see it.
  3. Build and Mount IR headlights on Boe-Bot
  4. Build an IR Object Detection Circuit with IR LEDs for the Boe-Bot
  5. Test the IR receivers and understand how the program communicates with the IR circuit.
  6. Test the IR object detector and debug any issues that arise
  7. Program the Boe-Bot to use the IR detection circuit for object detection
  8. Program the Boe-Bot for infrared interference
  9. Modify the Object Detection Circuit to adjust the range detection of the IR sensor
  10. Program the Boe-Bot to use the IR detection circuit for object avoidance
  11. Program the Boe-Bot to stop moving when a drop off is detected – to detect edges of a table


  1. View the videos and items in the Overview section below.
  2. Open the worksheet document and review the questions. 
  3. Read and follow the instructions in Robotics with the Boe-Bot Chapter 7.
  4. Download Chapter 7 Basic Code.
  5. Complete the BOE Shield-Bot activities assigned by your instructor, following the step-by-step tutorials and videos in the Activities section below. If self-study, do all the "Your Turn" parts for each activity in the chapter. (Note: It is only by typing in the commands that you truly begin to understand programming. So don't short change yourself.)
  6. Review the Key Points or FAQs below.
  7. Answer the questions in the worksheet document.
  8. Complete the Programming Exercises at the end of the chapter and fill out the worksheet for them.
  9. Complete the Projects at the end of the chapter and fill out the worksheet for them.
  10. Check your answers. When complete, turn in the Worksheet Doc to your instructor (print, email or other method defined by your instructor). Self-study students can optionally send to a parent, mentor or friend.


Activity / Process

Key Points or FAQs:

How is the Freqout command used?

The Freqout command varies the frequency of an output signal. For example it can be used to make a light brighter or dimmer by varying the light wave frequency, or it can be used to vary a tone on an audio frequency. A FREQOUT signal contains two sine wave components with two different frequencies. One component's frequency is Freq1. The second component's frequency 65536 – Freq1 (or the amount of time).

What does a high signal and a low signal mean from the IR detector?

The high signal means that there are no objects within the range of the IR detector. The lower the number returned in the signal, the closer an object is to the IR detector.

Advanced topic: Learn more about IR Detectors

What is an interference sniffer and why is it needed?

An interference sniffer is a routine that checks to see if a value returned is valid or possibly bad data outside of what is expected. It's needed to make sure the robot doesn't respond to false positives or data that is outside of the expected results. For Example, if IR is detected in an area where the Boe-Bot is not sending IR, then it could lead to false results. By using an interference sniffer, the robot can check to make sure the area in which it will be operating is free of bad data or stray signals.