0% found this document useful (0 votes)
143 views27 pages

Project 2 Control 4-Wheel Mobile Robot With Android Device Via Bluetooth

This document is a project report for controlling a four-wheel mobile robot with an Android device via Bluetooth. It discusses the hardware and software design of the robot, which includes components like a power supply, motor driver, microcontroller, Bluetooth module, and Android app. The report aims to allow user control of the robot's movement through a smartphone and test if the system meets the goal of remote control via Bluetooth. Some limitations of the current design are also noted.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
143 views27 pages

Project 2 Control 4-Wheel Mobile Robot With Android Device Via Bluetooth

This document is a project report for controlling a four-wheel mobile robot with an Android device via Bluetooth. It discusses the hardware and software design of the robot, which includes components like a power supply, motor driver, microcontroller, Bluetooth module, and Android app. The report aims to allow user control of the robot's movement through a smartphone and test if the system meets the goal of remote control via Bluetooth. Some limitations of the current design are also noted.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

HANOI UNIVERSITY OF SCIENCE AND TECHNOLOGY

SCHOOL OF ELECTRICAL ENGINEERING


====o0o====

REPORT OF PROJECT 2
PROJECT NAME:
CONTROL FOUR-WHEEL MOBILE ROBOT WITH
ANDROID DEVICE VIA BLUETOOTH

Project Supervisor: M.S. Đinh Thi Lan Anh


Project Reporter: Nguyen Thanh Nam
Student ID: 20181909
Class: Advanced Program for Electrical Engineering
and Automation 01 K63

HA NOI, 1/2021
Preface

With the development of technology, the implementation of self-driving vehicles has


become one of the most well-known issues which has drawn a great amount of interest
from researchers and engineers around the world. As a branch in the application of
autonomous vehicles, Wheeled Mobile Robots (WMR) is considered the most widely used
type of mobile robot. Therefore, I decided to select the topic "Control 4-wheel mobile robot
with Android device via Bluetooth" for the project. In this project, I desire to design a 4-
wheel WMR which is controlled by user through a android smart phone and bluetooth
connection.
After a complete deployment of the system, the robot satisfied my desire as from the
beginning. With a view to expanding the application scope of the system, it can be said that
the solution is plausible for the deployment in several certain environment such as
household or offices. However, there are still several limitations for the implementation of
the system.
During my research, I would like to sincerely thank teacher M.S. Đinh Thi Lan Anh for
helping me a lot in the process of researching, designing and completing this project.
Due to limited knowledge of the first time doing a project, it is inevitable that there will be
shortcomings and limitations, so I am looking forward to getting suggestions and reminders
from teacher to complete my project.
Sincerely thanks!

Performing student

Nguyen Thanh Nam

2
TABLE OF CONTENTS

CHAPTER 1. INTRODUCTION ABOUT THE WHEELED MOBILE ROBOT


(WRM) 6
1.1 Overview about the Wheeled Mobile Robot (MWR) 6
1.1.1 The Mobile Robot 6
1.1.2 The Wheeled Mobile Robot 8
1.2 Model of the Wheeled Mobile Robot 9
1.2.1 Kinematics Model 10
1.2.2 Dynamics Model 11
CHAPTER 2. HARDWARE INPLEMENTATION OF THE WMR 12
2.1 Technical Specifications 12
2.2 Block Diagrams 12
2.3 Hardware Design 13
2.3.1 Power Supply 13
2.3.2 Motor Driver 13
2.3.3 Motor 14
2.3.4 Microcontroller 15
2.3.5 Communication 17
2.3.6 Overall Hardware Structure and Funding for the Project 18
CHAPTER 3. SOFTWARE DESIGN AND TEST RUNNING 20
3.1 Software Design 20
3.1.1 Main Program for the project 20
3.1.2 Android app 21
3.2 Coding 22
3.3 Test running 25
CHAPTER 4. CONCLUSION 26
REFERENCES 27

3
LIST OF FIGURES

Figure 1.1. UAV is used to carry cargo in Turkey 6

