You are on page 1of 23

EEE342 – Microprocessor Systems

& Interfacing.

Complex Engineering Problem

Presented To:
Sir Nesruminallah

Presented By:
Hafiz Ahsan Bajwa
Muhammad Junaid Sultan
Muhammad Hammad

Registration No:
FA20-BEE-055-T
FA20-BEE-089-T
FA20-BEE-132-T

Department of Electrical & Computer Engineering COMSATS University


Islamabad, Lahore Campus
Voice Control Car:

Introduction:

Robotics is an evolving technology. There are Various approaches to


build robots, and no one is sure which method or technology will be used 100 years from
now. Robotics is evolving like the Darwinian evolutionary theory of survival of the
fittest.

The framework equipment comprises of a controller outfitted with Bluetooth


communication module. It’ll be connected to the motors and other alternative components
of car. When the Bluetooth app is turned on and is connected with the current system via
Bluetooth, one will operate the car by giving wireless commands from the app using the
functions already programmed in the app. The vehicle will motion in four directions:
Forward, Backward, Right and Left. In forward movement, all four motors will motion in
the same direction and for backward motion; movement of the motors will be in opposite
direction. For left and right movements, either of the motors will rotate and to stop the
motors will stop. Instructions are given to the motors through the Bluetooth app of
Android Smartphone by the user.

In this project, we will deliberate how to control robot- controlled car using Bluetooth
module through Bluetooth application of an android mobile phone. The benefit of using
robot-controlled car is it can be used to reduce manual work. This project can be
modified quite easily to include a camera well that can stream the videos to the user
over Wi-Fi using WiFi module.

Related Work:
The automotive industry is evolving at a fast pace. Modern automobiles are far from the
vehicles that rolled off assembly lines in the 90s. Vehicles today are increasingly being
equipped with electrical and electronic components, efficiently replacing the ubiquitous
mechanical components of the past.

This transformation has also benefited the industry in several ways, as electrical and
electronic components enable:

· Improvement in modularity and reliability of internal operations of vehicles


· Efficient wireless communication between automotive control units and HMI in
the surroundings

The modern vehicle hosts wireless technologies such as Bluetooth Low Energy (BLE), GPS,
cellular (4G or 5G), Wi-Fi, etc. to fuel the evolving demands of the connected vehicle
ecosystem.

Project Implementation:
 Components Detials
Components:

 Arduino UNO board


 HC-05 Bluetooth module
 Ultrasonic sensor
 Servo Motor
 L293D motor driver
 Car Kit

Arduino UNO board :

The Arduino Uno is an open-source microcontroller board dependent on the Microchip


ATmega328P microcontroller and created by Arduino.cc. It is programmable with the
Arduino IDE through a kind B USB cable. It can be controlled by the USB link or by an
outside 9-volt battery, however it acknowledges voltages between 7 and 20 volts.

HC-05 Bluetooth module:

HC‐05 module is simple to use Bluetooth SPP (Serial Port Protocol) module, designed for
clear wireless serial association setup. The HC-05 Bluetooth Module is utilized in a Master
or Slave configuration, creating it a good resolution for wireless communication.

Ultrasonic sensor:

A ultrasonic sensor is an instrument that gauges the separation to an object utilizing


ultrasonic sound waves. An ultrasonic sensor utilizes a transducer to send and get ultrasonic
heartbeats that hand-off back data about an item's nearness. High-recurrence sound waves
reflect from limits to create unmistakable reverberation designs.
D = ½ T x C (where D is the distance, T is the time, and C is the speed of sound ~ 343
meters/second). For example, if a scientist set up an ultrasonic sensor aimed at a box and it
took 0.025 seconds for the sound to bounce back, the distance between the ultrasonic sensor
and the box would be:

D = 0.5 x 0.025 x 343

Servo Motor ;

