Introduction: Line Following Car Using Arduino UNO and Infrared Sensors
In this project, I present the development of a line following car using an Arduino UNO and infrared sensors.
The main objective of this project is to design a car capable of following a predefined path marked with a black line on a light surface, automatically correcting its trajectory.
This project is ideal for beginners in robotics and electronics, as it covers basic concepts such as sensors, motor control, and Arduino programming.
Supplies
Electronics
- Arduino UNO
- Motor Shield
- DC Motors with Wheels
- 9V Battery
- Infrared Sensors
- Dupont Cables (Male–Male and Male–Female)
Structure
- 3D Printed Chassis
These components were used to build a functional line following car.
Step 1: PROJECT OBJECTIVE
The objective of this project is to build a car that can follow a predefined path using a black line as guidance, detected by infrared sensors.
Step 2: DESIGN AND WORKING PRINCIPLE
The car uses two infrared sensors placed at the front of the chassis.
When both sensors detect the black line, the car moves forward.
If one sensor stops detecting the line, the car adjusts its direction to correct the trajectory until the line is detected again.
This simple logic allows the car to follow the path accurately.
Step 3: COMPONENT CONNECTIONS
The infrared sensors are connected to the digital inputs of the Arduino.
The motors are controlled using a motor shield, which receives commands from the Arduino to control speed and direction.
Below is the wiring diagram and the physical connections used in the project.
Step 4: CODE
The following Arduino program controls the line following behavior of the car.
The code reads the infrared sensors and adjusts the motors accordingly to keep the car on the black line.
Step 5: TESTING AND RESULTS
Several tests were performed on a track with a black line to verify the correct operation of the car.
The car successfully followed the line and made the necessary corrections without leaving the path.




