Autonomous Line Following Robot
Autonomous Line Following Robot
As part of our Integrated Engineering design project, I co-developed a fully autonomous line following robot capable of navigating increasingly complex tracks using sensor based control and real time feedback.
Electronics and Hardware
Built from the ground up, the robot featured a custom sensor mount and chassis, and an ESP32 based control circuit. We used QRD1114 reflective sensors for analog line detection, PWM motor control, and a servo mounted ultrasonic sensor for basic obstacle detection.
Testing
Throughout the project, we iteratively refined the hardware and software to improve reliability, response time, and turning accuracy.
The final robot successfully completed three instructor designed tracks, each with increasing difficulty and unique challenges.
Track 1
Featured wide curves and moderate line thickness, allowing us to fine tune basic steering logic and PID style behaviours.
Track 2
Introduced tighter turns, sensor ambiguity, and branches that tested our robot’s decision making and real time realignment logic.
Track 3
Was the most challenging, including sharp right angles, line gaps, and deceptive geometry requiring predictive behaviour and autonomous recovery from line loss.
Our robot successfully navigated all three tracks by implementing a fail-safe logic system, dynamic turning strategies, and sensor calibration techniques.
We achieved a high level of reliability under varying light and surface conditions, and our robot was able to recover from brief sensor loss scenarios without manual correction.
Signal Handling & Noise Reduction
Working with analog sensors like the QRD1114 presented several noise related challenges, especially due to inconsistent surface reflectivity, voltage drift from battery wear, and ambient light fluctuations.
Resistor Voltage Divider
We placed a 10k Ohms resistor between the QRD1114 phototransistor output and ground to act as a voltage divider.
This allowed us to convert light intensity into a measurable voltage drop, which we read via the ESP32’s analog pins.
Sensor Calibration
At the start of every session, we manually observed the sensor outputs over white and black surfaces and recalibrated the threshold value in code.
We implemented this as a configurable variable (blackThreshold) so that it could be tuned without modifying logic.
Software Filtering
We added averaging logic across several quick successive analog reads to smooth out spikes.
We also implemented a dead band zone to ignore ambiguous readings caused by jitter near the threshold.
Real-time LED feedback was added onto each sensor to visually monitor signal stability during operation.
Debouncing & Fail-Safe Timing
In moments where all three sensors read white (like a gap in the line), the robot will wait a short duration before declaring a line loss.
This debouncing period avoided unnecessary rerouting due to brief signal dropouts.
Sensor Shielding
We manually blocked ambient light by taping the tops and sides of the sensor bracket with black electrical tape, reducing interference from overhead lighting or sunlight.
Logic
The robot’s code uses real time sensor readings to decide how the motors should move based on the position of the line or nearby obstacles.
It checks the sensors constantly and uses if-else logic to turn, go forward, or recover if the line is lost.