Project 2 Control 4-Wheel Mobile Robot With Android Device Via Bluetooth
Project 2 Control 4-Wheel Mobile Robot With Android Device Via Bluetooth
REPORT OF PROJECT 2
PROJECT NAME:
CONTROL FOUR-WHEEL MOBILE ROBOT WITH
ANDROID DEVICE VIA BLUETOOTH
HA NOI, 1/2021
Preface
Performing student
2
TABLE OF CONTENTS
3
LIST OF FIGURES
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.5. List of components used in the Hardware Design and funding 18
for the project
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.
6
Figure 1.2. Robotic arm is used to carve wood. Source: https://designrobotics.net/
-
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/
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/
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.
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)
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)
𝐿𝐿
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
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
13
Figure 2.3. The Motor Driver Module 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
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.
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..
Table 2.5. List of components used in the Hardware Design and funding for the project
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
Switch (command?)
No
No
No
No
No
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
3.2 Coding
Below is the full coding for the robot:
#include <SoftwareSerial.h>
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