← All articles

19 October 2026

The invisible light that lets robots follow lines

How an IR sensor helps robots follow lines

In modern warehouses, small robots glide along black lines painted on the floor, carrying goods everywhere without ever getting lost. No cameras, no GPS — their secret is a fingertip-sized component: the infrared sensor. And the line-following robot is one of the first projects kids build when they start learning robotics.

Eyes that see with invisible light

Every infrared sensor has two tiny "eyes" side by side:

The whole principle fits in one sentence: white surfaces reflect infrared back, black surfaces absorb it. The sensor just tells the Arduino: "what I'm looking at is white" or "it's black".

Try this with your kid tonight: power up the sensor and point your phone camera at it. Your naked eye sees nothing, but on the phone screen the infrared LED glows brightly. Kids usually gasp at that moment — the first time they "see" a kind of light that has always surrounded them, invisible to human eyes. (It's also how you check whether a TV remote still has battery.)

How does a line-following robot "think"?

A typical line follower uses two sensors mounted side by side at the front. Its entire "intelligence" is just four cases, repeated hundreds of times per second:

Nothing mysterious: the robot doesn't "see" the whole road. It keeps asking itself "am I still on the line?" and corrects its steering. Exactly how we drive at night following lane markings — eyes on the line, hands on the wheel, repeat endlessly.

This is a child's first lesson in the control loop: sense → decide → act → sense again. Every autonomous machine — from warehouse carts to self-driving cars — runs a loop like this one, just more complex.

When the sensor suddenly goes "blind"

Once you understand the principle, you also understand why the robot sometimes goes haywire — and every "blind" moment is a free physics lesson:

4 tips for first-try success

1. Test by hand before letting it run. Lift the robot so the sensors hover over the track: over white, the wheels should spin forward; slide onto the black line and the matching side's wheel should reverse. If the hand test passes, there's a 90% chance it runs on the ground. This is also how real engineers work: break it down, test each part.

2. Start with a straight line. Don't draw a maze yet. One meter of straight track for the first run — early success feeds motivation, early failure kills it.

3. Avoid sharp turns. A fast robot hitting a tight corner flies off the line before the sensors can react. The gentler the curve, the better it behaves.

4. Film the first successful run. Watching their own robot follow the line correctly — the look on a kid's face at that moment is worth more than any A+.

From sensor to real robot

In ManuStem's ESP32 kits, the robot car carries three infrared line-tracking sensors — enough to follow complex tracks and detect junctions. The sensor is the "eyes", the code is the "brain", and kids learn to connect the two. That is robotics.

ManuStem offers 28 lessons (8 Component Lab + 20 Competition Robot), 4 free trial lessons, for ages 8+. Kids learn entirely in the browser — AI Circuit wires alongside them, Gen AI writes code with them, and the Agent coach debugs step by step when the robot misbehaves — no kit purchase needed, in Vietnamese and English.

Let your kid build their first line-following robot at stem.manusignal.com — free, 15 minutes, right in the browser.

Read the Vietnamese version:

Cảm biến hồng ngoại: 'đôi mắt' giúp robot chạy theo đường kẻ