You are on page 1of 22

VOICE CONTROLLED ROBOTIC VEHICLE

The Egyptian Academy of Engineering and Advanced Technology

MECHATRONICS ENGINEERING

Voice Controlled Robotic Vehicle


NAME ID Team Jobs

1) Ahmed Nasser 2018031 writing the report + Solidworks


and mechanical design

2) Mustafa Shaban Afifi 2018044 Electrical(C Code + circuit


diagram + Simulation )

3) Mohamed Mounir 2018056 writing the report + Solidworks


and mechanical design

4) Ahmed Darwish 2018062 Electrical(C Code + circuit


diagram + Simulation )

Course Title Principles of Mechatronics (MEC 221)

Instructors:

Dr. Mahmoud Abu Hatab


Eng. Islam Mohamed
Spring – (2020-2021)

Page | 1
Introduction
Voice controlled robotic vehicle (VCRV) is just a practical example of controlling motions of a
robot by giving voice commands. These systems are commonly referred to Speech Controlled
Automation Systems (SCAS). In this system, an android application is used as a medium for the
transmission of human commands to microcontroller, a controller can be connected with
Bluetooth.
The main motive to build a VCRV is to analyze the human voice and act according to the
programmed commands. The most basic commands are backward, forward, right, left and also
stop the robot. The vehicle is to be controlled wirelessly with the use of android smartphone; our
aim is to make a robotic vehicle with use of advanced smartphone technology in a very simple
and economic way.
In this project, we will show and discuss our work to design VCRV.

Components
1- TT Gear Motor (4-pieces)

Specifications:
• Voltage: 4- 9 V DC
• No Load Speed: 90 +/- 10rpm
Figure 1 (TT gear motor)
• No Load Current: 190mA (max.250mA)
• Minimum Torque: 800 gm.cm
2- Acrylic sheet (1-piece)
3- DC Motor Driver Shield for Arduino (1-piece)
This motor shield can power up to 4 dc motors, or 2
stepper motors plus 2 servo motors
4- Switch (1-piece)
5- HC-05 Bluetooth Module (1-piece)
6- 9V battery (2-pieces) Figure 2 (Motor driver shield)

7- Battery holder
8- Arduino uno (1-piece)
9- Wheels (4-pieces)

Page | 2
10- Servo motor (1-piece)
Continuous rotation
Operating voltage: 4.8-6.0VDC
Top-operating-speed:60-70RPM(4.8-6.0VDC respectively)
Torque: 1.2-1.5 kg-cm (4.8-6.0VDC respectively)
11- Ultrasonic sensor (1-piece)
Power supply: 5V DC
Quiescent current: <2mA
Effectual angle: <15° Figure 3 (servo motor)

Ranging distance: 2cm – 400 cm


Resolution: 1 cm
Ultrasonic Frequency: 40k Hz
12- Ultrasonic sensor holder (1-piece)
13- Wires

Figure 4 (ultrasonic sensor holder) Figure 5 (Ultrasonic sensor)

Page | 3
Used sensor,Bluetooth Module and Motor Driver
Ultrasonic Sensor HC-SR04 is a sensor that can measure distance. It emits an ultrasound at 40
000 Hz (40 kHz) which travels through the air and if there is an object or obstacle on its path It
will bounce back to the module. Considering the travel time and the speed of the sound you can
calculate the distance.

The configuration pin of HC-SR04 is VCC (1), TRIG (2), ECHO (3), and GND (4). The supply
voltage of VCC is +5V and you can attach TRIG and ECHO pin to any Digital I/O in your
Arduino Board.

Figure 4(ultrasonic sensor)

Page | 4
HC-05 is a Bluetooth device used for wireless communication with Bluetooth enabled devices
(like smartphone). It communicates with microcontrollers using serial communication (USART).

Default settings of HC-05 Bluetooth module can be changed using certain AT commands.

As HC-05 Bluetooth module has 3.3 V level for RX/TX and microcontroller can detect 3.3 V
level, so, there is no need to shift TX voltage level of HC-05 module. But we need to shift the
transmit voltage level from microcontroller to RX of HC-05 module.