Figure 1.1. Robotic arm is used to carve wood 7

Figure 1.2. Legged robot with 6 legs inspired by insects 7

Figure 1.3. Robot with tracks used to defuse bombs 8

Figure 1.4. The first WMR designed by W. Grey Walter 8

Figure 1.5. The mobile robot ‘Curiosity’ 9

Figure 1.6. Industrial-used WMR for transporting goods 9

Figure 1.7. The Model of a Wheeled Mobile Robot (WMR) 10

Figure 2.8. Block Diagram of the WMR 12

Figure 2.2. Lithium Icr18650 batteries 13

Figure 2.9. The Motor Driver Module L298N 14

Figure 2.10. The schematic of the Motor Driver L298N 14

Figure 2.5. The 1:48 geared DC motor 15

Figure 2.6 Board Arduino Uno R3 16

Figure 2.7 Parts of Arduino Uno R3 16

Figure 2.8. The Bluetooth Module HC-05 18

Figure 2.9. The full 4-wheel WMR after assembling components 19

Figure 3.1. Flow chart of the main program for the robot 20

4
LIST OF TABLES
Table 2.1. Technical specifications for the WMR 12

Table 2.2. Specifications of the Lithium battery Icr18650 13

Table 2.3. Specifications of the Motor Driver L298N 13

Table 2.4. Specifications of the 1:48 geared DC motor 15

Table 2.5. List of components used in the Hardware Design and funding 18
for the project

Table 3.1. List of commands from the Android app 21

5
CHAPTER 1. INTRODUCTION ABOUT THE WHEELED MOBILE
ROBOT (WRM)
1.1 Overview about the Wheeled Mobile Robot (MWR)
It is considered that Wheeled Mobile Robot is a branch in the research and application of
Mobile Robot. Simply put, a wheeled mobile robot (or WMR in short) is a mobile robot
which utilizes the use of wheel(s). Therefore, an understanding about the Mobile Robot
could be an appropriate approach for a throughout research of the WMR.

1.1.1 The Mobile Robot


a) Definition of Mobile Robot
Derived from the definition of the word ‘robot’ and the word ‘mobile’, the definition of a
mobile robot could be stated as follows.
Mobile robot is a type of equipment containing mechanical and electrical components
having the capability to move in an environment, which is used to replace human labor to
perform some certain tasks.
Indeed, the difference between the mobile robot and other types of robots comes from the
ability to move and travel to different positions or places, which is the definition of the
word ‘mobile’ itself. Although this feature may be limited to be in the surrounding – a
rather relative term as the area could vary from, for example, several cm2 to several km2,
the location of the mobile robot is not fixed.
A demonstration of this feature could be seen in a comparison between an unmanned aerial
vehicle (UAV) and a robotic arm (a type of stationary robot). While the structure of an
UAV and the robotic arm are somewhat similar in the sense that they both consists of
mechanical and electrical links and actuators, the UAV could travel distances in the sky,
contrasting to the robotic arm being fixed in a specific location in a factory.

Figure 1.1. UAV is used to carry cargo in Turkey. Source: https://www.dailysabah.com/

6
Figure 1.2. Robotic arm is used to carve wood. Source: https://designrobotics.net/

b) Classification of Mobile Robot


Mobile Robots are categorized based on two criteria, which is the working environment of
the robot of its actuator it used to move.
Regarding the first criterion, there are five types of mobile robots:
- Robots working on land or at home, which is usually referred to as Unmanned
Ground Vehicles (UGVs).
- Robots transporting or delivering materials and supplies in a factory or similar
working environment.
- Aerial Robots, normally called Unmanned Aerial Vehicles (UAVs) or drones.
- Underwater Robots, which is usually called Autonomous Underwater Vehicles
(AUVs).
- Polar Robots, which is implemented to navigate icy environment, such as the North
Pole or the South Pole.
On the other hand, types of Mobile Robots can be into three categories based on their
actuators:
- Legged Robot (human-like legs using in an android or animal-like ones).
- Wheeled Robot.
- Tracks.

