Está en la página 1de 3

ARDUINO BASED MAZE SOLVING ROBOT

A maze solving robot is designed to move in a maze and escape through it by


following its walls. A maze solving robot is quite similar to a line follower. Like
a line follower has to follow black strip lines, a maze follower finds a wall and
starts following it until it finds an escape route. But unlike a line follower
which has just to follow a predetermined route, a maze follower is designed to find
an escape route that is not known beforehand. However, both types of robots are
designed to be autonomous, they basically perform different tasks.

The maze solving robot designed in this tutorial is built on Arduino UNO and has
the maze solving algorithm implemented within the Arduino Sketch. The hardware
design of the robot is quite similar that of any other typical line follower robot
except that a line follower may have sensors only in the front side of the robot,
the maze solving robot has sensors at left side, right side and front side of the
robot. The electronic circuitry of the robot consists of the Arduino board, IR
sensor array and L293D motor driver IC coupled with two geared DC motors. The robot
is powered by a 12V battery and is programmed to instantly start finding an escape
route once it is powered by the battery.

HOW THE CIRCUIT WORKS

The maze solving robot detects the walls by using the IR sensor module and moves
the robot close to the wall, until it finds a no wall region. The array of IR
sensors has 2 IR sensors on the left side of the robot, two IR sensors on the right
side of the robot and one IR sensor in the front of the robot. The IR sensors allow
detecting side walls and obstacles in front of the robot.

When the robot finds a no wall space on left side i.e. sensors on left side of the
robot detect a no wall region, it turns left and when the robot finds a no wall
space on right side i.e. sensors on right side of the robot detect a no wall
region, it turns right. It keeps moving along a left side wall or right side wall
until it finds an obstacle in the path or find an escape route. When an obstacle is
detected in front of the robot, it moves away in the opposite direction until it
overcomes the obstacle. As the robot finds a path by detecting absence of a side
wall, it turns in that direction moving forward to solve the maze.

The robot can be moved forward, backward, left or right by implementing the
following input logic at the motor driver pins -

Arduino based Maze Solving RobotThe program code not only allows moving the robot
in the maze, it also tracks and measures the path followed by the robot and has
function to replay the path followed by the robot. Check out the program code to
learn how it implements the maze solving algorithm and traces its path along the
maze.

PROGRAMMING GUIDE

The Arduino sketch begins with the declaration of the constants used for assigning
the Arduino pins interfaced with the IR sensors. It is followed by the declaration
of variables that are used to store digital output of each sensor and variables
representing the motor driver IC connections. Some variables are declared to store
the length of the path followed by the robot.

This is followed by calling a setup() function in which the pins interfaced with
the IR sensors are configured to digital input while pins interfaced with the motor
driver IC are configured to digital output. The default logics are assigned to the
pins in the same function. This function is only called when the robot is first
powered on to solve a maze.

After the setup() function, loop() function is called which iterates infinitely to
solve the maze and record the path of the robot. In the loop() function, first the
sensor values are read by calling readSensors() function and then the digital logic
output from the sensors are used to move the robot either in straight direction or
to follow left hand side wall. For keep moving the robot in straight direction
until it encounters a wall, straight() function is called. The robot starts by
following a left side wall otherwise.

CODE TO SOLVE ARDUINO BASED MAZE SOLVING ROBT

void loop()
{
readSensors();

if(leftFarReading == LOW && rightFarReading == LOW &&


(CenterReading == HIGH || leftNearReading == HIGH) )
{
straight();

}
else
{

leftHandWall();

}
}
The robot keeps moving along the left side wall depending upon the presence or
absence of the wall and calls straight(), turnleft() and turnright() functions
depending upon different situations encountered by the robot. It calls the done()
function once it successfully escapes from the maze.

The turnLeft() function is used to move turn the robot on left side.
void turnLeft()
{
.
.
.
}
The turnRight() function is used to move turn the robot on left side.
void turnRight()
{
.
.
.
}
The straight() function is used to keep moving the robot in straight direction.
void straight()
{
.
.
.
}
The turnAround() function is used to overcome an obstacle in the path of the robot.

void turnAround()
{
.
.
.
}
The shortPath() method is used to trace the path followed by the robot and minimize
the path length where ever possible.
void shortPath()
{
.
.
.
}
The printPath() method prints the path followed by the robot.
void printPath()
{
.
.
.
}
The replay() method is used to replay the path followed by the robot.
void replay()
{
.
.
.
}

También podría gustarte