Obstacle Avoiding Smartcar Using Arduino PDF
Obstacle Avoiding Smartcar Using Arduino PDF
Submitted by
SRIJAN SRIVASTAVA
16BEC0685
SAMARTH MEHTA
16BEE0299
SHASHANK SINGH
16BEC0746
AAKRITI MITTAL
16BEC0935
Submitted to
SUBHATHIRAI S P
Assistant Professor
VIT UNIVERSITY
October 2017
BONAFIDE CERTIFICATE
VIT UNIVERSITY
Vellore, Tamil Nadu 632014
(Signature)
SUBHATHIRAI S P
Assistant Professor
Table of Contents
Obstacle Avoiding Smartcar using Arduino and Ultrasonic Sensors ..........................1
Abstract ...........................................................................................................................4
Introduction.....................................................................................................................5
Problems addressed ................................................................................................5
Solutions offered ......................................................................................................5
Components Used ..........................................................................................................6
Features of the components used ................................................................................7
Arduino Uno Microcontroller .......................................................................................7
Ultrasonic Sensor ........................................................................................................8
Testing the components .............................................................................................9
Shields....................................................................................................................... 10
Motor Shield .......................................................................................................... 10
Procedure..................................................................................................................... 11
1. Header ............................................................................................................. 12
2. Global variables .............................................................................................. 12
3. Setup Routine ................................................................................................. 12
4. Loop ................................................................................................................. 12
5. Functions ......................................................................................................... 12
Schematic .................................................................................................................... 17
Working ........................................................................................................................ 18
Applications ................................................................................................................. 19
Further implementations ......................................................................................... 19
Project Contributions .................................................................................................. 20
Cost Analysis ................................................................................................................ 20
References ................................................................................................................... 21
Abstract
Trajectory planning is one of the most important pivotal point in pick and place
tasks done by robotic manipulators. In this work, we have presented a robot,
which is compact, autonomous and fully functional.
This robot or a smartcar is built to sense any obstacle in its path, to avoid it and
resume its running involving the pre-computation of an obstacle free path.
Ultrasonic sensors were adapted to implement a real-time obstacle avoidance
system for wheeled robots, so that the robot can continually detect surroundings,
avoid obstacles, and move toward the target area.
This model has tremendous applications in vacuum cleaners, avoiding concealed
paths, parking systems, assembling automobiles and in chemical industries, in
scientific exploration, emergency rescue and in other isolated environments.
We use an Arduino UNO with a Motor Shield along with Stepper Motors to make
the car, and for sensing we incorporate an Ultrasonic Sensor which accurately and
efficiently detects any obstacles in the smart car’s path. The Arduino is coded
such that the smartcar moves backward when an obstacle arises in front of it with
a maximum limit of 50cms in ideal testing conditions.
Throughout the construction of this model, we educated ourselves to the Arduino
coding language, the Motor Shield functionality, and comprehensively, with the
working of an ultrasonic sensor and its features.
In conclusion, through this project, we aim to construct a model of a smartcar that
is beneficial to the quotidian problems of the present generation.
Introduction
Problems addressed
o Need for a robot that can perform trajectory planning effectively
o Need for a system which can detect obstacles and move in a pre-computed
path
o Need for the detection of obstacles that appear suddenly
o Need to minimize human risk regarding the upper limit of a human eye
o Need to assist the physically handicapped by incorporating cutting edge
technologies in wheelchairs
o Need to address the need for upgrade from inaccurate sensors like CCD
cameras, CMOS image sensors, laser light pens, global positioning systems,
and so on
o Need for advanced mapping devices during exploration of unknown
environments such as interplanetary exploration
Solutions offered
An Arduino is an open-source
microcontroller development
board. The most common version of
Arduino is the Arduino Uno. It is
relatively cheap, plugs straight into a
computer's USB port, and it is simple
to setup and use when compared to
other development boards.
Time = the time between when an ultrasonic wave is transmitted and when it is received
We divide this number by 2 since the sound wave has to travel to the object and back.
o The serial monitor allows the computer to connect serially with the Arduino.
o It takes data that the Arduino is receiving from sensors and other devices and
displays it in real-time on the computer
o Having this ability is invaluable to debug the code and understand what
number values the chip is actually receiving.
o Navigate to File --> Examples --> 1.Basics --> AnalogReadSerial
o Click the button to engage the serial monitor which looks like a magnifying
glass. We can now see the numbers being read by the analog pin in the
serial monitor. When we turn the knob the numbers will increase and
decrease.
The numbers will be between the range of 0 and 1023. The reason for this is that the
analog pin is converting a voltage between 0 and 5V to a discreet number.
Digital inputs may be used as the basis for countless digital communication
protocols.
o Shields are the expansion adapter boards that plug in over top of the Arduino
Uno and gives it special functions.
o Since the Arduino is open hardware, anyone who has the inclination is free to
make an Arduino shield for whatever task they wish to accomplish.
o Hence, there are countless number of Arduino shields available, out of which
the official ones are -
o Wireless SD Shield
o Ethernet Shield
o Motor Shield
Motor Shield
o Switch it on and off and then look in to making the LED on the left of
Arduino with the letter L next to it blink on and off for 2 seconds at a time.
o The Arduino Uno requires a male USB A to male USB B cable. Plug the USB
cable in to the Arduino and your computer, the LED will start blinking. It is
the default program stored on the chip
o The USB cable powers the device. Arduinos can also run standalone by
using a power supply in the bottom left of the board.
o Once programming is done it does not require to be constantly connected to
a machine we can opt to power it separately. This is entirely dependant on
the use case and circumstances we want to use the device in.
o Tools - Boards
o Select Arduino Uno.
o To set the serial port, go to the following:
All of that said, the only two parts of the sketch which are mandatory are the
Setup and Loop routines.
<pre>void setup() {
void loop() {
}
2. Next, we put a header on the code, so other people know about what we are
making, why, and under what terms:
<pre>/*
By VIT
2017
*/
void setup() {
void loop() {
}
3. Then, we define the pin names, and establish variables, and write the code
<pre>/*
By VIT
2017
*/
#include <AFMotor.h>
AF_DCMotor right_motor(1,MOTOR12_8KHZ);
AF_DCMotor left_motor(2,MOTOR12_8KHZ);
String readString;
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
right_motor.setSpeed(250);
left_motor.setSpeed(250);
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
Serial.println(distance);
if (distance<30){
right_motor.run (BACKWARD);
left_motor.run (FORWARD);
delay(500);
else{
right_motor.run (FORWARD);
left_motor.run (BACKWARD);
delay(500);
} }
Schematic
Fig 1 Schematic
Working
Further implementations –
o This technique can also be used as a vision belt for blind people by
changing the ultrasonic sensor by a kinetic sensor ,which is a type of
microwave sensor whose sensing range is very high and the output of
this sensor vary in according to the object position changes. This
technique enables blind people to navigate obstacles easily by placing
three vibratos in left, right and the centre of a belt named as Vision Belt.
o On top of obstacle avoiding robot temperature/ pressure sensors can be
added to monitor the atmospheric conditions around. This is useful in
places where the environment is not suitable for humans. Same
technology can be used in various applications by modifying the program
for example Line / Path finder Robot , automatic vacuum cleaner etc.
o They can be used as services robots, for the Low Cost Obstacle
Avoidance Robot, purpose of household work and so many other indoor
applications.
Project Contributions
Cost Analysis