Arduino Obstacle Avoiding Car Project Report
Arduino Obstacle Avoiding Car Project Report
PROJECT REPORT
ON
BACHELOR OF TECHNOLOGY
IN
ELECTRICAL ENGINEERING
SUBMITTED BY
ABHISHEK KUMAR (1806520001)
BHUPENDER KUNTAL (1806520006)
GAURAV KUMAR (1806520010)
BIPIN CHAUDHARY (1806520007)
SUBMITTED TO
DATE:
CERTIFICATE
We wish to express our sincere thanks to our project guide Mr. Rajkumar
Baghel who contributed his precious time for the completion of this
project. We would like to pay our gratitude to our respected teachers of
Electrical Engineering Department.
Specially to Mr. Ram Chandra Gupta (H.O.D.) for their kind support.
We would also like to thank all our friends for giving their precious time
during the course of project. We are also very thankful to our family
members whose moral support cannot be neglected.
This Work is based on Arduino, motor driver, Ultrasonic Sensor and Servo Motor.
Arduino is an open source prototyping platform Based on easy-to-use hardware and
software. Arduino uses an ATmega328 microcontroller. Since robotics has become a
major part in our daily life and also in the engineering field and it plays a vital role in
the development of new technology. This project can be made in a bigger scale for
real time vehicles. This project describes about an obstacle avoidance robot vehicle
which is controlled by ultrasonic sensor. The robot is made using ultrasonic sensor
and it is controlled by Arduino microcontroller. Ultrasonic sensor fixed in front
portion of the robot vehicle.
The sensor gets the data from surrounding area through mounted sensors on the robot.
The sensor is sense the obstacle and deviate its path to choose an obstacle free path.
The sensor will be send the data to the controller is compared with controller to
decide the movement of the robot Wheel.
The robot wheel movement and direction will be based on the sensing of the
ultrasonic sensor and also using a wheel encoder. This vehicle is used for detecting
obstacle and avoiding the collision. We have programmed the controller to be used
with ANDROID app.
Chapter 5 CONCLUSION
6.1 Conclusion
Arduino is an ASCII text file natural philosophy platform based mostly on easy-to-use hardware
and software. Arduino boards are able to scan inputs light-weight on a device, a finger on a button,
or a message and switch it into an output activating a motor, turning on a semiconductor diode,
publication one thing online. We are able to tell our board what to try to by causation a collection of
directions to the microcontroller on the board. We have a tendency to use the Arduino artificial
language (based on Wiring), and therefore the Arduino software package (IDE), supported process.
Over the years Arduino has been the brain of thousands of projects, from everyday objects to
advanced scientific instruments. A worldwide community of manufacturer’s students, hobbyists,
artists, programmers, and professionals has gathered around this open- supply platform, their
contributions have grown up to an unimaginable quantity of accessible information that may be of
nice facilitate to novices and consultants alike.
Arduino was born at the Ivrea Interaction style Institute as a straightforward tool for quick
prototyping, aimed toward students while not a background in natural philosophy and
programming. As before long because it reached a wider community, the Arduino board started
ever-changing to adapt to new desires and challenges, differentiating its supply from
straightforward 8-bit boards to merchandise for IoT applications, wearable, 3D printing, and
embedded environments. All Arduino boards are fully ASCII text file, empowering users to make
them severally and eventually adapt them to their explicit desires. The software package, too, is
ASCII text file, and it's growing through the contributions of users worldwide.
Due to its straightforward and accessible user expertise, Arduino has been used in thousands of
completely different comes and applications. The Arduino software package is simple to use for
beginners, nevertheless versatile enough for advanced users. It runs on raincoat, Windows, and
Linux. Lecturers and students use it to build low price scientific instruments, to prove chemistry and
physics principles, or to urge started with programming and artificial intelligence. Designers and
architects build interactive prototypes, musicians and artists use it for installations and to
experiment with new musical instruments. Makers, of course, use it to make several of the comets
exhibited at the Maker Faire, as an example. Arduino could be a key tool to find out new things.
Anyone kids, hobbyists, artists, programmers will begin tinkering simply following the step by step
directions of a kit, or sharing ideas on-line with different members of the Arduino community.
There are several different microcontrollers and microcontroller platforms offered for physical
computing. Optical phenomenon Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard,
and many others supply similar practicality. All of these tools take the untidy details of
microcontroller programming and wrap it up in an easy-to-use package. Arduino additionally
simplifies the method of operating with microcontrollers; however it offers some advantage for
lecturers, students, and interested amateurs over different systems:
The Uno could be an immense choice for our initial Arduino. It consists of 14-digital I/O pins,
wherever 6-pins will be used as PWM outputs, 6-analog inputs, a push button, an influence jack, a
USB affiliation and additional. It includes everything needed to carry up the microcontroller;
merely attach it to a laptop with the assistance of a USB cable and provides the availability to urge
started with AN AC to DC adapter or battery.
The LilyPad Arduino board could be a wearable e-textile technology dilated by “Leah Buechley”
and with consideration designed by “Leah and SparkFun”. Every board was imaginatively designed
with immense connecting pads & a sleek back to allow them to be stitched into consumer goods
exploitation semi conductive thread. This Arduino additionally includes of I/O, power, and
additionally device boards that are designed particularly for e- textiles. These are even wash-and-
wear.
The Arduino tool window consists of the toolbar with the buttons like verify, upload, new, open,
save, serial monitor. It conjointly consists of a text editor to write down the code, a message space
that displays the feedback like showing the errors, the text console that displays the output and a
series of menus just like the File, Edit and Tools menu.
1.6.1 Steps to program an Arduino
Programs written in Arduino are called sketches. A basic sketch consists of three elements
1. Declaration of Variables
2. Initialization: It's written within the setup () perform.
3. Management code: It's written within the loop () perform.
The sketch is saved with .ino extension. Any operations like collateral, gap a sketch, saving
a sketch will be done mistreatment the buttons on the toolbar or mistreatment the tool menu.
The sketch is to be keep within the sketch pad directory.
Choose the right board from the tools menu and therefore the interface numbers.
Click on the transfer button or selected transfer from the tools menu. So the code is
uploaded by the boot loader onto the microcontroller.
AND
SERVO MOTOR
In order to have a complete management over DC motor, we tend to have to management its speed
and rotation direction. This may be achieved by combining these 2 techniques.
The speed of a DC motor may be controlled by varied its input voltage. A typical technique for
doing this can be to use PWM (Pulse breadth Modulation). PWM could be a technique wherever
The higher the duty cycle, the bigger the average voltage being applied to the dc motor (High
Speed) and therefore the lower the duty cycle, the less the common voltage being applied to the dc
motor (Low Speed).
Below figure illustrates PWM technique with varied duty cycles and average voltages.
The DC motor’s spinning direction may be controlled by dynamic polarity of its input voltage. A
common technique for doing this can be to use Associate in Nursing H-Bridge. Associate in
Nursing H-Bridge circuit contains four switches with the motor at the middle forming Associate in
Nursing H-like arrangement. Closing 2 specific switches at the same time reverses the polarity of
the voltage applied to the motor. This causes amendment in spinning direction of the motor. Below
figure illustrates H-Bridge circuit operating.
At the center of the module is that the huge, black chip with chunky conductor is Associate in
Nursing L298N.
The L298N could be a dual-channel H-Bridge motor driver capable of driving a try of DC motors.
That means that it will on an individual basis drive up to 2 motors creating it ideal for building two-
wheeled mechanism platforms.
The L298N motor driver module is battery-powered through three-pin 3.5mm-pitch screw
terminals. It consists of pins for motor power offer (Vs), ground and 5V logic power offer (Vss)
NOTE: The L298N motor driver IC really has 2 input power pins viz. ‘Vss’ and ‘Vs’. From Vs pin
the H-Bridge gets its power for driving the motors which might be five to 35V. Vss is employed for
driving the logic electronic equipment which might be five to 7V. And that they each sink to a
typical ground named ‘GND’.
When this jumper is in place, the 5V regulator is enabled, supplying logic power supply (Vss) from
the motor power supply (Vs). In this case, 5V input terminal acts as an output pin and delivers 5V
0.5A. We can use it to power up the Arduino or other circuitry that requires 5V power supply.
When the jumper is removed, the 5V regulator gets disabled and we have to supply 5 Volts
separately through 5 Volt input terminal.
WARNING: We can put the jumper in place, if the motor power supply is below 12V. If it is
greater than 12V, we should remove the jumper to avoid the onboard 5V regulator from getting
damaged.
Also DO NOT supply power to both the motor power supply input and 5V power supply input
when jumper is in place.
2.5 Voltage Drop of L298N
The voltage drop of the L298N motor driver is about 2V. This is due to the internal voltage drop in
the switching transistors in the H-Bridge circuit. So, if we connect 12V to the motor power supply
terminal, the motors will get voltage around 10V. This means that a 12V DC motor will never spin
at its peak speed.
To get peak speed out of motor, the motor power supply should be bit higher voltage (2V) than
motor’s actual voltage requirement.
Considering the voltage drop of 2V, if we are using 5V motors we’ll need to provide 7V at motor
power supply terminal. If we have 12V motors then our motor supply voltage should be 14V.
Each channel on the module can deliver up to 2A to the DC motor. However, the amount of current
supplied to the motor depends on system’s power supply.
Using the direction control pins, we can control whether the motor spins forward or backward.
These pins actually control the switches of the H-Bridge circuit inside L298N IC. The module has
two direction control pins for each channel. The IN1 and IN2 pins control the spinning direction of
the motor A while IN3 and IN4 control motor B. The spinning direction of a motor can be
controlled by applying either a logic HIGH (5 Volts) or logic LOW (Ground) to these inputs. The
below chart illustrates how this is done.
The speed control pins viz. ENA and ENB are used to turn the motors ON, OFF and control its
speed. Pulling these pins HIGH will make the motors spin, pulling it LOW will make them stop.
But, with Pulse Width Modulation (PWM), we can actually control the speed of the motors. The
module usually comes with a jumper on these pins. When this jumper is in place, the motor is
enabled and spins at maximum speed. If we want to control the speed of motors programmatically,
we need to remove the jumpers and connect them to PWM-enabled pins on Arduino.
Next, we need to supply 5 Volts for the L298N’s logic circuitry. We will make use of the on-board
5V regulator and derive the 5 volts from the motor power supply so, keep the 5V-EN jumper in
place.
Now, the input and enable pins (ENA, IN1, IN2, IN3, IN4 and ENB) of the L298N module are
connected to six Arduino digital output pins (6, 7, 8, 9, 10 and 11). Note that the Arduino output
pins 10 and 11 are both PWM-enabled.
Finally, connect one motor to terminal A (OUT1 & OUT2) and the other motor to terminal B
(OUT3 & OUT4). We can interchange our motor’s connections; technically, there is no right or
wrong way.
When we’re done we should have something that looks similar to the figure shown below.
3.4 Battery
For the running of this project we have use a power bank instead of any battery which is an
advantage to this project. It can be charged by USB data cable and can be used as per the need.
Some of the technical specification of the power bank is given below.
GENERAL
Brand Xiaomi
FEATURES
BATTERY CHARGING
POWER REQUIREMENTS
Power Input 12 V
Power Output 12 V
The obstacle avoidance robotic vehicle uses ultrasonic sensors for its
the robot is going on the desired path the ultrasonic sensor transmits the
comes ahead of it the ultrasonic waves are reflected back from an object and that
motors left, right, back, front based on ultrasonic signals. In order to control the
The aim of this project is to implement an obstacle avoiding robot using ultrasonic
sensor and Arduino. All the connections are made as per the circuit diagram. The
the robot moves forward. During this time, the ultrasonic sensor continuously
calculate the distance between the robot and the reflective surface.
This information is processed by the Arduino. If the distance between the robot
and the obstacle is less than 15cm, the Robot stops and scans in left and right
directions for new distance using Servo Motor and Ultrasonic Sensor. If the
distance towards the left side is more than that of the right side, the robot will
prepare for a left turn. But first, it backs up a little bit and then activates the Left
Similarly, if the right distance is more than that of the left distance, the Robot
prepares right rotation. This process continues forever and the robot keeps on
CODING OF ARDUINO
#include <AFMotor.h>
#include <Servo.h>
#define TRIG_PIN A0
#define ECHO_PIN A1
#define MAX_SPEED_OFFSET 20
Servo myservo;
void setup() {
myservo.attach(10);
delay(2000);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
distance = readPing();
delay(100);
void loop() {
int distanceR = 0;
int distanceL = 0;
delay(40);
if(distance<=25)
moveStop();
delay(100);
moveBackward();
delay(200);
moveStop();
delay(200);
distanceR = lookRight();
delay(200);
distanceL = lookLeft();
delay(200);
if(distanceR>=distanceL)
turnRight();
moveStop();
turnLeft();
moveStop();
else
moveForward();
distance = readPing();
int lookRight()
myservo.write(50);
delay(100);
myservo.write(115);
return distance;
int lookLeft()
myservo.write(170);
delay(500);
delay(100);
myservo.write(115);
return distance;
delay(100);
delay(100);
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);
void moveForward() {
goesForward=true;
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
for (speedSet = 0; speedSet < MAX_SPEED; speedSet +=2) // slowly bring the speed up to
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 < MAX_SPEED; speedSet +=2) // slowly bring the speed up to
motor1.setSpeed(speedSet);
motor2.setSpeed(speedSet);
motor3.setSpeed(speedSet);
motor4.setSpeed(speedSet);
delay(5);
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 turnLeft() {
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
5.1Conclusion
The Arduino is an open source device that has been the brain for numerous projects. The Arduino
has everything that is required by the user which includes its inbuilt converter, I/P pins etc. With the
combination of Arduino, and the Bluetooth Shield we can control over many other things, like
home Lightings, air conditioner and many more through our cell phones. The Arduino can also
contribute at large for the Smart Home system. By doing this Project we found out a lot about the
Arduino, and how it has made us easier to convert digital signals into physical movements. One
more advantage of Arduino is that once a program is burned we don‘t need to worry about the
program getting erased as long as it is not RESET. Arduino has also over all other microcontroller
because of its efficiency and user friendly property.
5.2Future Work
In the process of development of the Arduino Based Car Controlling System Using G-Sensor, most
of the useful feature is identified and many of them were implemented. But due to the time
limitations and other factor some of these cannot be added.
So the development features in brief:
A Robot Mounted with camera
A headset, with a full-color display
A mission control centre
APPLICATIONS
Obstacle avoiding robots can be used in almost all mobile robot navigation
systems.
They can be used for household work like automatic vacuum cleaning
They can also be used in dangerous environments, where human penetration
could be fatal.
The modification of this logic code is used in vacuum cleaners.
This robot can be used for avoiding concealed paths, such as an industrial
robot in a factory is expected to avoid workers so that it won’t hurt them
If there is an obstacle in the root of the robot, it can detect and avoid it. Thus it
can move without having damaged by any obstacle which makes it more
reliable.
They have great importance in scientific exploration and emergency rescue,
there may be places that are dangerous for humans or even impossible for
humans to reach directly, then we should use robots to help us gather
information to about their surrounding challenging environments.
THANKU YOU