-
Figure 1.3. Legged robot with 6 legs inspired by insects. Source: https://newatlas.com/

7
-
Figure 1.4. Robot with tracks used to defuse bombs. Source: http://www.igrnews.com/

1.1.2 The Wheeled Mobile Robot


As mentioned in the beginning of this chapter as well as in the section above, Wheeled
Mobile Robot falls into the category of mobile robot using wheels to move in the working
space.

Ever since the first implementation of wheeled mobile robots, namely Elmer and Elsie, in
the late 1940s by neurobiologist W. Grey Walter, WMRs had been a subject of great
interests for both researching purposes and application.

Figure 1.5. The first WMR designed by W. Grey Walter. Source: http://www.theoldrobots.com/

During the process of working on the thesis, the team has read a certain number of articles
and books which study about algorithms, models, and control schemes etc. of the WMR.
Moreover, it could be argued that the scope of application of WMRs is wide, ranging from
outer space to factories and to even households. To begin with, a well-known
implementation of WMR could be ‘Curiosity’ – a car-sized mobile robot launched by
NASA in 2011 for the purpose of exploration on Mars. Additionally, industrial WMRs
could also be implemented for transportation of goods or materials. Lastly, in the form of
vacuum robots, WMRs had taken a part in the daily life of many citizens around the world.

8
Figure 1.6. The mobile robot ‘Curiosity’. Source: https://mars.nasa.gov/

Figure 1.7. Industrial-used WMR for transporting goods. Source: https://www.controleng.com/

In conclusion, in this section, I have introduced some basic information about the definition
of the wheeled mobile robot, which is based on the definition of mobile robot, as well as
some of the application of the WMR for researching or for commercial purposes. However,
before being able to implement a WMR for any abovementioned purposed, ones should
acquire a decent amount of knowledge about the system of an WMR. Therefore, in the
following section, the modelling of the WMR – one of the most essential parts – will be
discussed.

1.2 Model of the Wheeled Mobile Robot


Ones visually observe the operation of a WMR may think this is a rather easy task given
the fact that it is just about controlling wheels to move. Nonetheless, in the perspective of
an engineer, the control of a WMR is far more complicated than controlling wheels
(although controlling wheels is not a simple task, either). Before any control schemes could
be applied, the engineer must beforehand determine the relation of the WMR with its
working space as well as that with its actuators, which is motors and wheels in this case.
With this view, mathematical models of the WMR are derived to correctly represent those
relations.

9
Figure 1.8. The Model of a Wheeled Mobile Robot (WMR)

The working plane of the WMR is represented by a global coordinate (Xg, Yg) and a
moving plane (Xm, Ym) attached to the robot. Consequently, the pose of the robot in the
plane is defined by its state vector:
𝒙𝒙(𝒕𝒕)
𝒒𝒒(𝒕𝒕) = � 𝒚𝒚(𝒕𝒕) � (𝟏𝟏. 𝟏𝟏)
𝝋𝝋(𝒕𝒕)

where x(t) and y(t) are the position of the vehicle in global coordinate (Xg, Yg), and φ(t)
is the angle between the direction the mobile robot is moving and the global x-axis.
Noted that both main wheels have to be placed on a common axis and be controlled by
separate motors. The third wheel is under the control of no motor and can move freely.
Other variables in the system worth to be noticed are as follows: r is the wheel radius, L is
the distance between two wheels on the axis, R(t) is the instantaneous radius of the vehicle
on its trajectory, and d is the distance between the common axis and the third wheel [1].
1.2.1 Kinematics Model
Since each wheel is controlled by an independent motor, the relation between the linear
velocity and angular velocity and the angular velocity of both wheels is described [1] as:
𝑟𝑟 𝑟𝑟
𝑣𝑣(𝑡𝑡 ) 𝜔𝜔 (𝑡𝑡 )
ɳ(𝑡𝑡 ) = � � = �−2𝑟𝑟 2
𝑟𝑟 � � 𝐿𝐿 � (1.2)
𝜔𝜔(𝑡𝑡 ) 𝜔𝜔𝑅𝑅 (𝑡𝑡 )
𝐿𝐿 𝐿𝐿
The relation of the position q(t) of the WMR with its velocity ɳ(t) is:
𝑥𝑥̇ cos(𝜑𝜑) 0
𝑣𝑣
𝑞𝑞̇ (𝑡𝑡 ) = � 𝛾𝛾̇ � = � sin(𝜑𝜑) 0� �𝜔𝜔� (1.3)
𝜑𝜑̇ 0 1
According to the non-linear characteristics of the WMR, the motion constraint of the
system is nonholonomic and can be represented as:
− 𝑥𝑥̇ × sin(𝜑𝜑) + 𝑦𝑦̇ × cos(𝜑𝜑) = 0 (1.4)
The constraint coefficient matrix is derived from the nonholonomic constraint above as:

