Line- and Wall-Following Robot
A four-wheel robot that follows a line, then solves a maze along the left wall.
- Context
- Exploration Project, D-ITET, ETH Zürich
- Role
- Led a team of 4, involved in all parts
- Built with
- STM32 in C, STM32CubeIDE
- Status
- Completed
How it works
Four wheels on DC motors, left and right pair coupled through motor driver. Steering works through modifying the PWM duty cycle of the respective motors. Analog sensors read line and distance to walls. Values are read through the ADC and processed in a control loop.
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, or a lower speed, which is boring.
So I split it. A conservative PD controller drives the ~90% of the track it can manage, and a state machine handles the tight corners and the lost-line cases for robustness.
Sensing
- Line: An LED shines on the line, two photodiodes pick up reflected light and route through an op-amp into an ADC channel. For robustness, I wrote a calibration routine that offsets the two photodiodes to yield the same reading on pure white.
- Maze: left-wall following with a PD controller on three distance sensors: Front, left and right. State machine handling of right-turns.