Midyear Pre

download Midyear Pre

of 65

Transcript of Midyear Pre

  • 8/8/2019 Midyear Pre

    1/65

  • 8/8/2019 Midyear Pre

    2/65

    Qazi Asif Saleh Energy & Environment

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    3/65

    33

  • 8/8/2019 Midyear Pre

    4/65

    Maze navigation robot

    Fall 2008 & SpRING 2009

  • 8/8/2019 Midyear Pre

    5/65

    IntroducingTeam member

    Syed fakhar sajjad

    Nyma haqqani

  • 8/8/2019 Midyear Pre

    6/65

  • 8/8/2019 Midyear Pre

    7/65

    Our ApproachTry to learn the basics of circuits andprogramming

    Take things one step at a time

    Develop a very basic design and then improveupon it

    To implement a top looking design using DC

    motors and a wall hugging software codewhich will then be expanded into the mazeflooding algorithm.

  • 8/8/2019 Midyear Pre

    8/65

    Possible Problems

    May not have enough time

    Schedule problems

    Slow progression

  • 8/8/2019 Midyear Pre

    9/65

    Learning

    Expectations To successfully create a robot that will findthe center of a maze .

    To gain hands on experience withimplementing theoretical design into aphysically working model.

    To explore different approaches for designing

    and logically determining the most efficient

    solution.

  • 8/8/2019 Midyear Pre

    10/65

    GoalsTo create a basic robot that can run through themaze

    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

  • 8/8/2019 Midyear Pre

    11/65

    MICR

    O

    CON

    TROLLE

    SESNSORS

    SENSORELECTRONI

    CS

    MOTOR

    DRIVE

    R

    LEFTMOTO

    R

    RIGHT

    MOTOR

    Hardwareoverview

  • 8/8/2019 Midyear Pre

    12/65

    Basic components ofRobot:Sensors

    Motors

    Microcontroller

    Batteries

  • 8/8/2019 Midyear Pre

    13/65

    SENSORS

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    14/65

    SENSOR CIRCUIT

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    15/65

    MOTORS

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    16/65

    H-BRIDGE CIRCUIT

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    17/65

    MICROCONTROLLER

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    18/65

    MICROCONTROLLERCIRCUIT

    Click to edit Master text stylesSecond level

    Third level Fourth level

    Fifth level

  • 8/8/2019 Midyear Pre

    19/65

    CODE

    #include

    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;

  • 8/8/2019 Midyear Pre

    20/65

    //inputssbit sensorF = P1^0;

    sbit sensorB = P1^1;sbit sensorR = P1^2;sbit sensorL = P1^3;// Function Prototypes

    void rotate_f(void); //Forward run funtionvoid rotate_b(void); //Backward runfunctionvoid breaks(void); //Motor stop function

    void delay(void); //Some delayvoid left_turn(void);void right_turn(void);void delay_turn(void);

  • 8/8/2019 Midyear Pre

    21/65

    void main(){ //Our mainfunction

    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(); //Runforward

    delay();breaks();

    }

  • 8/8/2019 Midyear Pre

    22/65

    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();

  • 8/8/2019 Midyear Pre

    23/65

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

    { breaks();delay_turn();left_turn();delay();breaks();

    //Stop}

    elsebreaks();

    } //Do this infinitely}void left_turn(){L293D_E = 1; //BOTH MOTORS SHOULD BE

    ENABLEDL293D_E1 = 1;

    id i ht t (){

  • 8/8/2019 Midyear Pre

    24/65

    void right_turn(){

    L293D_E = 1; //BOTHMOTORS SHOULD BE

    ENABLEDL293D_E1 = 1;L293D_A = 0;L293D_B = 1;L293D_A1 = 1;

    L293D_B1 = 0;}void rotate_f(){

    L293D_A = 1;

    //Make positive of motor 1L293D_B = 0;//Make negative of motor 0

    L293D_E = 1;//Enable L293D

    L293D_A1 = 1;//Make ositive of motor 1

  • 8/8/2019 Midyear Pre

    25/65

    void rotate_b(){

    L293D_A = 0; //Make positive ofmotor 0

    L293D_B = 1; //Make negative of

    motor 1L293D_E = 1; //Enable L293DL293D_A1 = 0; //Make positive of

    motor 0L293D_B1 = 1; //Make negative of

    motor 1L293D_E1 = 1; //Enable L293D

    }void breaks(){

    L293D_A = 0; //Make positive of

  • 8/8/2019 Midyear Pre

    26/65

    void delay(){ //Some delay...unsigned char i,j,k;

    for(i=0;i

  • 8/8/2019 Midyear Pre

    27/65

    SIMULATION OFSOFTWARE

  • 8/8/2019 Midyear Pre

    28/65

    SoftwareoverviewSearch AlgorithmSimple Depth-First SearchRobot scans each cell for walls and constructsa DFS tree rooted at the START cellAs the DFS tree is constructed, it indicateswhich cells have been explored and provides

    paths for backtrackingThe DFS halts when the GOAL cell is found

  • 8/8/2019 Midyear Pre

    29/65

    Example 3x3 maze

    GOAL

  • 8/8/2019 Midyear Pre

    30/65

    We start out at (0,0) the southwest corner

    of the mazeLocation of goal isunknown

  • 8/8/2019 Midyear Pre

    31/65

    Check for a wall theway forward is blocked

  • 8/8/2019 Midyear Pre

    32/65

    So we turn right

  • 8/8/2019 Midyear Pre

    33/65

    Check for a wall nowall in front of us

  • 8/8/2019 Midyear Pre

    34/65

    So we go forward; thered arrow indicatesthat (0,0) is (1,0)spredecessor.

  • 8/8/2019 Midyear Pre

    35/65

    Turn right

  • 8/8/2019 Midyear Pre

    36/65

    We sense a wall heretoo, so were gonnahave to look north.

  • 8/8/2019 Midyear Pre

    37/65

    Turn left

  • 8/8/2019 Midyear Pre

    38/65

  • 8/8/2019 Midyear Pre

    39/65

    The way forward isclear

  • 8/8/2019 Midyear Pre

    40/65

    We sense a wall cantgo forward

  • 8/8/2019 Midyear Pre

    41/65

    so well turn right.

  • 8/8/2019 Midyear Pre

    42/65

    This way is clear

  • 8/8/2019 Midyear Pre

    43/65

    so we go forward.

  • 8/8/2019 Midyear Pre

    44/65

  • 8/8/2019 Midyear Pre

    45/65

    How about this way?

  • 8/8/2019 Midyear Pre

    46/65

    Clear!

  • 8/8/2019 Midyear Pre

    47/65

  • 8/8/2019 Midyear Pre

    48/65

    We already know thatthe wall on the right isblocked, so we tryturning left instead.

  • 8/8/2019 Midyear Pre

    49/65

    Whoops, wall here.

  • 8/8/2019 Midyear Pre

    50/65

    Wall here too!

    Now there are nounexplored

    neighboring squaresthat we can get to.

    So, we backtrack!(Retrace the red

    arrow)

  • 8/8/2019 Midyear Pre

    51/65

    We turn to face the redarrow

  • 8/8/2019 Midyear Pre

    52/65

    and go forward.

    Now wevebacktracked to a

    square that mighthave an unexploredneighbor. Lets check!

  • 8/8/2019 Midyear Pre

    53/65

    Ah-ha!

  • 8/8/2019 Midyear Pre

    54/65

    Onward!

  • 8/8/2019 Midyear Pre

    55/65

    Drat!

  • 8/8/2019 Midyear Pre

    56/65

    Theres gotta be a wayout of here

  • 8/8/2019 Midyear Pre

    57/65

    Not this way!

  • 8/8/2019 Midyear Pre

    58/65

    Two 90-degree turns toface west

  • 8/8/2019 Midyear Pre

    59/65

  • 8/8/2019 Midyear Pre

    60/65

    No wall here!

  • 8/8/2019 Midyear Pre

    61/65

  • 8/8/2019 Midyear Pre

    62/65

    What luck! Heres thegoal.

    Final step: Execute

    victory dance.

  • 8/8/2019 Midyear Pre

    63/65

  • 8/8/2019 Midyear Pre

    64/65

    Questions!

    ?????

  • 8/8/2019 Midyear Pre

    65/65

    Thank you