10
𝐴𝐴 = [− sin(𝜑𝜑) cos(𝜑𝜑) 0] (1.5)

1.2.2 Dynamics Model


Based on the Lagrange equation, which is:
𝑚𝑚
𝑑𝑑 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕 𝜕𝜕𝜕𝜕
� �− + = 𝑓𝑓𝑘𝑘 − � 𝜆𝜆𝑗𝑗 𝑎𝑎𝑗𝑗𝑗𝑗 (1.6)
𝑑𝑑𝑑𝑑 𝜕𝜕𝑞𝑞̇ 𝑘𝑘 𝜕𝜕𝑞𝑞𝑘𝑘 𝜕𝜕𝑞𝑞̇ 𝑘𝑘
𝑗𝑗=1

where the unknown disturbance 𝜏𝜏𝑑𝑑𝑑𝑑 is omitted. Furthermore, since the WMR is assumed
to work on an equipotential plane, the forces and torques acting on the vehicles by the
influence of gravitation 𝑔𝑔𝑘𝑘 are also not present.
Therefore, the dynamic model written in matrix form can be obtained [1] as:
𝑀𝑀(𝑞𝑞)𝑞𝑞̈ + 𝑉𝑉 (𝑞𝑞, 𝑞𝑞̇ ) + 𝐹𝐹 (𝑞𝑞̇ ) = 𝐸𝐸 (𝑞𝑞) × 𝑢𝑢 − 𝐴𝐴𝑇𝑇 (𝑞𝑞) × 𝜆𝜆 (1.7)
where matrices are
𝑚𝑚 0 0
𝑀𝑀 = � 0 𝑚𝑚 0� (1.8)
0 0 𝐽𝐽
cos(𝜑𝜑) cos(𝜑𝜑)
1 sin(𝜑𝜑) sin(𝜑𝜑)
𝐸𝐸 = � � (1.9)
𝑟𝑟 𝐿𝐿 𝐿𝐿

2 2
𝐴𝐴 = [− sin(𝜑𝜑) cos(𝜑𝜑) 0] (1.10)
𝜏𝜏𝑅𝑅
𝑢𝑢 = � 𝜏𝜏 � (1.11)
𝐿𝐿

and the remaining ones are zero.

11
CHAPTER 2. HARDWARE INPLEMENTATION OF THE WMR
2.1 Technical Specifications
The technical specifications for the WMR is
No. Parameters Symbols Value Unit
1 Operating voltage 12 Vdc
2 Maximum Speed (no -load) 0.8 m/s
3 Size (Length x Width x Height) - 196x211x138 mm
4 Weight m 1.008 kg
5 Distance between two wheels on the axis L 0.185 m
6 Wheels’ Radius r 0.03 m

2.2 Block Diagrams

Figure 2.1. Block Diagram of the WMR

The Block Diagram illustrates basic parts of the vehicle and the interaction between them.
Specifically, the whole WMR including a microprocessor, the motor driver, two motors
(left and right), a bluetooth receiver. The microprocessor receives the command from
Android phone and send control signal to the motor driver so as to control the whole mobile
robot.

