Line-following robot that moves boxes
An ESP32 robot that follows black lines, avoids obstacles and moves boxes with an electromagnet. It delivered every box at the final demonstration. I was the team manager of a team of five and designed the PCB, selected the motors and designed the motor mounts.
- Goal
- Move four coloured boxes to their destinations on a field, using black lines on the ground as paths. Each box within 90 seconds.
- My role
- Team manager. PCB design, motor selection, motor mounts and parts of the red and white exterior.
- Team
- 5 students
- Hardware
- ESP32, 5-channel ITR20001/T line sensor, VL53L0X time-of-flight sensor, MPU-6050 IMU, two DFRobot FIT0450 geared motors with encoders, electromagnet, USB power bank
- Tools
- EasyEDA, MicroPython
- Course
- Robotics, Year 2, Semester 4, Hanze University of Applied Sciences
- Duration
- April – July 2026
- Result
- The robot delivered every box at the final demonstration.
- Grades
- 9.2 for product realisation (group grade), 9.1 for specialisation (individual grade), 10 for professional skills, presentation and writing (individual grade). All out of 10.
Problem
The Robotics course in the second semester of Year 2 is based on a simplified version of the RobotAtFactory Lite competition. The robot has to move four coloured boxes to their destinations on a field, following black lines on the ground. The field can have broken lines and obstacles. The main requirements:
- deliver each box in 90 seconds or less,
- fit inside a 25 × 25 × 30 cm cube,
- stop within 200 ms when the run/stop switch is pressed,
- detect obstacles within 10 cm in front of the robot,
- use a PCB designed by the team, a PID controller and a state machine, on an ESP32 programmed in MicroPython,
- cost no more than €100.
Design
The robot runs a state machine: detect a path, follow it to a box, pick up the box with an electromagnet, find the path to the destination, follow it and drop the box. When it detects an obstacle it looks for a different path. A second switch puts the robot in a shutdown state from any state.
- Line following: a 5-channel ITR20001/T infrared sensor and a PD controller.
- Position: encoders on both motors, combined with the gyroscope of an MPU-6050 for the heading.
- Obstacles: a VL53L0X time-of-flight sensor.
- Power: a USB power bank with a USB-PD trigger module, giving 5 V.
- Safety: an emergency stop button and a relay that cut the power to the motors.
I designed the PCB in EasyEDA. It is a single-layer board. It connects the ESP32 to the motor driver, the motor encoders, the sensors, the electromagnet, three status LEDs and the emergency stop relay.
I selected the motors. From an estimated mass of 614 g I calculated a required torque of 0.18 kgf·cm per motor and a minimum speed of 0.058 m/s. We chose two DFRobot FIT0450 motors with a 120:1 gearbox and encoders, rated at 0.2 kgf·cm.
Build
I designed the motor mounts and parts of the red and white exterior. The body is 3D-printed in PETG on a 5 mm acrylic base. We etched the PCB at Hanze and soldered it, then made a second version that worked with all the components.
Design history file
We documented the project in a design history file (DHF) of 65 documents, in four groups:
- SPEC: what the robot must do (requirements and specifications),
- QUAL: why (customer requirements, standards such as ISO 13850 for emergency stops, component research),
- PROC: how (assembly, calibration and test procedures),
- VAL: proof (test results).
I wrote the documents on motor and wheel selection, motor integration, motor and mount assembly, and the drive system and physical integrity tests.
Team role
I was the team manager. I planned the project, divided the tasks between the five team members and had the deciding vote when the team could not agree.
Test
- Physical integrity (my test): with a 150 g load, the largest displacement of any mount was 0.21 mm, within the 1.0 mm limit.
- Drive system: under a 400 g side load the motor mounts moved at most 0.06 mm, and the wheels did not slip on the shafts.
- 5 V supply: 5.05 V with a 10 Ω load, within the 4.75–5.25 V limit.
- Odometry: distance error 2.6% over 1.5 m and 14.4% over 0.25 m.
During testing a motor mount broke at its top mounting hole, and we made its walls thicker. We moved the line sensor in front of the front axle, and compensated in software for a speed difference between the two motors.
At the final demonstration the robot delivered every box.
Video
Images