Line Follower
Loading simulation…
flagWhat you'll discover
- arrow_forwardExplain how an IR sensor tells dark line from light floor
- arrow_forwardTrace the bang-bang steering rule: left sensor on line means steer left
- arrow_forwardFind the speed limit where the robot starts losing the line
- arrow_forwardDescribe why feedback makes the robot self-correcting
How a robot sees a line
An infrared (IR) sensor shines invisible light at the floor and measures how much bounces back. A white floor reflects lots of light; a black line swallows it. So the sensor outputs a simple message: bright means floor, dark means line.
A line follower carries two of these sensors side by side near its nose, watching the ground like a pair of eyes pointed at the track.
The bang-bang rule
The simplest line-following logic is called bang-bang control, and it fits in three lines: if the left sensor sees the line, steer left. If the right sensor sees it, steer right. If neither sees it, drive straight.
That is the whole program! The robot constantly drifts off the line a little, notices, and corrects — hundreds of times per minute. The wiggling path you see is the algorithm working, not failing.
Feedback: the secret ingredient
This wiggle-and-correct cycle is called feedback: the robot senses its own mistake and uses it to fix itself. Feedback is everywhere in engineering — a thermostat that switches a heater on when a room gets cold, or your own hand adjusting a bicycle handlebar without you even thinking.
Without feedback the robot would be blind: even a perfect launch angle would drift off the track within seconds.
Why speed kills (the run)
Push the speed slider high and watch what happens at a sharp curve: by the time the sensor spots the line, the robot has already shot past it. Sensors and corrections take time, and at high speed the robot travels too far between checks.
Line-follower races, popular at robotics competitions in Kathmandu and around the world, are won by tuning this exact balance: as fast as possible, but never faster than the feedback can react.