12
2.3 Hardware Design
Derived from the Specifications and the Block Design mentioned in previous sections,
components in each block are selected as below. However, since available components
purchased in the market are not authentic, the outcome product may not meet the desired
specifications.
2.3.1 Power Supply
The power of the vehicle is supplied using a series of three Lithium rechargeable batteries
Icr18650.
Table 2.2. Specifications of the Lithium battery Icr18650
Parameter Value Unit
Supply Voltage 3.6-4.2 V
Power Capacity 2600 mAh
Maximum Discharge Current 15 A

Figure 2.2. Lithium Icr18650 batteries

2.3.2 Motor Driver


The Module applied in this block is the Motor Driver Module L298N
Table 2.1. Specifications of the Motor Driver L298N
Parameter Value Unit
Motor Supply Voltage (Maximum) 46 V
Motor Supply Current (Maximum) 2 A
Logic Voltage 5 V
Driver Voltage 5-35 V
Driver Current 2 A
Logical Current 0-36 mA
Maximum Power 25 W

13
Figure 2.3. The Motor Driver Module L298N

The L298N is a dual-channel H-Bridge motor driver capable of driving a pair of DC


motors. That means it can individually drive up to two motors making it ideal for building
two-wheel robot platforms.
Internal circuit diagram of L298N Motor Driver module is given below:

Figure 2.4. The schematic of the Motor Driver L298N

In order to have a complete control over DC motor, I have to control its speed and rotation
direction. This can be achieved by combining these two techniques:
- PWM – For controlling speed.
- H-Bridge – For controlling rotation direction.

2.3.3 Motor
After comparing several types of motor on the market, I decided to choose the 1:48 geared
DC motor (Smart Car Robot Plastic Tire Wheel with DC 3-6v Gear Motor for arduino) is
the most chosen and used type today for simple robot designs.

14
Figure 2.5. The 1:48 geared DC motor

Below are some parameters of the motor:


- Tire Parameter Center hole: 5.3MM x 3.66MM
- Wheel size: 65x26mm
- Motor Weight: (g) 50
- Motor Size: 70mm*22mm*18mm
- Noise: <65dB.
Table 2.4. Specifications of the 1:48 geared DC motor
Parameter Value Unit
Working Voltage 3-6 VDC
Working Current 100-120 mA
Reduction Rate (with tire) 48:1 RPM
Speed (for wheel size 65x26mm) 20-48 m/minute

2.3.4 Microcontroller
In this project, I choose the Arduino Uno R3 Module to control the WMR because it has
itself an extremely easy-to-use application development environment, with a very simple
programming language. Also, it has a very low price and the open-source hardware and
software.

15
Figure 2.6 Board Arduino Uno R3
Arduino Uno R3 board‘s central processing unit is an AVR microcontroller Atmega328.
The main structure of Arduino Uno includes the following parts:
- USB plug: This is the communication port for us to upload code from the PC to
the microcontroller. It is also the serial communication for data transmission between the
microcontroller and the computer.
- Power plug: to run the Arduino, we can power it with the USB port above, but in
other cases when we can’t connect it to the computer, we can use a source of 9V to 12V
instead.
- There are 14 input / output pins numbered from 0 to 13, beside that, there is a
grounding pin (GND) and a reference voltage pin (AREF).
- AVR microcontroller: this is the central processing unit of the entire board. With
each Arduino model there are different chips. In this Arduino Uno we use ATMega328.

Figure 2.7 Parts of Arduino Uno R3

16
- The detailed parameters of Arduino Uno:

Processor: ATmega328
Operating voltage: 5V
Input voltage (operational): 7-12V
Input voltage (limit): 6-20V
Digital I/O pins: 14
Analog input pins: 6
Maximum current in each pin: 40mA
Current in pin 3.3V: 50mA
Flash memory: 32 KB (ATmega328)
SRAM: 2 KB (ATmega328)
EEPROM: 1 KB (ATmega328)
Clock: 16MHz

