VIETNAM NATIONAL UNIVERSITY, HO CHI MINH CITY
UNIVERSITY OF INFORMATION TECHNOLOGY
FACULTY OF COMPUTER ENGINEERING
NGUYEN XUAN HAI
TRAN GIA KIET
CAPSTONE PROJECT
INCLINATION ESTIMATION SYSTEM MODEL DESIGN
THIẾT KẾ MÔ HÌNH HỆ THỐNG ƯỚC LƯỢNG ĐỘ NGHIÊNG
MIDTERM CAPSTONE PROJECT REPORT
HO CHI MINH CITY, 2023
1
VIETNAM NATIONAL UNIVERSITY, HO CHI MINH CITY
UNIVERSITY OF INFORMATION TECHNOLOGY
FACULTY OF COMPUTER ENGINEERING
NGUYEN XUAN HAI – 21522035
TRAN GIA KIET - 21522264
CAPSTONE PROJECT
INCLINATION ESTIMATION SYSTEM MODEL DESIGN
THIẾT KẾ MÔ HÌNH HỆ THỐNG ƯỚC LƯỢNG ĐỘ NGHIÊNG
MIDTERM CAPSTONE PROJECT REPORT
MENTOR
Ph.D. TRI NHUT DO
HO CHI MINH CITY, 2023
VIETNAM NATIONAL UNIVERSITY SOCIALIST REPUBLIC OF VIETNAM
2
HO CHI MINH CITY Independence – Freedom - Happiness
UNIVERSITY OF INFORMATION
TECHNOLOGY
DETAILED TOPICS
VIETNAMESE PROJECT NAME: THIẾT KẾ MÔ HÌNH HỆ THỐNG ƯỚC
LƯỢNG ĐỘ NGHIÊNG
ENGLISH PROJECT NAME: INCLINATION ESTIMATION SYSTEM MODEL
DESIGN
Instructor Ph.D. Tri Nhut Do, Faculty of Computer Engineering
Implementation time: From 02/10/2023 To 20/11/2023
Student Perform: NGUYEN XUAN HAI - 21522035 TRAN GIA KIET -
21522264
Overview of the topic: Design an inclination estimation system model with IMU
The goal of the subject. Learn how to apply IMU technology to create utility
systems
Methods of implementation: Model Design
3
Main contents of the topic: Design an inclination estimation system model with IMU
Certification of Instructor HCM City, 2023 October 8th
(Sign and clearly state full name) Student
(Sign and clearly state full name)
TABLE OF CONTENTS
Chapter 1. INTRODUCTION…………………………………………………………………..7
- Abstract…………………………………………………………………………………………….7
- Introduction………………………………………………………………………………………..7
- Overview…………………………………………………………………………………………...7
Chapter 2. THEORY BASIS ……………………………………………………………………………………………..8
2.1. Error! Bookmark not defined.
2.2 Arduino Uno R3:..………………………………………………………………………......8
2.3. Error! Bookmark not defined.
4
Chapter 3. ....................................................................................... Error! Bookmark not defined.3.1. D
3.2. Error! Bookmark not defined.
Chapter 4. EXPERIMENT Error! Bookmark not defined.
4.1 Hardware Setup……………………………………………………………….17
4.2 Experimental scenarios and results………………………………………….17
4.3 Evaluation……………………………………………………………………...20
Chapter 5. ....................................................................................... Error! Bookmark not defined.5.1. Er
5.3. Error! Bookmark not defined.
REFERENCE:………………………………………………………………………22
LIST OF FIGURES:
2.1. Tech Specs of Arduino UNO R3…………………………………………………8
2.2. MPU6050 pin out………………………………………………………………...11
5
3.1. Block Diagram of the system……………………………………………………11
3.2 Schematic of the system………………………………………………………….12
3.3 Flowchart of the system………………………………………………………….16
4.1. Real system image……………………………………………………………….17
4.2. Testing results in non-movement environment………………………………..18
4.3. Testing results in movement environment……………………………………..20
PROJECT SUMMARY
Chapter 1. INTRODUCTION
6
*Abstract: This report details the design and implementation of an Inclination
Estimation System that not only accurately measures inclination using the MPU6050
Inertial Measurement Unit (IMU) and Arduino but also displays real-time results on an
LED 16x2 display. The system finds applications in scenarios where instant feedback
on the tilt or inclination of an object is crucial.
*Introduction:
Computer technology is now extremely developed, and mechanical measurement tools
are gradually being replaced by electronic tools with sensors with higher result
accuracy, smaller sizes, and more versatility. This topic "IMU inclination measurement
model" will design the inclination estimation system that combines the power of the
MPU6050 IMU for precise motion sensing with the convenience of an LED 16x2
display for real-time visualization of inclination angles. This integration facilitates
quick decision-making and enhances the usability of the system in various contexts.
*Overview:
+Research direction
. Learn and research about the IMU technology
. Develop an inclination estimation system using Arduino Uno R3 and IMU MPU6050
sensor to estimate the incline angle
.Research and develop communication between the system components to ensure
system stability and accuracy.
+Targets
.Design an inclination estimation system to create a simple application tool while also
understanding more about the IMU technology and sensor.
.Optimize system stability through research
.Evaluate the effectiveness and feasibility of the system through tests.
7
Chapter 2. THEORY BASIS
2.1 Arduino programming language
The Arduino programming language is a simplified version of C++ that is used to
program Arduino boards. It can be divided into three main parts: functions, values
(variables and constants), and structure. The language is based on the C/C++ language
and consists of several functions, variables, and structures. The Arduino API can be
used to control the Arduino board and perform computations.
2.2 Arduino Uno R3
Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz
ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button.
It contains everything needed to support the microcontroller; simply connect it to a
computer with a USB cable or power it with a AC-to-DC adapter or battery to get
started.
Name Arduino UNO R3
Board A000066
SKU
Microcontroller Atmega328P
USB connector USB-B
Built-in LED Pin 13
Digital I/O Pins 14
Pins Analog input pins 6
8
PWM pins 6
UART Yes
Communication I2C Yes
SPI Yes
I/O Voltage 5V
Input voltage (nominal) 7-12V
Power DC Current per I/O Pin 20 mA
Power Supply Connector Barrel Plug
Main Processor ATmega328P 16 MHz
Clock speed USB-Serial Processor ATmega16U2 16 MHz
Memory 2KB SRAM, 32KB FLASH,
ATmega328P
1KB EEPROM
Weight 25 g
Dimensions Width 53.4 mm
Length 68.6 mm
2.1. Tech Specs of Arduino UNO R3.
2.3 IMU MPU6050 sensor
*IMU:
9
- Definition: The IMU sensor is an electronic device used to calculate and report the
exact force of the body, angular rate as well and direction of the body, which can be
achieved by using a blend of 3 sensors: Gyroscope, Magnetometer, and Accelerometer.
These sensors are normally used to plan aircraft including UAVs (unmanned aerial
vehicles), between several others, & spacecraft, comprising landers and satellites.
Modern developments permit the manufacture of IMU-based GPS devices.
- Working Principle: An IMU sensor unit working can be done by noticing linear
acceleration with the help of one or additional accelerometers & rotational rate can be
detected by using one or additional gyroscopes. Some also contain a magnetometer
which can be used as a heading reference. This sensor includes some usual
configurations which include gyro, one accelerometer, and magnetometer for each axis
used for each of the 3-vehicle axes like roll, yaw, and pitch.
*MPU6050 sensor
The MPU-6050 IMU (Inertial Measurement Unit) is a 3-axis accelerometer and 3-axis
gyroscope sensor. The accelerometer measures the gravitational acceleration, and the
gyroscope measures the rotational velocity. Additionally, this module also measures
temperature. This sensor is ideal for determining the orientation of a moving object.
VCC Power the sensor (3.3V or 5V)
GND Common GND
SCL SCL pin for I2C communication (A5)
SDA SDA pin for I2C communication (A4)
XDA Used to interface other I2C sensors with the MPU-6050
XCL Used to interface other I2C sensors with the MPU-6050
10
AD0 Use this pin to change the I2C address
INT Interrupt pin – can be used to indicate that new measurement data is available
2.2. MPU6050 pin out.
Chapter 3. SYSTEM IMPLEMENTATION PROCESS
3.1 Design hardware circuit for system:
*Block Diagram:
3.1. Block Diagram of the system
-Input : the IMU MPU6050 is the input of this system by proving x, y, z coordinate and
acceleration by using the gyroscope and accelerator.
-Central Controller Unit: we use the Arduino Uno R3 to calculate the inclination by
using the algorithm uploaded on it.
-Decoder: the I2C is needed in this system because the Inclination calculation results
have to be decoded for displaying on LED.
-Output: the LED 16x2 will be used to display the calculation result.
*Schematic/circuit:
11
3.2 Schematic of the system
The system has three components:
-Arduino Uno R3: The controller of the system, used for receiving the info sended
from the MPU6050, calculates the iclination angle and displays it on the 16x2 LED.
Detailed information about it was introduced above.
12
-IMU MPU6050: The sensor of the system, is used to provide the information of the X,
Y and Z coordinates by using the gyroscope of the sensor and the acceleration by using
the accelerometer. Detailed information about it was introduced above.
-LED 16x2: Using for displaying the inclination calculation result from the Arduino
Uno R3.
3.2 Error! Bookmark not defined.
*Algorithm:
(1) #include <LiquidCrystal_I2C.h>
(2) #include <MPU6050_tockn.h>
(3) #include <Wire.h>
13
(5) MPU6050 mpu6050(Wire);
(6) LiquidCrystal_I2C lcd(0X27,16,2);
(8) void setup() {
[Link]();
[Link]();
[Link](9600);
[Link]();
[Link]();
[Link](true);
(15) }
(17) void loop() {
[Link]();
float ax = [Link]();
float ay = [Link]();
float az = [Link]();
float pitch = atan(ax/sqrt(ay*ay+az*az)) * 180/PI ;
float roll = atan(ay/az) * 180/PI;
[Link](0,0);
[Link]("pitch: ");
14
[Link](8,0);
[Link](pitch);
[Link](0,1);
[Link]("roll: ");
[Link](8,1);
[Link](roll);
delay(500);
(33) }
*Proposal:
-Line (1) to (3): Declare the library used for the algorithm
-Line (4) and (5): Declare the MPU6050 and LCD object for using in the project
-Line (8) to (15): initiate the system by initiate the LCD and the MPU6050.
-Line (17) to (33) : calculate the pitch and roll angle by these step:
+Step 1: Get the accelerate angle of x, y, z.
+Step 2: Calculate the pitch and roll angle with the accelerate angles in step 1.
+Step 3: Print out the pitch and roll angle on the LCD.
*Flowchart:
15
3.3 Flowchart of the system
*Descriptions:
-Step 1: start the system by power on and initiate the MPU6050 and the LED
-Step 2: get the input for the system by getting the status of ax, ay, az
-Step 3: Calculate the Pitch and Roll angle by inputs, if can calculate, go to next step;
if not, comeback to step 2.
-Step 4: print out the results on LED, if continue to calculate, comback to Step 2; if
not, go to next steps.
-Step 5: end the system by turn off the power.
16
Chapter 4. EXPERIMENT Error! Bookmark not defined.
4.1 Hardware Setup
4.1. Real system image
*Following the schematic above, we set up the hardware of the system like in the
picture above.
[Link] Scenario and Results:
*We will estimate the same angle estimation 10 times for all of the scenarios to test out
the difference and the accuracy
*Non-movement:
-Scenario: We will use the system on the table to estimate the angle in the non-
movement environment.
17
-Results:
Times Pitch Roll
1 -0.169 44.460
2 0.6069 45.240
3 1.0069 44.910
4 0.7169 44.000
5 0.9469 45.240
18
6 0.6669 44.710
7 0.8469 44.650
8 0.6569 44.730
9 0.4969 44.600
10 0.5546 45.125
4.2. Testing results in non-movement environment
*Movement:
-Scenario: we will use the system while walking to test it in the movement
environments.
19
-Results:
Times Pitch Roll
1 4.2590 57.621
2 4.1459 57.810
3 4.0685 54.485
4 4.7512 59.480
5 5.4712 57.169
6 4.5696 55.592
7 5.7630 52.501
8 5.4217 57.478
9 4.7058 53.928
10 4.0385 55.507
4.3. Testing results in movement environment
[Link]
Although the scenario is not the best to have the exact estimation from the system,
and has a significant offset compare to real incline status but by the results in both
scenario, we can see that the system is working good and can be improve and upgrade.
20
Chapter 5. Error! Bookmark not defined.*Sumary:
The inclination estimation system using the IMU MPU6050 is a simple project that can be
easily be built, affordable, easy to upgrade and has large application in various field. The
main purpose of the project is using the gyroscope and accelerator of the IMU MPU6050 to
calculate the incline angle by calculate the pitch and roll incline angle.
*Restrictions:
-Accuracy: This simple system has significant offset accuracy when testing in some
specific environment, especially the movement environment.
-Environmental Conditions: This system doesn’t have any protection for the MPU
and the UNO so it’s just can be using for testing, not for real using purpose.
*Development Orientations:
-System Technical: can be improved by made the connection wireless, install some
protections,…
-Data Proccessing: Develop the algorithms for processing the sensor data and
interfaced more information
-Testing and Validation: Conduct thorough testing to validate the accuracy and
reliability of the system under various conditions.
-Calibration: Implement a robust calibration process to ensure accurate measurements.
REFERENCES.
*IMU Sensor Working and Its Application ([Link])
*Arduino Guide for MPU-6050 Accelerometer and Gyroscope Sensor
([Link])
*UNO R3 | Arduino Documentation ([Link])
21
22