David Lammering personal site

Line-Following and Maze Robot

A four-wheel robot that follows a line as fast as I could make it go, then solves a maze along the left wall.

Black line on white board, tight corners between the straights.
Context
Exploration Project, D-ITET, ETH Zürich
Team size
3, this page covers only my parts
Built with
STM32 in C, STM32CubeIDE
Status
Completed

Four wheels, left and right pair coupled, so it steers on the PWM duty cycle of each side. Goal: maximum speed without losing the line.

Key decision: a calm controller plus a state machine

One controller for the whole track meant choosing between two bad options — a high proportional gain that gets round the corners but oscillates everywhere else, or a lower speed, which defeats the point.

So I split it. A conservative PD controller drives the ~90% of the track where stability matters, and a state machine takes the tight corners and the lost-line cases — doing the high gain's job without its oscillation.

A full run. Straights are the PD controller, tight corners the state machine.

Sensing

  • Line: a photodiode and op-amp into an ADC channel. A fixed threshold drifted — LED intensity falls with the battery, and the photodiodes were not mounted rigidly — so I wrote a calibration routine that measures the thresholds instead of assuming them.
  • Maze: left-wall following with a PD controller on three distance sensors, front, left and right. Distance sensors, not LiDAR.
The maze run

A rigid sensor mount would have removed the need for the calibration routine instead of compensating for it.

The build

The underside of the robot chassis: an STM32 Nucleo board and a red motor driver board wired together with jumper leads above the wheels and motors.
The chassis, with the Nucleo board and the motor driver wired to it.
Close-up of the STM32 Nucleo development board with jumper wires running from its pin headers.
The STM32 Nucleo board.
Close-up of the red motor driver board with blue screw terminals and the motor leads attached.
The motor driver. Each side gets its own duty cycle.
The robot held in two hands, with a yellow printed shell over the electronics and three distance sensors mounted at the front and sides.
Shell on. The three black sensors are the distance sensors.
Overhead, tracking the line.
Four people standing behind the line-following track at the end of the project, one of them holding the robot.
At the end of the project.