Infrared (IR) Sensor
Follow the black line on the floor
There are two parts. First drive the robot yourself for 25 seconds and watch what its three IR sensors show. Then give the wheel to the robot: you choose in code what it does when each sensor sees the line, and the robot drives alone with those rules.
IR (infrared) sensors shine light onto the floor and measure how much bounces back. A white floor reflects a lot of light, a black line absorbs it. That’s how the robot can “see” the line on the floor. Automatic factory robots (AGVs), warehouse carriers and racing line-follower robots work this way.
Warehouse robots follow lines and codes on the floor while carrying thousands of orders.
If the left sensor sees the line and the right one doesn’t, the line is to the robot’s left. Real line-follower robots work with rules this simple.