A servomotor is a rotating actuator or straight actuator that takes into account exact control
of angular or linear position, speed and acceleration. It comprises of a reasonable engine
coupled to a sensor for position input. It likewise requires a moderately refined controller,
frequently a committed module structured explicitly for use with servomotors.
Servo motors are great devices that can turn to a specified position.Usually, they have a
servo arm that can turn 180 degrees. Using the Arduino, we can tell a servo to go to a
specified position and it will go there.

L293D motor driver

This L293D 16 pin Based Motor Driver Module is a powerful engine driver ideal for driving
DC Motors and Stepper Motors. It utilizes the wellknown L293 engine driver IC and has the
locally available 5V controller which it can gracefully to an outside circuit. It can control up
to 4 DC engines, or 2 DC engines with directional and speed control.

Motor with Tires


DC engine changes over electrical vitality into mechanical vitality. DC MOTOR idea is the
place gears decrease the speed of the vehicle yet increment its torque is known as gear
decrease.

Obstacle detector:
The obstacle detector has a night vision which enables no light or low light usage. It
performs high-quality picture transmitting and receiving.
 Schematic Diagram:
 Block Diagram:
Working;

Practical Application;
The block diagram of the simple voice controlled robotic vehicle is given it consists of the
smartphone that recognizes the voice commands and are being wirelessly transferred to
the Bluetooth module HC05. The module at that point changes over the order to content
and the series of characters are sent to the Arduino for additional handling. The Arduino
microcontroller decodes the string got and correspondingly performs further capacities.
The signals are sent to the motor that hence powers and drives the motors connected to it.
On the Transmitter area, commands are given to the Mobile Application through the mic.
This portable handset is associated with the moving vehicle by means of Bluetooth
module. The portable application utilized, is modified so that the voice orders given to the
handset are received by the mic and these simple voice orders are changed over to
advanced word successions (A to D transformation). These stored sequences are than
transmitted to the robotic vehicle via Bluetooth transceiver module and are sent to the
transceiver controller. Android application transceiver is used to decode the received
signal with the Bluetooth module. The controller contrasts these signals and the put away
program orders in it and convert them into voice strings. The voice strings are then used to
run the servo engines for the ideal interval of time. The microcontroller, sends directions,
which when executed, helps in working of the engine driver. The yield of the Arduino
goes to the engine driver IC and it controls the specific engine. A DC power supply is
required to run the system. The DC power supply feeds the Microcontroller and the
Bluetooth module.

Advantages:
 The Robot is small in size, therefore less space required.
 We can access the robot vehicle from the distance of meters as we are using WIFI
for the connection between robot and the server PC.
 As we are uscamera which is attach to the robot so it will capture video which will
be used for security.
 Low power consumption.
 No accident is done by improper driving of people and also available for elderly
and disabled people.

Some real-world applications of this voice-controlled Robot are:


 The robot is useful in places where humans find difficult to reach but human voice
reach. Such asin fire situations, in highly toxic areas.
 The robot can be used for monitoring or investigation.
 The voice controlled robotic car can be easily drive by unskilled driver by using
voice commands with the help of android application in smart phone.
Motivation of the Project:
 This task work has been limited to short range Bluetooth module. Utilizing a long
range modules and other availability gadgets will bring about network with the
robot for significant distances.
 Picture preparing can be executed in the robot to distinguish the shading and the items.
 A warm camera can be introduced to detect the warmth produced by bodies valuable
in military purposes to distinguish foes on the lines.
 Programmed Targeting System can be executed in the robot for following
the objective.
 Further upgrade in venture can be utilized for Home security and military purposes
where the orders can be given to robot without chance by expanding the range and by
introducing cameras.
 The robot is valuable in places where people discover hard to reach however
human voice comes to. For example, in fire circumstances, in profoundly
poisonous zones.
 It is the one of the significant phase of Humanoid robots.
 Discourse and voice acknowledgment security frameworks.
 The robot can be used for monitoring or investigation.

1. Result and Discussion:

Through our Design and implementation of our proposed system, we are able to achieve the
following as results:
 Robot is controlled through voice commands given by the user who is operating
the project.
 These voice command needs to be given through an android app which is installed
on the users android mobile.
 Speech recognition is done within the android app and then a respective command
is sent to the voicecontrolled robot vehicle.
 Microcontroller fitted on the Vehicle decodes these commands and gives
an appropriate command to the motors connected to the vehicle.
.
Conclusion:
The proposed framework of our project shows that how a robot can be control utilizing
Bluetooth. The voice controlling orders are effectively transmitted through Bluetooth
innovation and the desired activities effectively happen. This task lessens human
endeavours at spots or circumstances where human intercessions are troublesome. Such
frameworks can be brought into utilization at spots, for example, businesses, military
and guard, investigate purposes, and so forth.
References:

 https://bit.ly/3oSBJi5
 https://youtu.be/6kg5rJcFVuA
 https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8
&ved=2ahUKEwiUnvv9yK78AhVHzaQKHaGSAoMQFnoECA4QAQ&url=https%3A%2
F%2Fwww.instructables.com%2FROBOT-CAR-Bluetooth-Controlled-Obstacle-
Avoidance-%2F&usg=AOvVaw0gRKwofRZ7IPRWNVZ_0T5M

Final Hardware Picture;


Code:
// SMART_CAR_Project //
//Ahsan Bajwa

#include <Servo.h>
#include <AFMotor.h>
// B -//
char value;
int speedCar=255;
boolean lightFront =
false; boolean lightBack =
false; boolean S_light =
false;

// O //
int distance;
int Left;
int Right;
int L = 0;
int R = 0;
int L1 =
0; int R1
= 0;

// Defines //

#define Echo A0
#define Trig A1
#define S_motor 10
#define F_LED A4
#define B_LED A5
#define SL_LED A2
#define SR_LED A3
#define spoint 90

// Motors //

Servo servo;
AF_DCMotor motor1(1);
AF_DCMotor
motor2(2);
AF_DCMotor
motor3(3);
AF_DCMotor
motor4(4);

void setup() {
Serial.begin(9600);

pinMode(Trig,OUTPUT);//Trig A1
pinMode(Echo,INPUT);//Echo A0
pinMode(F_LED,OUTPUT);//F_LED A4 pin
pinMode(B_LED,OUTPUT);//B_LED A5 pin
pinMode(SL_LED,OUTPUT);//SL_LED A2
pin pinMode(SR_LED,OUTPUT);//SR_LED
A3 pin servo.attach(S_motor);
}

