Sie sind auf Seite 1von 10

Obstacle Avoiding Robot

EE-211 LAB
Instructor: Sir Asad Khaliq

Group Members
Shahzaib Ahmad 2017427
Shahmeer Ahmad Sethi 2017423
Muneeb Ahmed Butt 2017350
Faculty EEP
Abstract
We have made an autonomous obstacle avoiding robotic car. When, the car detects
an obstacle within 15 cm of the Ultrasonic Sensor it reverses it direction, turns and
then starts moving forward and vice versa. It is a very common theory brought to
practical lines.
Introduction
Apparatus used:
1 l293d IC (Motor Driver)

1 Arduino UNO Development Board

1 9V Battery

2 DC Motors

1 2 WD Chassis

1 Power Bank

Jumper Wires

1 Ultra Sonic Sensor

1 Small Bread-board
Objective
The objective of this project was to demonstrate the effect of the Ultra Sonic
Sensor. This prototype can also be used as a path identifier for blind people. It can
be further modified by adding a siren or buzzer and/or adding registers or other
memory storage devices so that the car remembers that which path has obstacles in
it.

Working
This circuit was not very complicated but it took time to learn the coding of
Arduino. We have connected the right and left motors to Pins 3, 6 and Pins 11, 14
of the motor driver respectively. Moreover, we have grounded the Pins 4, 5, 12, 13
and applied Vcc = 5V to Pins 1, 9, 16. The Digital Pins 2, 3, 4, 5 of Arduino are
connected to Pins 2, 7, 15, 10 of the Motor Driver IC respectively. Pin number 8 of
the IC is connected to the 9V supply of the switch. The Vcc and Ground pins of the
Ultra Sonic Sensor are connected to the specific pins at the Arduino while, the
trigger and echo pins are connected to Digital Pins 12, 13 respectively.
Circuit Diagram
Methodology
Arduino Code
int LP=2; //LP=Left Wheel Positive terminal

int LN=3; //LN=Left Wheel Negative terminal

int RP=4; //RP=Right Wheel Positive terminal

int RN=5; //RN=Right Wheel Negative terminal

#define trigPin 12 // define the pins of your sensor

#define echoPin 13

void setup() {// put your setup code here, to run once:

Serial.begin(9600);

Serial.println("Motor test!");

pinMode(trigPin, OUTPUT);// set the trig pin to output (Send sound waves)

pinMode(echoPin, INPUT);// set the echo pin to input (recieve sound waves)

pinMode(LP,OUTPUT); //set LP as output

pinMode(LN,OUTPUT); //set LN as output

pinMode(RP,OUTPUT); //set RP as output

pinMode(RN,OUTPUT); //set RN as output

}
void loop() {

// put your main code here, to run repeatedly:

//P=1,N=0-->CW P=0,N=1-->CCW

//RP=Right Wheel Positive RN=Right Wheel Negative

long duration, distance; // start the scan

// to ensure a clean high pulse

digitalWrite(trigPin, LOW);

delayMicroseconds(2); // delays are required for a succesful sensor operation.

digitalWrite(trigPin, HIGH);

//this sensor is triggered by a HIGH pulse of 10 or more microseconds.

delayMicroseconds(10); //this delay is required as well!

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

//the speed of sound is 340m/s or 29 microsecond / cm

distance = (duration/2) / 29.1;// convert the distance to centimeters.

//duration is divided by 2 because 1 is for transmitting and 1 is for recieving so we have divided
by 2 to make an average

if (distance > 15)

//Forward

digitalWrite(LP,LOW);

digitalWrite(LN,HIGH);

digitalWrite(RP,LOW);

digitalWrite(RN,HIGH);
}

else /*if there's an obstacle 15 centimers, ahead, do the following: */

Serial.println ("Close Obstacle detected!" );

Serial.println ("Obstacle Details:");

Serial.print ("Distance From Robot is " );

Serial.print ( distance);

Serial.print ( " CM!");// print out the distance in centimeters.

Serial.println (" The obstacle is declared a threat due to close distance. ");

Serial.println (" REVERSE !");

//backward

digitalWrite(LP,HIGH);

digitalWrite(LN,LOW);

digitalWrite(RP,HIGH);

digitalWrite(RN,LOW);

delay(4000);

//Right

Serial.println (" TURN !");

digitalWrite(LP,LOW);

digitalWrite(LN,HIGH);

digitalWrite(RP,LOW);

digitalWrite(RN,LOW);

delay(2500);

}
Conclusion
The project was found working and the extra 9V battery switch provided extra
power to the car which in turn increased the speed and sensing ability of the Ultra
Sonic Sensor used,

Achievements
We understood partial coding of Arduino and found it very similar to C++ that we
learnt in CS101 and CS102 courses. We also went through the importance of clean
circuitry in terms of debugging. Teamwork was the mutual work we all learnt, we
divided the tasks among ourselves and spent 2 days (mostly weekends) per week
on our project to make sure that the project was presentable and in a working
condition. We came across the use of Proteus 8 that completely new to us.

Limitations
We found soldering very tough as we could not handle the rod easily at the start.
Learning Arduino proved to be difficult for us as we had never heard of it before.
While, using Proteus we could not find the library for the Ultra Sonic Sensor due
to which our simulation is not like it should be. Firstly, we had planned to use an
HC-05 Bluetooth Module but could not use it because the application that was
compatible with our module was crashing repeatedly in our phones.No table of
contents entries found.

Das könnte Ihnen auch gefallen