Robot Passport · Controls
Line-following robot
Learn feedback control by tuning a robot that follows a track.
A two-wheel robot that reads a line with reflectance sensors and uses proportional and PID control to stay on it.
What you will learn
- Reflectance sensing
- Proportional control
- PID tuning
- Calibrating sensors
Parts
| Component | Qty | Purpose |
|---|---|---|
| Small chassis with two geared motors and a caster | 1 | Light, low platform that turns tightly. |
| Reflectance sensor array (3–8 channels) | 1 | Detects the dark line against a light floor. |
| Dual motor driver | 1 | Independent speed control of each wheel. |
| Microcontroller board | 1 | Reads sensors and runs the control loop. |
| Battery pack and switch | 1 | Power for motors and controller. |
| Black electrical tape and white board or paper | 1 | Builds the test track. |
Generic parts are listed on purpose: choose locally available equivalents that meet the same ratings.
Build steps
- Mount the sensor array 3–8 mm above the floor, centred between the wheels and ahead of the axle.
- Calibrate: sweep the robot across the line and store the minimum and maximum reading of each sensor.
- Compute a line position (e.g. a weighted average) where 0 means centred.
- Start with proportional control only: steering = Kp × position. Increase Kp until the robot follows gentle curves.
- Add derivative (Kd) to reduce wobble, then a small integral (Ki) only if the robot drifts on long curves.
Test protocol
Goal: Find the fastest speed at which the robot completes the track without losing the line.
Setup: Build a closed loop of about 3 m with two gentle curves and one 90° turn using 19 mm tape.
- Record Kp, Ki, Kd and base speed for every run.
- Run three laps at each speed setting, increasing speed in small steps.
- Count line losses and measure lap time.
Record for every run:
- Base speed
- Kp / Ki / Kd
- Lap time (s)
- Line losses per lap
- Lighting conditions
Measured results for this reference design will be published here with their test conditions. Submitting your own results opens with member accounts.
Safety
- Disconnect power before adjusting sensor height.
- Test on the floor or a table with edges guarded.
Take it further
- Add a junction detector and solve a simple maze.
- Store tuning values so they survive a reset.
- Compare P-only and PID lap times in a chart.
Stuck on this build?
Ask the AmpleRobots team. Build threads in RoboForum, linked to each Passport, open with member accounts.
Ask a question →