Figure 5(Bluetooth module)

Page | 5
The L293D is a dedicated module to fit in Arduino UNO R3 Board, and Arduino MEGA. It is
actually a motor driver shield that has full featured Arduino Shield can be used to drive 2 to 6
DC motor and 4 wire Stepper motor and it has 2 set of pins to drive a SERVO.

L203D is a monolithic integrated that has a feature to adopt high voltage, high current at four
channel motor driver designed to accept load such as relays solenoids, DC Motors and Stepper
Motors and switching power transistor. To simplify to use as two bridges on each pair of
channels and equipped with an enable input. A separate supply input is provided for the logic,
allowing operation at a lower voltage and internal clamp diodes are included. The device is
suitable for use in switching applications at frequencies up to 5 kHz. The L293D is assembled in
a 16 lead plastic package which has 4 centre pins connected together and used for heat sinking.
The L293D is assembled in a 20 lead surface mount which has 8 centre pins connected together
and used for heat shrinking.

Features:

- 2 connections for 5V 'hobby' servos connected to the Arduino's high-resolution dedicated


timer - no jitter!

- Up to 4 bi-directional DC motors with individual 8-bit speed selection (so, about 0.5%
resolution)

- Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil, interleaved or
micro-stepping.

- 4 H-Bridges: L293D chipset provides 0.6A per bridge (1.2A peak) with thermal shutdown
protection, 4.5V to12V

- Pull down resistors keep motors disabled during power-up

- Big terminal block connectors to easily hook up wires (10-22AWG) and power

- 2-pin terminal block to connect external power, for separate logic/motor supplies

-Tested compatible with Mega, UNO


-Dimensions: 69mm x 53mm x 14.3mm (2.7in x 2.1in x 0.6in)

Page | 6
Figure 6(Motor Driver)
Circuit Design

Figure 7(Design on proteus)

Circuit Diagram

Figure 8(Diagram)

Page | 7
Code
#include <AFMotor.h>

#include <Servo.h>

String command;

AF_DCMotor motor1(1, MOTOR12_1KHZ);

AF_DCMotor motor2(2, MOTOR12_1KHZ);

AF_DCMotor motor3(3, MOTOR34_1KHZ);

AF_DCMotor motor4(4, MOTOR34_1KHZ);

Servo myservo;

