🤖
DIY robot concept

How to make a line-following robot

Parts cost
USD 48.00

A fast two-wheel robot with IR reflectance sensors, PID control, 3D printed chassis and swappable battery. The right beginner project when you want to learn real control loops.

Parts

We may earn a commission from purchases through these links, at no extra cost to you.

0 of 6 partsRemaining priced parts: USD 48.00
Line followers look simple, but they are the best cheap way to learn control.

Line followers look simple, but they are the best cheap way to learn control. The difference between a toy and a fast robot is not the chassis; it is sensor spacing, motor response and a PID loop that can recover after overshoot. A good build uses an array of 5-8 reflectance sensors instead of two crude IR modules.

The mechanical design is deliberately boring: two DC gear motors, one caster, battery centered over the axle and sensors mounted as low as possible.

The mechanical design is deliberately boring: two DC gear motors, one caster, battery centered over the axle and sensors mounted as low as possible. Keep the wheelbase short and the center of mass low. If the robot fishtails, reduce wheel diameter or move the battery forward before tuning firmware for hours.

Start with proportional control, add derivative once it can track curves, and add integral only if the robot has a consistent bias.

Start with proportional control, add derivative once it can track curves, and add integral only if the robot has a consistent bias. RoboHub can generate the first firmware scaffold, but you will tune constants on the actual floor because tape color, ambient light and motor mismatch all matter.

Live AliExpress prices for the BOM

Pulling current matching products on AliExpress…

Design variants

Classroom version

Use Arduino Nano, slower motors and AA batteries so every part is easy to replace.

Competition version

Use high-RPM Pololu motors, foam tires and a 16-channel sensor bar.

Maze solver

Add intersection detection and a memory stack to solve black-line mazes.

FAQ

How many sensors do I need?

Five is enough, eight is nicer. Two sensors work only for very slow robots.

Can I use camera vision instead?

Yes, but it turns a control project into a vision project. IR reflectance sensors are the right first build.

What speed should I target?

Start at 0.3 m/s. Once PID is stable, push toward 1 m/s with better tires and tighter loops.

Why does it fail in sunlight?

Cheap IR modules saturate. Use calibrated reflectance arrays and shield the sensor from side light.

Robot build paths

How to make a robot

Related robot guides

Turn this concept into a sourced build

Start with this prompt prefilled, then let RoboHub generate the live parts list, wiring plan, CAD and firmware.

One concept like this every week

If this was useful, the weekly digest sends one new concept page + the latest addon every Monday. No spam, one click to unsubscribe.