Maze Navigation Robot
A two-wheeled robot that uses ultrasonic range sensors and wall-following logic to traverse an unmapped maze.
Overview
Built as the final project for Cornerstone of Engineering I. The robot is given no map of the maze. Three HC-SR04 ultrasonic sensors — front, left, and right — are read once per loop, and steering is computed from those distances rather than from any stored route.
Steering is a proportional controller with two modes. With walls on both sides, the error term is the difference between the left and right readings, so the robot drives down the centre of the corridor. With a wall on only one side, it holds a 9 cm standoff from that wall instead. When the front sensor drops below 11 cm, the robot stops, compares the left and right readings, and makes a timed in-place turn toward whichever side is more open. If no wall is within 30 cm on any side, it treats that as the maze exit and stops.
The turns are open-loop and timed rather than encoder-counted, so the durations were calibrated by hand — 450 ms for a right turn and 417 ms for a left. The two drive motors also do not run at quite the same rate, so each has a fixed scaling offset applied to its PWM duty to keep the robot tracking straight.
Design notes
- Raspberry Pi Pico running MicroPython, on a breadboard
- Three HC-SR04 ultrasonic sensors covering front, left, and right
- L298N driver and two 200 RPM TT motors in differential drive, with a ping pong ball as the rear caster
- Proportional steering: centre between two walls, or hold a 9 cm standoff from one
- Timed open-loop 90° turns, calibrated per direction
- Per-motor PWM scaling offsets to correct for drivetrain mismatch
- Echo pulses time out at 30 ms; an out-of-range reading is treated as open space
- I2C 16×2 LCD reports turn direction and live sensor distances
- 9V battery pack with a 5V buck converter