Skip to content
RoboLearn
Not completed

IR line sensors

SensorsBeginner25 minFollow a line in the simulator ↓Before this: What is a sensor?

What you’ll learn

  • How an infrared (IR) line sensor sees a line
  • How to set one up and test it
  • How two sensors steer a line-following robot

How it works

A line sensor (such as the common TCRT5000 module) has an IR LED and an IR receiver side by side, pointing at the floor.

  • White or light floor: reflects lots of IR back.
  • Black line: absorbs IR, so little comes back.

The module turns this into a signal. Most have an analog output (AO), a digital output (DO) and a small screw (potentiometer) that sets the digital threshold.

Setting up

  • Mount it 2–10 mm above the floor (check the module’s datasheet; the TCRT5000 works best close).
  • Turn the threshold screw until the on-board LED changes exactly at the line’s edge.
  • Use a matte black line (electrical tape) on a light surface.

Two sensors steer

Place two sensors either side of the line:

Left sensor Right sensor Meaning Do
white white Line between the sensors Go straight
black white Line drifting left Turn left
white black Line drifting right Turn right
black black Junction or end Stop or decide

Finished this lesson?