Self-Balancing Robot
User Guide
18
www.terasic.com
July 12, 2018
Figure 1- 14 Comparison chart of the Kalman angle filter
◼
◼
M
M
P
P
U
U
-
-
6
6
5
5
0
0
0
0
O
O
p
p
e
e
r
r
a
a
t
t
i
i
o
o
n
n
FPGA uses I2C or SPI interface to control the MPU-6500, In our demo, we use the I2C interface to
read the register of the MPU-6500 with Salve Address 7'b1011001. The data registers of XYZ axis
accelerator and gyroscope locate in the range of 3B(Hex) ~ 48(Hex). It requires the initial operation
on starting up. For more details about the MPU-6500 and Register map, please refer to the
CD\Datasheet\Sensor\.
And
refer
to
the
MPU.cpp
&
MPU.h
provided
in
CD\Demonstrations\BAL_CAR_Nios_Code\software\DE10_Nano_bal\ for control code.
◼
◼
E
E
x
x
a
a
m
m
p
p
l
l
e
e
D
D
e
e
s
s
c
c
r
r
i
i
p
p
t
t
i
i
o
o
n
n
s
s
We provide the Nios II demo for balance car by using the Open-core I2C module in Qsys. This
module allows Nios II to access the mpu-6500 through the I2C interface.
The
function
for
obtaining
the
tilted
angle
is
provided
in
path:
\Demonstrations\BAL_CAR_Nios_Code\software\DE10_Nano_bal\main.cpp, the main codes are
as following:
/**************************************************************************