Coding a Line Follower Robot for Maze using LSRB Algorithm and finding its Shortest Path

Md Mobshshir Nayeem
5 min readJul 6, 2019

--

Maze Solving Youtube Video

Line Follower Robot (Maze Solving Robot)

An MSR (maze solving robot) is a clever little gadget with a silicon brain that finds its way through an arbitrary maze. It competes against other members of its species, racing as fast as it can. Here MSR is an electro-mechanical device, typically consisting of three main subsystems. They are drive system, an array of sensors, and the control system.

The drive system consists of a mechanical chassis, a set of motors, gears and wheels. The chassis is usually designed to operate like a wheel-chair, with two large drive wheels on either side of a lightweight aluminium frame. The chassis is built to house the motors, gear system, batteries, and circuitry, and must also be small enough to manoeuvre within the constraints of the maze.

The control system is a series of circuit boards functioning as the brain of the critter. The control system runs a maze solving algorithm (LSRB) based on the information received by the CPU (ARDUINO BOARD) from the sensors.

The final sub-system is the sensors. They report to the CPU the current state of the surroundings where the walls and paths are. These are usually either infrared sensor which picks up light reflected light of the track. The main objective is to achieve the fastest maze running time and easily find the goal.

Line Follower

Maze

A maze is a tour puzzle in the form of a complex branching passage through which the solver must find a route. In everyday speech, both maze and labyrinth denote a complex and confusing series of pathways, but technically the maze is distinguished from the labyrinth, as the labyrinth has a single through-route with twists and turns but without branches, and is not designed to be as difficult to navigate.

Sample Maze

LSRB Algorithm

This LSRB algorithm can be simplified into these simple conditions:

  1. If you can turn left then go ahead and turn left,
  2. else if you can continue driving straight then drive straight,
  3. else if you can turn right then turn right.
  4. If you are at a dead end then turn around.

    The expunction of LSRB is shown below:
  5. L- Left
  6. R- Right
  7. S- Straight
  8. B- Turning around (Back).

The robot has to make these decisions when at an intersection. An intersection is any point on the maze where you have the opportunity to turn. If the robot comes across an opportunity to turn and does not turn then this is considered going straight. Each move was taken at an intersection or when turning around has to be stored.

At first, we see the searching process of the LSRB Algorithms. the diagrams are the sample of the processing the LSRB.

Path = L

The first diagram denotes the starting point and the first decision based on the LSRB priority so the robot is choosing the left side. Second decision Value has been stored in the register. The first decision diagram is shown,

Path = LB

In the second diagrams is denoted the after processing of the first decision and the next decision is taken to the back side because there are no more options are available. The second decision diagram is shown,

Path = LBL

In the Third diagrams is denoted the after processing of the second decision and the next decision is taken to the left side because there are no more options are available and the second decision Value has been stored in the register. The third decision diagram is shown,

Path = LBLL

In the Fourth diagrams is denoted the after processing of the third decision and the next decision is taken to the left side because there are no more options are available and the fourth decision Value has been stored in the register. The fourth decision diagram is shown,

Path = LBLLB

In the fifth diagrams is denoted the after processing of the fourth decision and the next decision is taken to the back side because there are no more options are available and the fifth decision Value has been stored in the register. The fifth decision diagram is shown,

Path = LBLLBS

In the sixth diagrams is denoted the after processing of the fifth decision and the next decision is taken to the straight side because there are no more options are available and the sixth decision Value has been stored in the register. The sixth decision diagram is shown,

In the seventh diagrams is denoted the after processing of the sixth decision and the next decision is taken to the right side because there are no more options are available and the seventh decision Value has been stored in the register. The seventh decision diagram is shown below, After the seventh step the searching processes will be finished and then finally the “LBLLBSR” value is stored into the register.

The second process is the travelling processes. This process is performing the robot to go the destination without any searching and using the shortest path.

The travelling is simplifying the register value using the following equation and shorted and follow the value of the register the equations are shown below,

LBR = B

LBS = R

RBL = B

SBL = R

SBS = B

LBL = S

The register value is shorted from using the equations and the final register value is “SRR”.diagram is shown below

Path = S SR SRS

Coding

Variable Initialisation

loop() Function

This functions runs over and over, and check accordingly.

Read Sensor Value

Left Hand Wall Algorithm(LSRB Algorithm)

Shortest Path

The above code snippets, does not contains snippets for turnLeft(), turnRight(), turnAround() and done(). There are many delay’s used they are not standards, they need to be modified according to bot.

Clapping shows how much you appreciated my story.

Show your support

--

--

Responses (2)