2025
Line-Following Robot
Autonomous Pico robot with PID motor control, IMU heading hold and barcode waypoints
- Closed-loop motors
- PID
- Heading keeping
- IMU
- Telemetry
- MQTT
- C
- Raspberry Pi Pico
- PID control
- IMU
- MQTT
- CMake
Summary
An autonomous line-following robot on the Raspberry Pi Pico, written in C to the Barr embedded coding standard. It follows a line with IR sensors, holds its heading with an IMU, reads barcodes as waypoints, avoids obstacles with an ultrasonic sensor, and streams telemetry over MQTT.
Problem
A robot that only reacts to a line sensor drifts, overshoots turns and stops at the first obstacle. Reliable navigation needs closed-loop control and several sensors working together.
Approach
Closed-loop PID speed control from wheel encoders, IMU-based heading keeping, and a state machine that switches between line following, barcode handling and obstacle avoidance. WiFi and an MQTT client provide remote monitoring and control.