Obstacle avoidance and line following robot
I built a two-wheel robot that I could drive with a gamepad or leave to steer around obstacles and follow a line.


Try it
Choose Start robot, then Auto, and watch the two distance readings as the robot chooses which way to turn.

Model built from my photos. No hardware is connected.
- Role
- High school projectMechanicalElectricalSoftware
- Timeline
- High school, semester 2
- Tools
- Arduino IDE, ESP32-S3, ESP-NOW, Logitech F310
- Drive and sensors
- Two gearmotors, two VL53L0X distance sensors, QRE1113 reflectance sensors and a front ultrasonic module (unused by the receiver code)
- Status
- I ran gamepad driving, obstacle avoidance and line following on the physical robot.
How it's built
I designed the chassis, cast the tyres and built the wireless controls.
I built a differential-drive robot that I could steer with a gamepad and then switch to obstacle avoidance. The chassis carries the line sensors underneath and distance sensors facing out toward obstacles.
Chassis and cast tyres
Power and sensors
A 2S LiPo powers the TB6612FNG motor driver. An LM2596S buck converter supplies 5 V to the ESP32-S3 Nano.
Driving and obstacle avoidance
In manual mode, the transmitter sends my gamepad inputs over ESP-NOW. The robot converts them to a speed for each wheel and stops the motors if no radio packet arrives for 300 ms. In obstacle avoidance mode, it slows down, backs up and turns toward the side with more clearance.
Testing
The receiver scans the I2C bus before and after sensor setup. Its serial log prints the mode, drive and turn commands and both distance readings.
Links
Source codeCode on GitHub
Interactive demoTry the demo



