Build pathIntermediateA weekend

Build a Line Maze Solver Robot With LSRB Route Memory

A robot that explores a taped line maze on its own, remembers every junction it met, and then runs the shortest route from start to finish without one wrong turn.

Build a Line Maze Solver Robot With LSRB Route Memory technical schematicJUNCTIONS → L S R B → ROUTEBB

A line follower follows. A line maze solver decides. That is the whole jump this project makes, and it is a bigger one than it looks: the robot stops being a control loop with wheels and becomes something that explores an environment it has never seen, remembers what it found, and acts on that memory.

The trick is that none of it replaces the line follower—it sits on top of one. Underneath, the same reflectance array and the same PID loop keep the robot centred on the tape, knowing nothing about mazes. Above it, a thin decision layer watches for the moments when the line branches, classifies what kind of junction it hit, picks a direction, and writes down one character. That separation is what makes the project tractable, and it is the same two-layer split real robots use everywhere.

So the build order matters more than usual. You get plain line following genuinely stable first—tuned in the simulator, then on a large oval of real tape—and only then add junctions. Skip that discipline and every mechanical problem, every calibration drift, every wheel that is 2 mm out of alignment will show up disguised as a maze-solving bug.

Follow the tech tree below top to bottom. Each node opens once its prerequisites are done, and your progress is saved on this device, so you can build the robot over a weekend without losing your place.

Project roadmap

The build path

Follow the tech tree from parts to a robot that follows a taped line. Each node unlocks when its prerequisites are done, and your progress saves on this device.

0 / 21 done

100%
Build

Wire the robot

45 min

Build

Calibrate on your own track

20 min

Build

Get plain line following stable

60 min

Build

Run the exploration pass

45 min

Build

Replay the simplified route

30 min

Goal

Line maze solver complete

You built it

Components

Tutorials in this path

Practise before you wire

Tune it in the live simulator

The build path routes through a browser lab. Find gains that follow the track cleanly here, then transfer them to the real robot.

Frequently asked questions

How do you make a maze solving robot with Arduino?

Start with a working line follower: a reflectance array, a PID loop, and a motor driver. Then add a decision layer on top that notices junctions, picks a branch by the left-hand rule, and records each turn as one of four characters—L, S, R or B. When the robot reaches the finish, substitution rules collapse every dead-end detour out of that string, and the second run follows the simplified route. This build path walks the whole chain, and you tune the following layer in a browser simulator first.

What is the LSRB algorithm in a line follower?

LSRB stands for Left, Straight, Right, Back—the four things a robot can do at a junction. The robot records one character per junction during exploration, and every B marks a dead end it had to reverse out of. Six substitution rules replace each three-character window centred on a B with the single turn that would have had the same effect, which removes the detour entirely. Repeat until no B remains and you have the shortest route.

What is the difference between a line maze and a walled maze?

A line maze is black tape on a light board, sensed with a downward-facing reflectance array; a walled maze—the Micromouse format—has physical walls sensed with distance sensors. The sensing is completely different, but the layer above it is the same: explore to build knowledge, then run the best route. A line maze is far cheaper to build, which is why school and college competitions usually use one.

Do I need to buy parts before starting this project?

No. The line-following layer, its PID gains, and the explore-then-optimise behaviour all run in the browser simulators, so you can understand the whole robot before spending anything. Only the last four steps—wiring, calibration, the exploration pass, and the replay—need the physical Arduino, sensor array, driver, motors, chassis, and battery.

Why does my maze robot turn at the wrong junctions?

Almost always because it decides too early. The instantaneous sensor pattern cannot tell a T junction from a crossroads—both read as black right across the array. The robot has to record which branches appeared, drive forward about one robot length, and read again to find out whether the line also continued straight. Deciding on the first reading is the single most common cause of confident wrong turns.

Does LSRB work on any maze?

Only on a perfect maze—one with no loops, where exactly one path connects any two points. Taped line mazes almost always are. If the maze contains a cycle, the left-hand rule can circle forever and there is no dead end for the rules to collapse; at that point you need a real map and a graph search such as flood fill instead.