A Employbility Skill & Mini Project Report on
OBSTACLE AVOIDING CAR
submitted in partially fulfillment of the requirements for the degree of
                   Bachelor of Technology
                                     in
  Electronics and Communication Engineering
                                     By
                 Deepak Mishra (2300970310066)
                 Deepak Singh (2300970310067)
                       Under the Guidance of
                         Dr. Ningombam Ajit
                           Associate Professor
         Department of Electronics and Communication Engineering
                     (B. Tech ECE – Accredited by NBA)
       Galgotias College of Engineering and Technology, Greater Noida
      (Affiliated to Dr.A.P.J Abdul Kalam Technical University, Lucknow)
                                 DECLARATION
We hereby declare that the thesis entitled “Obstacle      Avoiding Car” submitted by
us, for the award of the degree of Bachelor of Technology in Electronics and
Communication Engineering to Galgotias College of Engineering and Technology, Greater
Noida affiliated to Dr. A.P.J. Abdul Kalam Technical University, Lucknow is a record of
bonafide work carried out by us under the supervision of Dr.     Ningombam Ajit.
        We further declare that the work reported in this report has not been submitted and
will not be submitted, either in part or in full, for the award of any other degree or diploma
in this institute or any other institute or university.
Place : Greater Noida
Date :                                                      Signature of the Candidates
                                 CERTIFICATE
This is to certify that the thesis entitled “Obstacle Avoiding Car” submitted by DEEPAK
MISHRA, DEEPAK SINGH Department of Electronics and Communication Engineering,
Galgotias College of Engineering and Technology, Greater Noida affiliated to Dr. A.P.J.
Abdul Kalam Technical University (AKTU), Lucknow, for the award of the degree of
Bachelor of Technology in Electronics and Communication Engineering, is a record of
bonafide work carried out by him/her under my supervision, as per AKTU code of
academic and research ethics.
        The contents of this report have not been submitted and will not be submitted either
in part or in full, for the award of any other degree or diploma in this institute or any other
institute or university. The thesis fulfils the requirements and regulations of the University
and in my opinion meets the necessary standards for submission.
Place: Greater Noida
Date:                                                            Signature of the Guide
Internal Examiner 1                                                     Internal Examiner 2
                                        Approved by
                                 Head of the Department
                                              ii
                     ABSTRACT
Obstacle avoidance is one of the most important aspects of mobile
robotics. Without it, robot movement would be very restrictive
and fragile. This project proposes robotic vehicle that has an
intelligence built in it such that it directs itself whenever an
obstacle comes in its path. So, to protect the robot from any
physical damages. This can be design to build an obstacle
avoidance robotic vehicle using ultrasonic sensors for its
movement. A micro-controller (AT mega 328P) is used to
achieve the desired operation. An ultrasonic sensor is used to
detect any obstacle ahead of it and sends a command to the micro
controller. Depending on the input signal received, the micro-
controller redirects the robot to move in an alternate direction by
actuating the motors which are interfaced to it through a motor
driver.
                                iv
                        ACKNOWLEDGEMENT
First of all, we would like to express our gratitude to our beloved Chairman Shri.
Suneel Galgotia and CEO Shri. Dhruv Galgotia for proving necessary facilities to
carry out and finish the project successfully. We are grateful to our Director Dr.
Vikram Bali for his support and encouragement.
          Our special thanks goes to Dr. Rahul Vivek Purohit, Head of the
Department, Electronics and Communication Engineering, for providing an
environment that encouraged us in working towards our goal and supported in
completion of our project. This project gave us an opportunity to apply creative and
critical thinking skills.
          We would like to present our deep sense of gratitude to our project guide, Dr.
Ningombam Ajit, Assistant Professor, Department of Electronics and
Communication Engineering who has always been a source of motivation and firm
support for carrying out the project. The supervision and support that she gave truly
helped in the progression of the project. Her cooperation is much indeed appreciated.
We are highly obliged to her for her valuable advices and moral support during research
period.
Finally, our greatest and special gratitude goes to our family for their love and support.
Place: Greater Noida                                                Deepak Mishra
Date:                                                               Deepak Singh
                                            v
           Table of Content
