Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

University Of Engineering And Technology Lahore

EMBEDED SYSTEM LAB


PROJECT REPORT
VOICE CONTROL ROBOT & OBSTACLE AVOIDANCE PROJECT
SUBMITTED TO: ENGR. IRZAM SHAHID

SUBMITTED BY: M.TALHA 2018-EE-503

ALI RAZA 2018-EE-506

HUZAIFA AZHAR 2018-EE-538

Department Of Electrical Engineering

RAchna college of engineering and technology gujranwala

Introduction:
The robot will be based on microcontroller Arduino Uno because of its versatile features
along with numerous advantages. The system will utilize Bluetooth technology and
Standard communication interface known as SPI interface. Bluetooth uses radio waves with
safe, less power consuming device to connect and exchange data between devices
without using of any kind of physical contact like wires and cable . SPI interface is a
synchronous serial information processutilized by microcontrollers for interacting along
with one or more peripheral devices swiftly through limited ranges.

Working Principle:
The movement of the proposed robot will be controlled by the voice command of the
user. The user will use an android operated smart phone to give voice command. The
command can be fetched using an app which will convert the voice command into text.
The phone will be connected to the microcontroller using a Bluetooth module. After
conversation of the voice command into text the app will send necessary data to the
microcontroller using Bluetooth of the phone and microcontroller will receive the data
using Bluetooth module. According to the command, the robot will move forward, backward,
left, right or fully autonomous. For driving the robot there will be four geared DC motors
with gripped tyre which will be operated by the help of DC motor driver. An ultrasonic sensor
will be employed for obstacle detection during autonomous mode. Arduino Uno will send
signals according to reading of the ultrasonic sensor to provide data about any obstacle in
front of the robot within a specific range. There will be a command for stopping the robot at
instan.

Components Required:
 Arduino Uno
 Arduino Cable
 Motor Driver Module (L293D)
 Motors – 4
 Robot Chassis
 Wheels – 4
 Proximity IR Sensor
 Bluetooth module (HC-05)
 Connecting wires
 18650 battery and connector
 DC Switch
 Arduino Mobile App
 Ultrasonic Sensor
 Servo Motor
Hardware Details:

Arduino Uno
Arduino is an Open-source-electronic-prototyping-base for simple used hardware and software
in the field of micro-controlling. Arduino Uno has 14 digital I/O pins and 6 analog I/O pins

L293D Motor Driver Module:


It is a motor driver which can provide bi-directional drive current for two motors. It is a 16 Pin
with 4 inputs from micro-controller and 4 output pins to the motors (2 each).

Circuit Diagram:
Working:

 This is a simplified version of any other voice control robot.


 No complex coding, easy to understand coding with simpler algorithm.
 Download Voice Control Arduino App to connect with Bluetooth module.
 The app is developed in such a way that it converts the voice command to text and
transfer the text to the connected Bluetooth device.
 The Bluetooth connected on the Arduino board receives text from the Android app as
characters and stored them as string to the assigned String.
 There are words pre-programmed (move forward, move backward, right , left and stop)
to the Arduino , whenever the received text matches with the pre-programmed words
,the Arduino executes the command that assigned to the words.
 Arduino can connect to Laptop to monitor serial communication and check the working
process and the words received by the Bluetooth.

Code:
// Arduino Obstacle Avoidance + Voice Control Robot

#include <AFMotor.h>

#include <NewPing.h>

#include<Servo.h>

#define TRIGGER_PIN A1

#define ECHO_PIN A0

#define MAX_DISTANCE 300

#define IR A5

AF_DCMotor motor1(1, MOTOR12_1KHZ);

AF_DCMotor motor2(2, MOTOR12_1KHZ);

AF_DCMotor motor3(3, MOTOR34_1KHZ);

AF_DCMotor motor4(4, MOTOR34_1KHZ);


NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);

Servo myservo;

String voice;

void setup() {

Serial.begin(9600);

myservo.attach(10);

myservo.write(90);

pinMode(IR, INPUT);

void loop() {

int distance = sonar.ping_cm();

//int IR1 = digitalRead(IR);

//Serial.println(IR1);

if(Serial.available()>0) {

voice="";

delay(2);

voice = Serial.readString();

delay(2);

Serial.println(voice);

if (voice == "turn left") {

left();

}else if (voice == "left") {

left();

}else if(voice == "turn right") {


right();

}else if(voice == "right") {

right();

while(voice == "move forward") {

forward();

while(voice == "move backward") {

backward();

void forward() {

int distance = sonar.ping_cm();

if(distance < 10){

Stop();

voice="";

}else {

motor1.setSpeed(255);

motor1.run(FORWARD);

motor2.setSpeed(255);

motor2.run(FORWARD);

motor3.setSpeed(255);

motor3.run(FORWARD);

motor4.setSpeed(255);

motor4.run(FORWARD);

}
}

void backward() {

int IR_Sensor = digitalRead(IR);

if(IR_Sensor == 0) {

Stop();

voice="";

}else {

motor1.setSpeed(255);

motor1.run(BACKWARD);

motor2.setSpeed(255);

motor2.run(BACKWARD);

motor3.setSpeed(255);

motor3.run(BACKWARD);

motor4.setSpeed(255);

motor4.run(BACKWARD);

void left() {

myservo.write(180);

delay(500);

myservo.write(90);

delay(500);

motor1.run(BACKWARD);

motor1.setSpeed(255);

motor2.run(BACKWARD);

motor2.setSpeed(255);
motor3.run(FORWARD);

motor3.setSpeed(255);

motor4.run(FORWARD);

motor4.setSpeed(255);

delay(700);

motor1.run(RELEASE);

motor2.run(RELEASE);

motor3.run(RELEASE);

motor4.run(RELEASE);

void right() {

myservo.write(0);

delay(500);

myservo.write(90);

delay(500);

motor1.run(FORWARD);

motor1.setSpeed(255);

motor2.run(FORWARD);

motor2.setSpeed(255);

motor3.run(BACKWARD);

motor3.setSpeed(255);

motor4.run(BACKWARD);

motor4.setSpeed(255);

delay(700);

motor1.run(RELEASE);

motor2.run(RELEASE);
motor3.run(RELEASE);

motor4.run(RELEASE);

void Stop() {

motor1.run(RELEASE);

motor2.run(RELEASE);

motor3.run(RELEASE);

motor4.run(RELEASE);

Final Image:

You might also like