Email     Password         
Views

Obstacle Avoider

From RoBo-Wiki

Jump to: navigation, search

Contents

Obstacle Avoider


Project Developed by:-

APOORVE RASTOGI(E&C, 1st YEAR MANIPAL INSTITUTE OF TECHNOLOGY)
ABHIJEET KHANNA(E&C, 1st YEAR MANIPAL INSTITUTE OF TECHNOLOGY)

Description:-

The obstacle avoider here has been developed using three TSOP sensors. The TSOP module used has a 555 timer functioning at a frequency of 38 KHz which acts as a transmitter. The IR sensor re3cieves this signal and gives us a digital input.If it detects an obstacle the sensor gives an input 1 else the input is zero.This input has been used to control the bot by taking up various conditions involving the 3 TSOP sensors. The sensors can be calibrated using the variable resistance which acts as a potential divider. Calibrating the TSOP also helps us to determine the distance at which the sensor detects the obstacle. This can be quite a tedious task as the TSOP will detect the obstacles only for some particular calibration. Please be patient while calibrating. The TSOP sensors have been placed in front of the chassis for identifying obstacles infront, to the left and to the right of the bot. The various conditions for controlling the bot have been clearly shown in the code.The TSOPS detect the obstacle, give in the input and the bot moves and turns based on the various given conditions. In this video the two sensors, left and right, have been differently calibratred(distance at which the sensor detects the obstacle) to show how the calibration distance(d) can affect the motion of the bot.

Components Used:-

8051 development board, 3 TSOP Sensors, connecting wires, Mini Robo Chassis,2 DC motors, Motor Driver IC-L293D


Pics:-

Obstacle
Obstacle

Applications:-

Video:-

Code:-

CODE FOR OBSTACLE AVOIDER

#include<reg52.h>
sbit led1=P1^6;                                                     //defining the pins for 3 led's,3 TSOP sensors,2 100 rpm DC motors
sbit led2=P3^0;
sbit led3=P3^1;
sbit sensor1=P0^4;
sbit sensor2=P0^5;
sbit sensor3=P0^6;
sbit m1=P2^0;
sbit m2=P2^1;
sbit m3=P2^2;
sbit m4=P2^3;

FUNCTIONS FOR DIFFERENT MOVEMENT OF THE BOT DEFINED BY THE USER

FUNCTION FOR BOT MOVES FORWARD

void straight()                                                             
{
m1=1;
m2=0;
m3=1;
m4=0;
}

FUNCTION FOR BOT TAKES A POINT RIGHT TURN

void leftturn()                                                    
{
m1=0;
m2=1;
m3=1;
m4=0;
}

FUNCTION FOR BOT TAKES A POINT RIGHT TURN

void rightturn()                                                  
{
m1=1;
m2=0
m3=0;
m4=1;
}

FUNCTION FOR BOT MOVES IN REVERSE DIRRECTION

void reverse()                                                      
{
m1=0;
m2=1;
m3=0;
m4=1;
}

FUNCTION FOR BOT STOPS

void stop()                                                        
{
m1=1;
m2=1;
m3=1;
m4=1;
}

MAIN FUNCTION

int main()                                                           
{
led1=0; 
led2=0;                                                              //INITIALIZATION
led3=0;
m1=0;
m2=0;
m3=0;
m4=0;
while(1)
{              
if((sensor1==0)&&(sensor2==0)&&(sensor3==0))                          //DIFFERENT CASES CONSIDERING THE OUTPUT OF TSOP-IR SENSOR     
{
led1=0;
led2=0;
led3=0;
straight();
}
else if((sensor1==0)&&(sensor2==1)&&(sensor3==0))
{
led1=0;
led2=1;
led3=0;
straight();
}
else if((sensor1==0)&&(sensor2==0)&&(sensor3==1))
{
led1=0;
led2=0;
led3=1;
straight();
}
else if((sensor1==0)&&(sensor2==1)&&(sensor3==1))
{
led1=0;
led2=1;
led3=1;
straight();
}
else if((sensor1==1)&&(sensor2==0)&&(sensor3==0))
{
led1=1;
led2=0;
led3=0;
leftturn();
}
else if((sensor1==1)&&(sensor2==1)&&(sensor3==0))
{
led1=1;
led2=1;
led3=0;
rightturn();
}
else if((sensor1==1)&&(sensor2==0)&&(sensor3==1))
{
led1=1;
led2=0;
led3=1;
leftturn();
}
else if((sensor1==1)&&(sensor2==1)&&(sensor3==1))
{
led1=1;
led2=1;
led3=1;
reverse();
}
else
{
led1=0;
led2=0;
led3=0;
stop();
}
}
return 0;
}