Robotics and Embedded Systems

Lesson 20: Capstone: An Autonomous Rover, End to EndNew-age

This is the capstone: you will design, build, test and present an autonomous rover that navigates a course on its own — following a line, avoiding obstacles, and stopping safely at the end. It uses everything in this course: electronics and microcontrollers, sensors and motors, control loops and non-blocking code, wireless logging and responsible design. The lesson is not a set of instructions to follow step by step; it is a brief, a plan and a checklist, because a capstone is something you design, not something you copy.

Work in a team if you can, and keep a logbook. The logbook is part of the assessment: it shows your decisions, your tests, your failures and your fixes. A rover that works is good; a rover that works, with a logbook that shows how it came to work, is a finished project.

Key Terms.
  • Capstone — a final project that brings together everything learned in a course.
  • Specification — a written description of what the rover must do.
  • Test plan — a list of tests, with what each one checks and what counts as passing.
  • Logbook — a dated record of decisions, tests, results and fixes.
  • Integration — combining separate parts — sensors, motors, code — into one working system.
  • Regression — a test that checks something that used to work still works after a change.
  • Demo — a public showing of the finished rover, including explaining how it works.
  • Iteration — a cycle of building, testing, learning and improving.

The brief and the specification

The brief: build a rover that follows a black line around a course, avoids a box placed on the line, and stops at a finish marker. The course is a loop of black tape on a white floor, about 3 metres long, with one box as an obstacle and a cross mark as the finish. The rover must complete the course without human help, without leaving the line except to avoid the obstacle, and without hitting anything.

Write a specification before you build: the rover’s size and weight, its sensors (two reflectance sensors, one ultrasonic sensor on a servo, one bumper), its motors (two DC motors with an H-bridge), its power (one battery pack for motors, one for logic), and its behaviour (line following with proportional control, obstacle avoidance with a sweep, stop at the finish). The specification is a contract with yourself: it says what “done” means, and it stops the project growing forever.

Building in stages

Build in the order the course taught: chassis and motors first, then sensors, then the line follower, then the avoider, then the combination. Test each stage before adding the next, and keep the earlier tests as regression tests — run them again after every change, so a fix for the avoider does not silently break the line follower. Integration is where most capstone projects fail, and the defence is staging: never add two new things at once.

The combination is a state machine: FOLLOWING, AVOIDING, FINISHED. In FOLLOWING, the rover follows the line; when the ultrasonic sensor sees the box, it moves to AVOIDING, sweeps, turns around the box, and returns to the line; when it sees the finish marker — a cross of tape, detected when both reflectance sensors see black at once — it moves to FINISHED and stops. Draw the state machine before you code it.

Testing: the test plan

Write a test plan with a test for each requirement: the rover follows a straight line; it follows a curve; it stops for the box; it goes around the box; it returns to the line; it stops at the finish; it stops if the battery is low; it stops if it loses its wireless link. For each test, write what counts as passing — “stops within 10 cm of the box” — and record the result. A test without a pass mark is a demonstration, not a test.

Presenting and the logbook

Present the rover as you would a product: show it running the course, explain the design decisions, and show the logbook. The logbook should record the specification, the state machine, the test plan and its results, and the three hardest problems you met and how you solved them. The problems are the most interesting part of the presentation: they show the engineering, not just the result.

Worked example — the state machine

The rover’s behaviour is three states. In FOLLOWING, it runs the proportional line follower from Lesson 16 and checks the ultrasonic sensor each loop; if the distance is under 20 cm, it moves to AVOIDING. In AVOIDING, it stops, sweeps the sensor left and right, turns towards the clearer side, drives forward for one second, and returns to FOLLOWING. In FINISHED, it stops and prints “DONE”. The finish is detected when both reflectance sensors read black at once — the cross mark — for more than 200 ms, so a brief crossing of the line does not trigger it.

Common mistakes

  • Building everything at once and testing once at the end. Integration failures are then impossible to untangle.
  • Skipping the specification, so “done” is never defined and the project never finishes.
  • Testing only in one room, then failing in the hall where the demonstration is held.
  • Writing no logbook, so the decisions, tests and fixes are lost and cannot be explained.

Discussion questions

  1. Your rover works, but it is slow. Is speed the right thing to improve, or would reliability matter more in the demonstration?
  2. A team member wants to add a camera to the rover a week before the demo. What are the arguments for and against?
  3. The rover fails during the demonstration. What should you do in the moment — and what should the logbook say afterwards?

Practice questions

  1. Why write a specification before building? Answer: Because it defines what “done” means and stops the project growing forever. It is a contract with yourself. Explanation: Define done first.
  2. What is a regression test, and why does a capstone need them? Answer: A test that checks something that used to work still works after a change. Without them, a fix for one part can silently break another. Explanation: Old tests guard new changes.
  3. Why should the finish be detected only after 200 ms of both sensors seeing black? Answer: So a brief crossing of the line does not trigger it. The delay filters out a momentary reading. Explanation: Time filters noise.
  4. Your rover works in the classroom but fails in the hall. What is the most likely cause? Answer: Calibration: the light is different, so the reflectance thresholds set in the classroom are wrong in the hall. Calibrate where you run. Explanation: Calibrate in the real place.
  5. What should a logbook contain, and why does it matter? Answer: The specification, the design, the test plan and results, and the hardest problems and their fixes. It shows the engineering, not just the result. Explanation: The logbook is the evidence of the work.

🎬 Watch & Learn

One free video that works through this topic step by step:

✅ Check your understanding

Quick recall check, generated from this lesson’s key terms. It is practice only and is not graded.

Keep reading to complete this lesson