void setup() {

Serial.begin(9600);

myservo.attach(10);

myservo.write(90);

void loop() {

delay(10);

while(Serial.available()) {

command = "";

command = Serial.readString();

Serial.print(command);

if(command == "*move forward#"){

forward();

Page | 8
}else if(command == "*move backward#"){

backward();

}else if(command == "*turn left#"){

left();

}else if(command == "*turn right#"){

right();

}else if(command == "*stop#") {

Stop();

command = "";

void forward() {

motor1.setSpeed(255);

motor1.run(FORWARD);

motor2.setSpeed(255);

motor2.run(FORWARD);

motor3.setSpeed(255);

motor3.run(FORWARD);

motor4.setSpeed(255);

motor4.run(FORWARD);

delay(1500);

motor1.run(RELEASE);

Page | 9
motor2.run(RELEASE);

motor3.run(RELEASE);

motor4.run(RELEASE);

void backward() {

motor1.setSpeed(255);

motor1.run(BACKWARD);

motor2.setSpeed(255);

motor2.run(BACKWARD);

motor3.setSpeed(255);

motor3.run(BACKWARD);

motor4.setSpeed(255);

motor4.run(BACKWARD);

delay(1500);

motor1.run(RELEASE);

motor2.run(RELEASE);

motor3.run(RELEASE);

motor4.run(RELEASE);

void left() {

myservo.write(180);

delay(500);

Page | 10
myservo.write(90);

delay(500);

motor1.setSpeed(255);

motor1.run(FORWARD);

motor2.setSpeed(255);

motor2.run(BACKWARD);

motor3.setSpeed(255);

motor3.run(FORWARD);

motor4.setSpeed(255);

motor4.run(BACKWARD);

delay(500);

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.setSpeed(255);

Page | 11
motor1.run(BACKWARD);

motor2.setSpeed(255);

motor2.run(FORWARD);

motor3.setSpeed(255);

motor3.run(BACKWARD);

motor4.setSpeed(255);

motor4.run(FORWARD);

delay(500);

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);

Page | 12
Explanation of the code

At first, we defined the 4 motors,After that, we set the baud rate of the
Bluetooth module that we used Via serial.begin command Then the void loop.
parentheses were started We then defined the command variable, which is
equal to four values, and the change between them is done using the switch
case command. We have 4 replace the command variable, the first case, which
is F, which means forward, and the second case is B, which means backward,
and the third is L, which means left, and the last is R It means right and we
explained the structure of the commands in the void loop so that any change
that occurs in the command variable is read because it is equal to any input of
the Bluetooth module by knowing that it is equal to the variable value in the
serial read We set a stop() command to start from the rest state We started by
defining each command in the switch case. First, we defined forward and
determined the maximum forward speed, which is the speed of the motor
clockwise in the forward movement. These were done for each of the four
motors. After that, we identified the second case in the switch case, which is
backward. We defined the maximum speed for each From the four motors
and the direction of movement of the motors in the reverse movement
(counterclockwise) and after that we know the third case, which is left, and
determine the speed and direction of movement of the motors
(counterclockwise) and the fourth case in the switch case which is right, we
have defined the maximum speed and direction The rotational movement of
the motors during this state, and the code had to be terminated by knowing
the state of rest, which was the state present at the beginning, and in the case
of any command in the command variable, and the speed was defined as zero
and that there is no direction for the rotational movement of the motors at
rest.

run(RELEASE)

Page | 13
Mechanical Design on Solidworks

1- Each Part

Figure 9 Figure 10

Figure 11 Figure 12

Page | 14
Figure 13

Figure 14

Figure 15

Page | 15
2-All of the Design

Figure 16

Figure 9 refers to nut

Figure 10 refers to copper spacer 45mm

Figure 11 refers to Acrylic sheet

Figure 12 refers to screw

Figure 13 refers to Acrylic sheet

Figure 14 refers to wheal

Figure 15 refers to dc motor

Figure 16 refers to full design

Page | 16
DC Motor Calculations

Figure 17(calculations for power of the motor)

Page | 17
Stress Analysis for the two plates of the car

Figure 18(stress analysis)

Since maximum stress applied on the car due to the load ( 1.744e+ 04 ) is less than the maximum
yield strength ( 2.000e+07), therefore the Car is suitable for the stresses applied on it.

Page | 18
Time plan
Table 1.

Task no Sun Mon Tues Wed Thu Fri Sat

Task 1

Task 2

Task 3

i.e.. We need 2 days to do the first task ( circuit diagram on proteus


and writing the report ).
We need 3 days to do the second task (drawing on solidworks, making
stress analysis and writing the report ).
We need 4 days to do the last task ( finishing all of the technical
report, making the presentation and making the video ).

Team organization

mechanical electronics Written work


assembly
programing
(mustafa shaban
and ahmed darwish)

mohamed mounir mohamed mounir


ahmed darwish and and ahmed nasser
mohamed mounir mustafa shaban and ahmed nasser
and ahmed nasser

Page | 19
Table of evelation:
Table 2

Name Week 1 Week2 Week3 Week 4 Week 5


Mustafa Selecting Made the Writing C code and Gathering Don’t make a
Shaaban the project circuit make a simulation on information design
diagram proteus and writing
hardware
and the report
simulation

Ahmed Selecting Gathering Gathering Make stress Don’t make a


the project information information and analysis on design
Nasser and writing writing the report the rc car
hardware
the report

Mohamed Selecting Gathering Gathering Make the Don’t make a


the project information information and design on design
Mounir and writing writing the report solidworks
hardware
the report

Ahmed Selecting Made the Check for errors of Gathering Don’t make a
the project circuit simulation information design
Darwish diagram and writing
hardware
and the report
simulation

Page | 20
Link for video

https://drive.google.com/file/d/1U0PAIUlKDKhfo8s464WyECSgwc6OevIs/view

Page | 21

You might also like