Midyear Pre

Download as ppsx, pdf, or txt
Download as ppsx, pdf, or txt
You are on page 1of 65

Click to edit Master text styles

Second level
● Third level

● Fourth level

● Fifth level

Qazi Asif Saleh Energy & Environment


33
Maze navigation robot

Fall 2008 & SpRING 2009


Introducing
Team member

Syed fakhar sajjad

Nyma haqqani
Overview of
Project
To design, construct, and build an autonomous
robot that will navigate through a maze
independent of human control. Autonomous
robot capable of finding its way through is
maze and find multiple destinations.
Our Approach
Try to learn the basics of circuits and
programming
Take things one step at a time
Develop a very basic design and then improve
upon it
To implement a top looking design using DC
motors and a wall hugging software code
which will then be expanded into the maze
flooding algorithm.
Possible Problems
May not have enough time
Schedule problems
Slow progression
Learning

Expectations
To successfully create a robot that will find
the center of a maze .
• To gain hands on experience with
implementing theoretical design into a
physically working model.
• To explore different approaches for designing
and logically determining the most efficient
solution.
Goals
To create a basic robot that can run through the
maze
To gain more experience and knowledge in
dealing with circuits and programming
• To be able to make our robot move forward
• To make our robot turn left/right
• To create a program that maps the movement of the robot
• To have a working robot find the center of the maze
Hardware M

overview I
C
R
LEFT O
MOTO
R MOTO C
R O
SENSOR
ELECTRONI SESNS
RIGH DRIVE N CS
ORS
T R T
MOTO R
R O
L
L
E
Basic components of
Robot:
ØSensors

Ø Motors

Ø Microcontroller

Ø Batteries
SENSORS
Click to edit Master text styles
Second level
● Third level

● Fourth level

● Fifth level
SENSOR CIRCUIT
Click to edit Master text styles
Second level
● Third level

● Fourth level

● Fifth level
MOTORS

Click to edit Master text styles


Second level
● Third level

● Fourth level

● Fifth level
H-BRIDGE CIRCUIT
Click to edit Master text styles
Second level
● Third level

● Fourth level

● Fifth level
MICROCONTROLLER

Click to edit Master text styles


Second level
● Third level

● Fourth level

● Fifth level
MICROCONTROLLER
CIRCUIT
Click to edit Master text styles
Second level
● Third level

● Fourth level

● Fifth level
CODE

#include <reg51.h>

sbit L293D_A = P2^4;


sbit L293D_B = P2^3;
sbit L293D_E = P2^2;
sbit L293D_A1 = P2^7;
sbit L293D_B1= P2^6;
sbit L293D_E1 = P2^5;
//inputs
sbit sensorF = P1^0;
sbit sensorB = P1^1;
sbit sensorR = P1^2;
sbit sensorL = P1^3;
// Function Prototypes
void rotate_f(void); //Forward run funtion
void rotate_b(void); //Backward run
function
void breaks(void); //Motor stop function
void delay(void); //Some delay
void left_turn(void);
void right_turn(void);
void delay_turn(void);
void main(){ //Our main
function
sensorF=1;
sensorB=1;
sensorR=1;
sensorL=1;

while(1){ //Infinite loop

if(sensorF==0)// & sensorB==1


& sensorR==1 & sensorL==1)
{
breaks();
delay_turn();
rotate_f(); //Run
forward
delay();
breaks();
}
else if(sensorB==0)
//sensorF==1 & & sensorR==1
& sensorL==1)
{
breaks();
delay_turn();
rotate_b();
delay();
breaks();
}

else if(sensorR==0)
//sensorF==1 & sensorB==1 &
& sensorL==1)
//delay();
//Some delay

{
breaks();
else if(sensorL==0)//(sensorF==1 && sensorB==1
&& sensorR==1 && sensorL==0)
{ breaks();
delay_turn();
left_turn();
delay();
breaks();
//Stop
}

else
breaks();
} //Do this infinitely
}
void left_turn(){
L293D_E = 1; //BOTH MOTORS SHOULD BE
ENABLED
L293D_E1 = 1;
void right_turn(){

L293D_E = 1; //BOTH
MOTORS SHOULD BE
ENABLED
L293D_E1 = 1;
L293D_A = 0;
L293D_B = 1;
L293D_A1 = 1;
L293D_B1 = 0;
}
void rotate_f(){
L293D_A = 1;
//Make positive of motor 1
L293D_B = 0;
//Make negative of motor 0
L293D_E = 1;
//Enable L293D
L293D_A1 = 1;
//Make positive of motor 1
void rotate_b()
{
L293D_A = 0; //Make positive of
motor 0
L293D_B = 1; //Make negative of
motor 1
L293D_E = 1; //Enable L293D
L293D_A1 = 0; //Make positive of
motor 0
L293D_B1 = 1; //Make negative of
motor 1
L293D_E1 = 1; //Enable L293D
}
void breaks()
{
L293D_A = 0; //Make positive of
void delay(){ //Some delay...
unsigned char i,j,k;
for(i=0;i<0x05;i++)
for(j=0;j<255;j++)
for(k=0;k<255;k++);
}
void delay_turn(){
unsigned char i,j,k;
for(i=0;i<0x01;i++)
for(j=0;j<255;j++)
for(k=0;k<255;k++);
}
SIMULATION OF
SOFTWARE
Software
overview
Search Algorithm
ØSimple Depth-First Search
ØRobot scans each cell for walls and constructs

a DFS tree rooted at the START cell


ØAs the DFS tree is constructed, it indicates

which cells have been explored and provides


paths for backtracking
ØThe DFS halts when the GOAL cell is found
Example 3x3 maze

GOAL
ØWe start out at (0,0) –
the “southwest” corner
of the maze
ØLocation of goal is

unknown
Check for a wall – the
Ø

way forward is blocked


So we turn right
Check for a wall – no
wall in front of us
So we go forward; the
red arrow indicates
that (0,0) is (1,0)’s
predecessor.
Turn right
We sense a wall here
too, so we’re gonna
have to look north.
Turn left…
Turn left again; now
we’re facing north
The way forward is
clear…
We sense a wall – can’t
go forward…
…so we’ll turn right.
This way is clear…
…so we go forward.
Blocked.
How about this way?
Clear!
We already know that
the wall on the right is
blocked, so we try
turning left instead.
Whoops, wall here.
Wall here too!
Now there are no
unexplored
neighboring squares
that we can get to.
So, we backtrack!
(Retrace the red
arrow)
We turn to face the red
arrow…
…and go forward.
Now we’ve
backtracked to a
square that might
have an unexplored
neighbor. Let’s check!
Ah-ha!
Onward!
Drat!
There’s gotta be a way
out of here…
Not this way!
Two 90-degree turns to
face west…
Two 90-degree turns to
face west…
No wall here!
So we move forward
and…
What luck! Here’s the
goal.
Final step: Execute
victory dance.
Potential Problems
Our group researched problems that previous groups
have had to avoid making mistakes. The major
problems we found were:
•Overheating

•One motor can be faster than the other

•Debugging programs

•Body of robot may not be aligned properly

•Placement of batteries on robot

•Sensors may misread and malfunction


Questions!

?????
Thank you

You might also like