1.   Introduction.
2.   Literature Survey.
3.   Design and Hardware Requirements.
4.   Block Diagram.
5.   Working Principle.
6.   Circuit Diagram.
7.   Application.
8.   Program.
9.   Conclusion.
                          vi
                                      PROGRAM
#include <AFMotor.h>
#include <NewPing.h>
#include <Servo.h>
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_DISTANCE 200
#define MAX_SPEED 190 // sets speed of DC motors
#define REDUCED_SPEED 100 // New reduced speed for the motors
#define MAX_SPEED_OFFSET 20
NewPing sonar(TRIG_PIN, ECHO_PIN, MAX_DISTANCE);
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
Servo myservo;
boolean goesForward = false;
int distance = 100;
int speedSet = 0;
void setup() {
 myservo.a ach(10);
 myservo.write(115);
 delay(2000);
 distance = readPing();
 delay(100);
 distance = readPing();
 delay(100);
 distance = readPing();
 delay(100);
 distance = readPing();
                                        PROGRAM
    delay(100);
void loop() {
    int distanceR = 0;
    int distanceL = 0;
    delay(40);
    if (distance <= 15) {
        moveStop();
        delay(100);
        moveBackward();
        delay(300);
        moveStop();
        delay(200);
        distanceR = lookRight();
        delay(200);
        distanceL = lookLe ();
        delay(200);
        if (distanceR >= distanceL) {
            turnRight();
            moveStop();
        } else {
            turnLe ();
            moveStop();
    } else {
        moveForward();
    distance = readPing();
}
                                 PROGRAM
int lookRight() {
    myservo.write(50);
    delay(500);
    int distance = readPing();
    delay(100);
    myservo.write(115);
    return distance;
int lookLe () {
    myservo.write(170);
    delay(500);
    int distance = readPing();
    delay(100);
    myservo.write(115);
    return distance;
int readPing() {
    delay(70);
    int cm = sonar.ping_cm();
    if (cm == 0) {
        cm = 250;
    return cm;
void moveStop() {
    motor1.run(RELEASE);
    motor2.run(RELEASE);
    motor3.run(RELEASE);
    motor4.run(RELEASE);
}
                                         PROGRAM
void moveForward() {
    if (!goesForward) {
        goesForward = true;
        motor1.run(FORWARD);
        motor2.run(FORWARD);
        motor3.run(FORWARD);
        motor4.run(FORWARD);
 for (speedSet = 0; speedSet < REDUCED_SPEED; speedSet += 2) { // Use REDUCED_SPEED instead of
MAX_SPEED
            motor1.setSpeed(speedSet);
            motor2.setSpeed(speedSet);
            motor3.setSpeed(speedSet);
            motor4.setSpeed(speedSet);
            delay(5);
void moveBackward() {
    goesForward = false;
    motor1.run(BACKWARD);
    motor2.run(BACKWARD);
    motor3.run(BACKWARD);
    motor4.run(BACKWARD);
 for (speedSet = 0; speedSet < REDUCED_SPEED; speedSet += 2) { // Use REDUCED_SPEED instead of
MAX_SPEED
        motor1.setSpeed(speedSet);
        motor2.setSpeed(speedSet);
        motor3.setSpeed(speedSet);
        motor4.setSpeed(speedSet);
        delay(5);
}
                            PROGRAM
void turnRight() {
    motor1.run(FORWARD);
    motor2.run(FORWARD);
    motor3.run(BACKWARD);
    motor4.run(BACKWARD);
    delay(500);
    motor1.run(FORWARD);
    motor2.run(FORWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);
void turnLe () {
    motor1.run(BACKWARD);
    motor2.run(BACKWARD);
    motor3.run(FORWARD);
    motor4.run(FORWARD);