Lesson 06 · 60 minutes
Too Much, Too Little, Just Right
Tuning the line follower
Today's goal
Change the line follower's correction strength while it runs, find the wobble point and the drift point, and settle on a value between them.
Ideas in this lesson
- The line follower measures how far off the line it is (in mm)
- It corrects in proportion: twice as far off, twice as much correction
- Too strong: it wobbles. Too weak: it drifts off curves
- Tuning is a search, not a guess
Sense → Think → Do
SENSE: the line sensors measure the offset. THINK: multiply the offset by the gain. DO: slide and turn toward the line. Change the gain and the whole personality changes.
How the session runs
- Tape a loop with gentle curves and one tight curve.
- Sensors tab: check the line sensor is set up. Press Watch (lw) and slide tape under each channel: its raw number should jump by 100 or more.
- Put the line under the middle of the sensor and press Calibrate (lc). The robot strafes across the line and back.
- Press Follow (lf). It runs until you press STOP.
- While it follows, drag the Slide correction slider up a lot. Watch it wobble. Drag it down a lot. Watch it drift off the tight curve.
- Do the same with Turn correction. Which one helps on the tight curve?
- Find the lowest setting that still takes the tight curve. Then the highest that does not wobble. Pick the middle. Save to robot.
Try this
- Speed it up (speed slider). Do the best gains change?
- Make the curve tighter. What fails first?
- Turn slide correction to zero: now it steers like a normal car. Better or worse?
When it goes wrong
| What you see | What it means |
|---|---|
| 'never saw the line' | The sensors never saw the tape. Press Watch: no change under tape means the emitters are off or the channel is not wired where the robot thinks. |
| Numbers go the wrong way over tape | Flip 'Over the tape the reading goes' in the Sensors tab. |
| 'lost the line, stopped' | It went off the line for longer than the lost-stop time. Slow down or raise the turn correction. |
| Stops at a wall | The laser's wall stop (120 mm) works during line following too. Move the wall. |
Notes for the grown-up
Settings change live, so the robot never has to stop for a re-flash. Let each group own one slider and report what it does. The point is the shape of the search: too much, too little, bracket it.
Ages: K-5: one slider, three settings (low, middle, high), describe the wiggle. 6-12: record offset telemetry (the L line in the console) and graph it for two gains.
Materials: Robot with line sensor array (8-channel, through the ADS1115s or direct), black electrical tape, light floor or poster board, app (Sensors tab).