← Projects

(08)

Mobile Robot

Programming an autonomous differential-drive robot to follow a curved path and avoid moving obstacles using infrared and ultrasonic sensors.

Overview

I worked with a team to develop an Arduino-based mobile robot capable of autonomously navigating an obstacle course. The robot needed to follow a curved line while detecting and avoiding a series of moving walls.

We developed a sensor-driven control algorithm that continuously translated infrared and ultrasonic sensor measurements into independent motor commands for the robot's differential-drive system.

Sensor Integration

The robot used three infrared sensors for line detection and an ultrasonic sensor for obstacle detection. We characterized the infrared sensor response and established thresholds for reliably determining when each sensor was positioned over the line.

The ultrasonic sensor provided a separate obstacle-detection input. When an obstacle was detected within a specified distance, the controller stopped both motors to prevent the robot from colliding with the moving wall.

Control Algorithm

The control algorithm adjusted the speed of the left and right motors based on the combination of infrared sensor readings. When the center sensor detected the line, both motors operated at approximately the same speed. When the robot began to deviate from the path, the controller adjusted the relative motor speeds to steer it back toward the line.

The algorithm also tracked which side of the robot had most recently detected the line. This allowed the robot to determine the appropriate direction of correction even when all three sensors temporarily lost the line.

We tuned the magnitude of the motor-speed difference based on the robot's position relative to the line. Small deviations produced gradual corrections, while larger deviations triggered more aggressive turns. This helped balance rapid recovery with smooth path following.

Mobile robot navigating an obstacle course with sliding walls
Fig. 1Robot navigating obstacle course

Testing & Iteration

We tested the robot repeatedly on the course to tune sensor thresholds and motor speeds. Testing allowed us to identify how different motor-speed combinations affected turning behavior and line tracking performance.

We iteratively adjusted the control logic to improve recovery when the robot deviated from the line while maintaining sufficient speed to complete the course efficiently.

Results

The final robot successfully followed the course, avoided all moving obstacles, and completed the challenge in 26 seconds, outperforming 75% of competing robots.

This project gave me hands-on experience developing sensor-driven control logic and integrating sensors, motors, and embedded software into a physical robotic system. It also introduced me to the kinematics and control behavior of differential-drive robots.

tools

Arduino Sensor Integration Motor Control Differential Drive