2.3.5 Communication
a) Bluetooth connection
Bluetooth communication is RF communication based on 2.4 GHz frequency with range
of about 10 meters. This is one of the most common and very commonly used interfaces in
data transmission over short distances, in audio systems, in hands-free devices, computer
peripherals, etc.
For the purpose of communication between Android phone and Arduino, in this project I
choose Bluetooth connections because of its convenience.
b) Module Bluetooth HC-05
The HC-05 Bluetooth module is the device of choice for implementing projects based on
Bluetooth communication. The HC-05 Bluetooth module is a simple wireless
communication device based on the Bluetooth protocol.
This module is based on the BC417 single chip Bluetooth IC which complies with the
Bluetooth v2.0 standard and supports both UART and USB interfaces.
Generally speaking, the HC-05 Bluetooth module, or HC-05 sub-module, to be precise,
comes with the BC417 IC along with the flash memory. Such modules come as surface
mount boards, and some third party manufacturers use this board to build a more complete
system with the necessary pins and parts.
HC-05 pinout:
- KEY: this pin is used to select AT Mode or Data Mode
- VCC: this pin can supply power from 3.6V to 6V inside the module, which has a
source ic converted to 3.3V voltage and supplied to IC BC417
- GND (Mass): connected to the source pin GND

17
- TXD, RND: these are two UART pins for module communication operating at
3.3V . logic level
- STATE: this is a status indicator pin. This pin is LOW when the module is not
connected to any device. When the module is paired with any device, this pin will
be HIGH..

Figure 2.8. The Bluetooth Module HC-05

Some default settings of the HC-05 Bluetooth module are:


- Name: HC-05
- Password: 1234 (or 0000)
- Type: Slave
- Mode: Data
- Baud rate: 9600 with 8 data bits, no parity bit and 1 stop bit

2.3.6 Overall Hardware Structure and Funding for the Project


The hardware of the WMR is designed based on the Block Diagram and the list of
components selected in the Components Selection.

Table 2.5. List of components used in the Hardware Design and funding for the project

No. Name of the Component Quantity Price (VND) Value (VND)


1 Board Arduino Uno R3 1 110.000 110.000
2 4 Wheel Robot Smart Car Chassis 1 80.000 80.000

3 Motor Driver L298N 1 30.000 30.000


4 Module Bluetooth HC-05 1 30.000 30.000

5 Lithium Rechargeable Battery 3 100.000 100.000


Icr18650 (base included)
6 1:48 geared DC motor (and wheel) 4 25.000 100.000
Total 450.000

18
Figure 2.9. The full 4-wheel WMR after assembling components

19
CHAPTER 3. SOFTWARE DESIGN AND TEST RUNNING
3.1 Software Design
3.1.1 Main Program for the project

Start

Read data from


Bluetooth connection

Switch (command?)

Yes Go forward for


Equal to ‘F’ Break;
150ms then stop
No

Yes Go backward for


Equal to ‘B’ Break;
150ms then stop

No

Yes Left turn for


Equal to ‘L’ Break;
100ms then stop

No

Yes Right turn for


Equal to ‘R’ Break;
100ms then stop

No

Yes Go forward until


Equal to ‘A’ Break;
user say “Stop”

No

Yes Go backward until


Equal to ‘C’ Break;
user say “Stop”

No

Default Stop Break;

20
Above is the Flow chart of the main program for the robot to be controlled by bluetooth.
Signal “command” is received by the Arduino from Android phone through bluetooth.
In this situation, I consider that the robot need to have the states of “go forward or backward
until user say stop” in case the road is far, the users will not have to do too many operations.
After uploading the code to the Arduino, my final purpose is that the robot can be controlled
manually remotely via an Android phone.
3.1.2 Android app
Regarding the user interface, I use an application available on Google Play called "Arduino
Bluetooth Controller" released by Giumig Apps.

Figure 3.2. Interface of the application to control the robot via bluetooth
The commands that the app send to the Arduino is following:

Button Command

21
A

Other buttons No command