void loop() {

// Change_Mode //

//blutooth_mode();
//obstacle_mode();
voice_control();

// Blutooth_Mode //
void blutooth_mode(){

if (Serial.available() > 0)
{ value = Serial.read();
Stop(); //Initialize with motors stopped.

if (lightFront) {digitalWrite(F_LED, HIGH);


}
if (!lightFront) {digitalWrite(F_LED, LOW);
}
if (lightBack) {digitalWrite(B_LED, HIGH);
}
if (!lightBack) {digitalWrite(B_LED, LOW);
}
if (S_light) {digitalWrite(SL_LED, HIGH);
digitalWrite(SR_LED, HIGH);
}
if (!S_light) {digitalWrite(SL_LED, LOW);
digitalWrite(SR_LED, LOW);
}

switch (value) {
case 'F':forward();break;
case 'B':backward();break;
case 'L':left();break;
case 'R':right();break;
case 'I':forwardRight();break;
case 'G':forwardLeft();break;
case 'J':backwardRight();break;
case 'H':backwardLeft();break;
case 'S':Stop();break;
case '0':speedCar = 75;break;
case '1':speedCar = 100;break;
case '2':speedCar = 125;break;
case '3':speedCar = 150;break;
case '4':speedCar = 175;break;
case '5':speedCar = 200;break;
case '6':speedCar = 220;break;
case '7':speedCar = 230;break;
case '8':speedCar = 240;break;
case '9':speedCar = 250;break;
case 'q':speedCar = 255;break;
case 'W':lightFront = true;break;
case 'w':lightFront =
false;break; case 'U':lightBack =
true;break; case 'u':lightBack =
false;break; case 'X':S_light =
true;break; case 'x':S_light =
false;break;
}}

// Obstacle_Mode //

void obstacle_mode(){

distance = ultrasonic();
if (distance <= 12) {
Stop();
backward();
delay(100);
Stop();
L = leftsee();
servo.write(spoint);
delay(200);
R = rightsee();
servo.write(spoint);
if (L < R) {
O_right();
delay(200);
Stop();
delay(200);
} else if (L > R) {
O_left();
delay(500);
Stop();
delay(200);
}
} else {
forward();
}

// Voice_Control //
void voice_control(){

if (Serial.available() > 0) {
value = Serial.read();
Serial.println(value);
if (value == '^') {
forward();
digitalWrite(SL_LED, HIGH);
digitalWrite(SR_LED,
HIGH);
} else if (value == '-') {
backward();
} else if (value == '<') {
L = leftsee();
servo.write(spoint);
if (L >= 10 ) {
O_left();
delay(500);
Stop();
} else if (L < 10) {
Stop();
}
} else if (value == '>') {
R = rightsee();
servo.write(spoint);
if (R >= 10 ) {
O_right();
delay(500);
Stop();
} else if (R < 10) {
Stop();
}
} else if (value == '*') {
Stop();
}
} else if (value == '!') {
{digitalWrite(F_LED, HIGH);
}
} else if (value == '@') {
{digitalWrite(F_LED, LOW);
}
} else if (value == '+') {
{digitalWrite(B_LED, HIGH);
}
} else if (value == '_') {
{digitalWrite(B_LED, LOW);
}
}

// Ultrasonic //
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 forward()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);

motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
motor4.setSpeed(speedCar);

forwardview();

}
void backward()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);

motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
motor4.setSpeed(speedCar);

digitalWrite(B_LED,HIGH);

}
void left()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
motor4.setSpeed(speedCar);

digitalWrite(SL_LED, HIGH);
leftview();

}
void O_left()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);
motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
motor4.setSpeed(speedCar);

digitalWrite(SL_LED, HIGH);

void right()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
motor4.setSpeed(speedCar);

digitalWrite(SR_LED, HIGH);

rightview();

}
void O_right()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
motor4.setSpeed(speedCar);

digitalWrite(SR_LED, HIGH);
}

void forwardRight()
{
motor1.run(FORWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(RELEASE);

motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);
}

void forwardLeft()
{
motor1.run(RELEASE);
motor2.run(FORWARD);
motor3.run(FORWARD);
motor4.run(FORWARD);

motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor4.setSpeed(speedCar);
}
void backwardRight()
{
motor1.run(BACKWARD);
motor2.run(BACKWARD);
motor3.run(RELEASE);
motor4.run(BACKWARD);
motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor4.setSpeed(speedCar);

digitalWrite(B_LED,HIGH);

}
void backwardLeft()
{
motor1.run(BACKWARD);
motor2.run(RELEASE);
motor3.run(BACKWARD);
motor4.run(BACKWARD);
motor1.setSpeed(speedCar);
motor2.setSpeed(speedCar);
motor3.setSpeed(speedCar);

digitalWrite(B_LED,HIGH);

}
void Stop()
{
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}

int rightsee(){
servo.write(20);
delay(500);
Left = ultrasonic();
return Left;
}

int leftsee(){
servo.write(180);
delay(500);
Right = ultrasonic();
return Right;
}

int leftview(){
servo.write(180);

int rightview(){
servo.write(20);
}

int forwardview(){
servo.write(spoint);
}

You might also like