Bletooth Control Obstacle Avodiance, High Low Beam Robot Car
Bletooth Control Obstacle Avodiance, High Low Beam Robot Car
ON
BACHELOR OF TECHNOLOGY
IN
By
I
CERTIFICATE
This is to certify that the project entitled “BLUETOOTH CONTROL OBSTACLE AVOID- ANCE
HIGH LOW BEAM ROBOT CAR” which is being submitted by Sristi Rawat(2100145),
Yogesh Bisht (2100153), Akhil Kothari(2100107) in partial fulfillment of the requirements for
the award of Bachelor of Technology degree in Electronics and Communication Engineering to
the Department of Electronics and Communication Engineering, G.B. Pant Institute of
Engineering and Technology, Pauri Garhwal, Uttarakhand is a bonafide work carried out by
them under my guidance and supervision. To the best of my knowledge, the matter embodied in
the project has not been submitted for the award of any other degree or diploma.
SUPERVISOR
II
ACKNOWLEDGEMENT
It is our proud privilege and duty to acknowledge the kind of help and guidance received from
several people in preparation of this project. It would not have been possible for us without their
valuable help, cooperation and guidance.
First and foremost, we wish to record our sincere gratitude to our mentor Dr. Ajay Kumar and
to the Head of the Department Prof. (Dr.) Rajesh Kumar and our respected Director of our
Institute Prof. (Dr.) V.N Kala for their constant support and encouragement in preparation of
this report and for making available library and laboratory facilities needed to prepare this
report.
Secondly, we would like to thank our parents who patiently helped us as we went through our
work and helped to modify and eliminate some of the irrelevant or unnecessary stuffs. We
would also like to thank our friends who helped us to make our work more organized and well-
stacked till the end.
I
ABSTRACT
This project is about the development of an Arduino-based autonomous car that employs ultrasonic
sensors, servo motors and GPS technology for avoiding obstacles and navigating in real-time. The car
ensures continuous motion by detecting and responding to obstacles within its environment.
Distance to an obstacle is measured by a front facing ultrasonic sensor. If any obstruction is found within
12 centimeters, the robot ceases activity while the center rotates both ways to measure distances on either
side. A simple algorithm selects the best direction with the longest clear space and the car resumes
moving ahead in that path. Consequently, this process constantly repeats itself thereby allowing dynamic
path finding and obstacle avoidance. Additionally, there are lights on board that change as per how close
or far away from obstacles they are, thus giving visual indications on its status and condition.
When turned on, the ultrasonic sensor oscillates briefly indicating it is alive. Four motors of the robot
make it go forward but stop instantly while slightly reversing upon sensing something 10 centimeters
away from it. Finally, leftward scanning or right scanning of this same detector evaluates which among
two directions should be taken ahead.
The movements as well as precise positioning can be tracked hence facilitating accurate navigation due to
GPS functionality installed in it. This project is a fusion of basic robotics principles with sensory
technology and location tracking that can form the basis for building advanced autonomous car systems.
Some practical applications of this type of car are in automated warehousing, exploration, or service
robotics where self-navigation and obstacle avoidance are critical.
IV
TABLE OF CONTENT
DECLARATION
ACKNOWLEDGEMENT
ABSTRACT
1. INTRODUCTION
2. COMPONENTS REQUIRED
3. CODE
4 . PROTEUS SIMULATION
5. CONCLUSION
INTRODUCTION :
Arduino Uno
Arduino is an open-source electronics platform based on easy-to-use hardware and software.
Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter
message - and turn it into an output - activating a motor, turning on an LED, publishing
something online. You can tell your board what to do by sending a set of instructions to the
microcontroller on the board. To do so you use the Arduino programming language (based on
Wiring), and the Arduino Software (IDE), based on Processing.
Fig:Arduino Uno
Fig. Schematic Diagram of Arduino
Pin Description
Arduino Uno is a microcontroller board based on 8-bit ATmega328P microcontroller. Along
with ATmega328P, it consists other components such as crystal oscillator, serial communication,
voltage regulator, etc. to support the microcontroller. Arduino Uno has 14 digital input/output
pins (out of which 6 can be used as PWM outputs), 6 analog input pins, a USB connection, A
Power barrel jack, an ICSP header and a reset button.
The 14 digital input/output pins can be used as input or output pins by using pinMode(),
digitalRead() and digitalWrite() functions in Arduino programming. Each pin operate at 5V and
can provide or receive a maximum of 40mA current, and has an internal pull-up resistor of 20-50
KOhms which are disconnected by default. Out of these 14 pins, some pins have specific
functions as listed below
• Serial Pins 0 (Rx) and 1 (Tx) ==> Rx and Tx pins are used to receive and transmit TTL
serial data. They are connected with the corresponding ATmega328P USB to TTL serial
chip.
• External Interrupt Pins 2 and 3 ==> These pins can be configured to trigger an interrupt
on a low value, a rising or falling edge, or a change in value.
• PWM Pins 3, 5, 6, 9 and 11 ==> These pins provide an 8-bit PWM output by using
analogWrite() function.
• SPI Pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK) ==> These pins are used for SPI
communication.
• In-built LED Pin 13 ==> This pin is connected with an built-in LED, when pin 13 is
HIGH – LED is on and when pin 13 is LOW, its off.
There are 6 analog input pins, each of which provide 10 bits of resolution, i.e. 1024 different
values. They measure from 0 to 5 volts but this limit can be increased by using AREF pin with
analog Reference() function.
• Analog pin 4 (SDA) and pin 5 (SCA) also used for TWI communication using Wire
library.
• AREF ==> Used to provide reference voltage for analog inputs with analogReference()
function.
• Reset Pin ==>Making this pin LOW, resets the microcontroller.
L293D motor driver
The L293D is a dual-channel H-Bridge motor driver capable of driving a pair of DC motors or a
single stepper motor. It is a popular IC used in robotics, automation, and other applications
where precise motor control is required.
Key Features:
Applications:
Robotics
Automation
Industrial control systems
Motor control systems
Stepper motor control
DC motor control
Pinout:
The L293D has 16 pins, with eight pins dedicated to each motor. The pinout is as follows:
Example Usage:
The L293D can be used with Arduino or other microcontrollers to control DC motors or stepper
motors. The IC is connected to the microcontroller using digital pins, and the motor is connected
to the output pins of the IC. The enable pins are used to enable or disable the motor control.
Conclusion:
The L293D is a versatile and widely used motor driver IC that can be used in a variety of
applications where precise motor control is required. Its ability to drive two DC motors or a
single stepper motor makes it a popular choice for robotics and automation projects
The HC-05 is a popular Bluetooth module used for wireless communication in various embedded
systems and microcontroller projects. It is widely used due to its ease of integration,
affordability, and support for both master and slave modes.
Bluetooth Version:
Supports Bluetooth 2.0 + EDR (Enhanced Data Rate), which ensures good performance
and data transfer speeds.
Operating Modes:
Master Mode: The module can initiate connections with other Bluetooth devices.
Slave Mode: The module can only accept connections initiated by other devices.
Communication:
Range:
Pin Configuration:
Command Mode: Used for configuring the module. Accessed by applying a high
signal to the Key/EN pin before power-up.
Data Mode: Used for normal data transmission. The module defaults to this mode
when powered on.
An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic
sound waves. It works by emitting high-frequency sound waves and measuring the time it takes
for the waves to bounce back from the target object. This technology is commonly used in
various applications, including robotics, automation, and industrial control systems.
An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back
information about an object’s proximity. High-frequency sound waves reflect across boundaries
to produce distinct echo patterns, allowing the sensor to calculate the distance to the object.
Neo-6M GPS module is shown in the figure below.It comes with an external
antenna and does not come with header pins
#include <Servo.h>
#include <AFMotor.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#define Echo A0
#define Trig A1
#define motor 10
#define Speed 170
#define spoint 103
char value;
int distance;
int Left;
int Right;
int L = 0;
int R = 0;
int L1 = 0;
int R1 = 0;
TinyGPSPlus gps;
SoftwareSerial gps_ss(7, 8);
Servo servo;
AF_DCMotor M1(1);
AF_DCMotor M2(2);
AF_DCMotor M3(3);
AF_DCMotor M4(4);
void setup() {
Serial.begin(9600);
pinMode(Trig, OUTPUT);
pinMode(Echo, INPUT);
pinMode(motor,OUTPUT);
servo.attach(motor);
M1.setSpeed(Speed);
M2.setSpeed(Speed);
M3.setSpeed(Speed);
M4.setSpeed(Speed);
gps_ss.begin(9600);
pinMode(12, OUTPUT);
pinMode(4, OUTPUT);
}
void loop() {
distance=ultrasonic();
Bluetoothcontrol();
Obstacle();
if (distance<=60)
{
digitalWrite(4, LOW);
digitalWrite(12,LOW);
}
else
{
digitalWrite(4,HIGH);
digitalWrite(12,HIGH);
}
}
void Bluetoothcontrol() {
if (Serial.available() > 0) {
value = Serial.read();
Serial.println(value);
}
if (value == 'F') {
forward();
}
else if (value == 'B') {
backward();
}
else if (value == 'L') {
left();
}
else if (value == 'R') {
right();
}
else if (value == 'S') {
Stop();
}
else if(value=='V'){
gpsLocation();
value='S';
}
}
void Obstacle() {
digitalWrite(4, LOW);
digitalWrite(12,LOW);
}
else
{
digitalWrite(4,HIGH);
digitalWrite(12,HIGH);
}
}
int ultrasonic() {
digitalWrite(Trig, LOW);
delayMicroseconds(4);
digitalWrite(Trig, HIGH);
delayMicroseconds(10);
digitalWrite(Trig, LOW);
long t = pulseIn(Echo, HIGH);
long cm = t / 29 / 2;
return cm;
}
void gpsLocation()
{
Serial.println("Attempting to read GPS data...");
gps_ss.listen();
bool receivedData = false;
if (gps.location.isValid()) {
gps.encode(gps_ss.read());
Serial.print("Latitude= ");
Serial.println(gps.location.lat());
Serial.print("Longitude= ");
Serial.println(gps.location.lng());
}
else
{
Serial.println("Location not valid.");
}
}
void forward() {
M1.run(FORWARD);
M2.run(FORWARD);
M3.run(FORWARD);
M4.run(FORWARD);
}
void backward() {
M1.run(BACKWARD);
M2.run(BACKWARD);
M3.run(BACKWARD);
M4.run(BACKWARD);
}
void right() {
M1.run(BACKWARD);
M2.run(BACKWARD);
M3.run(FORWARD);
M4.run(FORWARD);
}
void left() {
M1.run(FORWARD);
M2.run(FORWARD);
M3.run(BACKWARD);
M4.run(BACKWARD);
}
void Stop() {
M1.run(RELEASE);
M2.run(RELEASE);
M3.run(RELEASE);
M4.run(RELEASE);
}
int rightsee() {
servo.write(20);
delay(800);
Left = ultrasonic();
return Left;
}
int leftsee() {
servo.write(180);
delay(800);
Right = ultrasonic();
return Right;
}
PROTEUS SIMULATION