3.2 Coding
Below is the full coding for the robot:
#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // TX | RX


int command ;
void setup() {
mySerial.begin(9600); //begin the Serial connection
pinMode(7,OUTPUT); //left motors forward
pinMode(6,OUTPUT); //left motors reverse
pinMode(5,OUTPUT); //right motors forward
pinMode(4,OUTPUT); //right motors reverse

void forward (){


digitalWrite(7,HIGH);
digitalWrite(6,LOW);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
}

void backward (){


digitalWrite(7,LOW);
digitalWrite(6,HIGH);
22
digitalWrite(5,LOW);
digitalWrite(4,HIGH);
}

void turnleft (){


digitalWrite(7,LOW);
digitalWrite(6,HIGH);
digitalWrite(5,HIGH);
digitalWrite(4,LOW);
}

void turnright (){


digitalWrite(7,HIGH);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(4,HIGH);
}

void stopmoving (){


digitalWrite(7,LOW);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(4,LOW);
}

void loop() {
if (mySerial.available()) //check if Serial connection is working or not
{
command=(mySerial.read()); //read the command from Serial connection
switch(command){
case 'F':
forward();

23
delay(150);
stopmoving();
break;
case 'B':
backward();
delay(150);
stopmoving();
break;
case 'L':
turnleft();
delay(100);
stopmoving();
break;
case 'R':
turnright();
delay(100);
stopmoving();
break;
case 'A': //the case robot go forward until "Stop" button is pressed
forward();
break;
case 'C': //the case robot go backward until "Stop" button is pressed
backward();
break;
case 'S':
stopmoving();
break;
}
}
}

24
3.3 Test running
After programming and assembling the robot, I tested it and achieved my initial wishes.
Video of the robot's test run can be accessed at the following link: bit.ly/4wWMRtestrun.

25
CHAPTER 4. CONCLUSION

The thesis "Control 4-wheel mobile robot with Android device via Bluetooth" has
enhanced and reinforced my understandings about previous courses such as Digital
Control, Control Theory etc. In detail, I have studied about the system presenting a WMR,
its operation as well as its control schemes. Regarding the software, I have written a C
program for the vehicle to be mannually controlled from distance through bluetooth
connection. Moreover, I have also gained more experience on researching techniques, and
time management to achieve optimization on project execution.
However, due to several hardware imperfections as well as my poor knowledge about
control theory and programming, the mobile robot doesn’t work so smoothly and precisely.
On the other hand, the current research could set a foundation for the development of the
system to one with better accuracy and stability. My plans for future improvement are to
upgrade the hardware as well as to control the trajectory of the robot to reach the desire
coordinates automatically.
Obviously, I cannot overcome all difficulties and realize the thesis on our own because of
lack of experience. I would like to sincerely thank teacher M.S. Dinh Thi Lan Anh for
helping me a lot in the process of researching, designing and completing this project.
Lastly, I hereby declare that the project work entitled "Control 4-wheel mobile robot with
Android device via Bluetooth", submitted to M.S. Dinh Thi Lan Anh in Hanoi University
of Science and Technology is prepared by my own efforts.

26
REFERENCES

[1] Massimo Banzi, Getting Started with Arduino, O’Reilly Media, Inc, 2009.
[2] Michael Margollis and Nicholas Weldin, Arduino Cookbook, O’Reilly Media, Inc,
2011.
[3] http://arduino.cc .
[4] http://arduino4projects.com .
[5] http://randomnerdtutorials.com .
[6] http://techshowvn.com .
[7] http://www.airspayce.com/mikem/arduino/RF22/
[8] http://groups.google.com/group/rf22-arduino/
[9] J. Borenstein, H. R. Everett, L. Feng and D. Wehe, "Mobile Robot Positioning - Sensors
and Technique," Journal of Robotic Systems, vol. 14, no. 4.
[10] G. Klancar, A. Zdesar, S. Blazic and I. Skrjanc, Wheeled Mobile Robotics, Elsvier,
2017.

27

You might also like