The problem
Autonomous navigation starts with two primitive skills: staying on a path and not hitting things. A robot that cannot follow a marked route is useless in a warehouse; one that cannot stop for an obstacle is dangerous anywhere. Students meet these as separate builds — a line follower here, an obstacle avoider there — and never face what happens when the two behaviors conflict. A line running straight into a box forces the issue: the robot must suspend path-following, maneuver around the obstruction, and re-acquire the line on the far side, all without human help. That arbitration — deciding moment to moment which behavior owns the motors — is the real lesson, and it generalizes beyond the track: every autonomous vehicle is a stack of competing behaviors under a priority scheme. A small chassis, an IR array, an ultrasonic sensor and a motor driver are enough hardware to teach it.
5-channel IR array reading the contrast between the black line and the floor.
Follow the working sequence
How it works
- The IR sensor array continuously reads the contrast between the black line and the white floor; the Arduino computes a steering correction proportional to how far off-center the line is.
- The L298N driver converts that correction into differential wheel speeds — slowing one side to steer — so the robot tracks the line smoothly.
- Meanwhile the HC-SR04 pings for obstacles ahead. If something comes within the stop distance, line-following is suspended.
- The robot backs up slightly, scans left and right with the ultrasonic sensor, and turns toward the clearer side.
- Once the path is clear, it re-acquires the line and resumes tracking — the whole switch happens in a fraction of a second.
Project features
Dual-mode autonomy: IR line tracking with automatic ultrasonic obstacle-avoidance override
5-channel IR sensor array for stable line detection with minimal wobble on curves
HC-SR04 ultrasonic ranging (2 cm – 400 cm) for obstacle detection and sidestepping
L298N dual H-bridge motor driver with PWM speed control for smooth turns
Behavior arbitration logic — obstacle avoidance takes priority, line following resumes automatically
Adjustable IR threshold (onboard potentiometer) and code-level calibration constants
Battery-powered with onboard power switch — fully untethered track demos
Compact 2WD chassis with high-grip wheels for reliable traction on chart-paper tracks
Arduino firmware with tunable parameters (speed, turn gain, stop distance)
What is included
Assembled robot
Complete Arduino firmware (well-commented, tunable parameters)
Circuit diagram and wiring schematic
IR calibration and track-setup guide
Project report PDF (synopsis, design, algorithm, results, conclusion)
PPT presentation for final review
Viva Q&A preparation document
FAQs
- How does the robot decide between following the line and avoiding the obstacle? Through behavior arbitration: the ultrasonic check runs every control cycle, and if an obstacle is closer than the stop distance, avoidance preempts line-following. Once clear, line tracking resumes automatically. It is a simple priority scheme.
- What is the L298N and why is it used here? The L298N is a dual H-bridge motor driver that lets the Arduino control two DC motors' direction and speed. Direction comes from logic-level inputs; speed comes from PWM on the enable pins. It handles up to 2 A per channel, plenty for small gear motors.
- How do I calibrate the IR sensors? Each sensor module has a threshold potentiometer, and the firmware has calibration constants. The included guide walks through setting the threshold so the array cleanly distinguishes the black line from the white floor under your room's lighting.
- Can the ultrasonic sensor really measure distance accurately? Yes — the HC-SR04 sends a 40 kHz pulse and times the echo; distance = (echo time × speed of sound) / 2. The firmware filters readings to reject noise, giving stable ±3 mm measurements for avoidance decisions.
- Is this a reasonable first robotics project? Yes — it is the standard first build because it combines sensors, control logic and motor driving in one package with a lively track demo: line following plus dodging obstacles.
- Can it be extended later? Common extensions are Bluetooth/manual override mode, PID-tuned steering, maze-solving logic, or a servo-mounted scanning ultrasonic head. The firmware structure makes these additions straightforward.
Advantages
- Dual-mode autonomy on a single Arduino: IR line tracking with automatic ultrasonic obstacle-avoidance override — avoidance preempts line-following, then tracking resumes automatically once the path clears.
- 5-channel IR sensor array gives stable line detection with minimal wobble on curves.
- HC-SR04 ultrasonic ranging (2 cm – 400 cm) for obstacle detection and sidestepping.
- L298N dual H-bridge motor driver with PWM speed control for smooth turns, on a compact 2WD chassis with high-grip wheels for chart-paper tracks.
- Tunable in two places: adjustable IR threshold (onboard potentiometer) plus code-level calibration constants and firmware parameters (speed, turn gain, stop distance); battery-powered with an onboard switch for fully untethered demos.
Disadvantages
- Designed for indoor tracks with good lighting contrast; strong direct sunlight can saturate the IR sensors and needs re-calibration.
- The ultrasonic sensor detects solid obstacles reliably but can miss very thin or sound-absorbing objects.
- Line width and surface contrast affect tracking quality — the calibration guide covers tuning for your track.
- This is a ground-line tracker, not a maze solver; complex junctions need firmware customization.
Limitations & prerequisites
Designed for indoor tracks with good lighting contrast; strong direct sunlight can saturate IR sensors and needs re-calibration.
The ultrasonic sensor detects solid obstacles reliably but can miss very thin or sound-absorbing objects.
Line width and surface contrast affect tracking quality — the calibration guide covers tuning for your track.
This is a ground-line tracker, not a maze solver; complex junctions need firmware customization.
Components & software requirements
Arduino UNO R3 microcontroller
2WD robot chassis kit (base plate, motors, wheels, caster)
5-channel IR line-tracking sensor array (TCRT5000)
HC-SR04 ultrasonic distance sensor
L298N dual H-bridge motor driver
2x 18650 Li-ion cells with battery holder
Onboard 5 V regulation and power wiring
Fasteners, standoffs, cable ties
| Parameter | Value |
|---|---|
| Microcontroller | Arduino UNO R3 (ATmega328P, 16 MHz) |
| IR sensors | 5-channel TCRT5000 array, analog/digital output, threshold trim pot |
| Ultrasonic range | HC-SR04, 2 cm – 400 cm, ~3 mm resolution |
| Motor driver | L298N dual H-bridge, up to 2 A per channel, PWM speed control |
| Drive motors | 2× DC gear motors (approx. 150–200 RPM at rated voltage) |
| Control loop | Line PID-style steering + priority-based obstacle override |
| Stop distance | Configurable (default ~15 cm), set in firmware |
| Power | 7.4 V Li-ion (2S) / 9 V battery pack; 5 V logic rail |
| Track compatibility | Black line (15–25 mm wide) on white chart paper / flex |
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.