Arduino

Line-Following Robot

A classic first robot: two IR sensors, an Arduino and a motor driver that follow a black line on its own.

Beginner 3 hours 6 parts

The line-following robot is the best first project in robotics because every part of a real robot is in it: sensing, deciding and acting. Two infrared sensors look at the floor, the Arduino compares what they see, and the motor driver turns the wheels to keep the robot centred on a dark line.

Start by wiring the sensors to two digital pins and the motor driver to four more, then test each motor on its own before connecting everything. Once the robot drives straight, add the steering rule: if the left sensor sees the line, turn left; if the right one does, turn right.

When it works, try tuning the speed and adding a third sensor for sharper corners. That small change is your first taste of control tuning.

← Back to All Projects

Got a Robot Idea or Question?

Tell us what you're building — we'd love to hear about it.

Get in Touch →