Gyroscopes and Accelerometers in Robotics

Robotics System
Lecture 4:
Gyro Reading using Arduino
By:
Nur Uddin, Ph.D
1
IMUs
There are small devices
indicating changing orientation in
smart phones, video game
remotes, quad-copters, etc.
These devices contains
gyroscopes combined with
accelerometers and/or
compasses and are referred to
as an 
IMU
, or 
Inertial
Measurement Unit
The number of sensor inputs in
an IMU are referred to as “
DOF”
(Degrees of Freedom
), so a chip
with a 3-axis gyroscope and a 3-
axis accelerometer would be a 6-
DOF IMU.
Accelerometers
 
Proof mass deflection is measured
as a change in capacitance between
the proof mass and sensing plates
Internal circuitry converts the tiny
capacitance to a voltage signal
which is  digitized and output
 
Each accelerometer has a
zero-g voltage level, you
can find it in spec
Accelerometers also have
a sensitivity, usually
expressed in mV/g
Divide the zero-g level
corrected reading by the
sensitivity to produce the
final reading
Image credit:
http://www.freescale.com/files/sensors/doc/app_note/
A
N3461.pdf
Accelerometers
Computing orientation from an
accelerometer relies on a constant
gravitational pull of 1g (9.8 m/s^2)
downwards
If no additional forces act on the
accelerometer (a risky assumption), the
magnitude of the acceleration is 1g, and
the sensor’s rotation can be computed
from the position of the acceleration
vector
If the Z-axis is aligned along the
gravitational acceleration vector, it is
impossible to compute rotation around
the Z-axis from the accelerometer.
Digital accelerometers give information
using a serial protocol like I2C , SPI or
USART; analog accelerometers output a
voltage level within a predefined range
 
Accelerometer
cos(Axr) = Rx / R
cos(Ayr) = Ry / R
cos(Azr) = Rz / R
R = SQRT( Rx^2 + Ry^2 +
Rz^2)
Find angles by using arccos()
function (the inverse cos()
function ):
Axr = arccos(Rx/R)
Ayr = arccos(Ry/R)
Azr = arccos(Rz/R)
Image credit: http://www.starlino.com/imu_guide.html
Gyroscope
A gyroscope measures 
angular velocity (the rate of change in
orientation angle),
 not angular orientation itself
Must first initialize the sensor position with a known value
(possibly from the accelerometer), then measure the angular
velocity (ω) around the X, Y and Z axes at measured intervals
(Δt)
ω × Δt = change in angle
The new orientation angle is the original angle plus this
change
This is 
integrating 
- adding up many small computed intervals -
 to find orientation
Repeatedly adding up increments of  ω × Δt results in small
systematic errors becoming magnified over time
Gyroscopic drift-
--over long timescales the gyroscope data
will become increasingly inaccurate
Gyroscope
Uses Coriolis effect to
transform an angular
velocity into a displacement
The Coriolis force acts
perpendicular to the
rotation axis and to the
velocity of the body in the
rotating frame
F
c
=
 
-
2
m
 
Ω
 
x
 
v
The displacement induces
a change in capacitance
between the mass and the
housing, thus transforming
the angular rate input to the
gyroscope into an electrical
output
Image credit:
http://www.digikey.com/us/en/techzone/sensors/reso
urces/articles/MEMS-Accelerometers.html
Gyroscopes
Each gyroscope
measures the rotation
around one axis
Axz – is the angle
between the Rxz
(projection of R on XZ
plane) and Z axis
Ayz – is the angle
between the Ryz
(projection of R on YZ
plane) and Z axis
Gyroscopes measure the
rate of change of these
angles.
Image credit: http://www.starlino.com/imu_guide.html
Computing Rotation Angles
tan(Axz) = Rx/Rz => Axz = atan2(Rx,Rz
)
Axz(n-1) = atan2( RxEst(n-1) , RzEst(n-1) )
Axz(n) = Axz(n-1) + RateAxz(n) * T
Image credit: http://www.starlino.com/imu_guide.html
Rotation from accelerometer data:
Rotation from gyroscope data:
Sensor Fusion
An accelerometer measures inertial force, such as
gravity (and ideally only by gravity), but it might also
be caused by acceleration (movement) of the device.
Even if the accelerometer is relatively stable, it is
very sensitive to vibration and mechanical noise.
A gyroscope is less sensitive to linear mechanical
movements, the type of noise that accelerometer
suffers from.  Gyroscopes have other types of
problems like drift (not coming back to zero-rate
value when rotation stops).
Averaging the data that comes from accelerometers
and gyroscopes can produce a better estimate of
orientation than obtained using accelerometer data
alone.
Fusion Algorithms
Several choices: Kalman Filter, 
Complementary Filter
, …
Combine orientation estimated from Accelerometer readings with
that estimated from the Gyroscope readings
Racc – current readings from accelerometer
Rgyro – obtained from Rest(n-1) and current gyroscope readings
A weighted average:
Rest(n) = (Racc * w1 + Rgyro * w2 ) / (w1 + w2)
Sensor Fusion
Image credit: http://memscentral.com/Secondlayer/
mems_motion_sensor_perspectives-sensor-susion-high-res.htm
 
MPU-6050
The 
MPU-6050
 is the world’s first integrated 6-axis
MotionTracking device
It combines a 3-axis gyroscope, 3-axis accelerometer, and a
Digital Motion Processor™ (DMP) all in a small 4x4x0.9mm
package.
It uses a standard I2C bus for data transmission.
With it’s I2C bus, it can accepts inputs from an external 3-axis
compass to provide a complete 9-axis MotionFusion output.
A number of  
different breakout boards 
 are available containing
the MPU-6050 chip, we have the GY-521.
I
2
C
Understanding I2C
The physical I2C bus
Masters and Slaves
The physical protocol
I2C device addressing
The software protocol
I2C support in the WiringPi Library
A good 
Tutorial
Image credit:
http://quick2wire.com/articles/i
2c-and-spi/
 
 
The physical I2C bus
Two wires: SCL and SDA
SCL is the clock line: used to synchronize all data transfers
SDA is the data line
Both SCL and SDA lines are "open drain" drivers
Can only be driven low
For the line to go high provide a pull-up resistors to 5v
Image credit:
http://electronics.stackexc
hange.com/questions/703
12/n-ch-fet-with-open-
drain-output
Image credit: http://www.robot-
electronics.co.uk/acatalog/I2C_Tutorial.html
M
a
s
t
e
r
s
 
a
n
d
 
S
l
a
v
e
s
The devices on the I2C bus are either masters or slaves
The master drives the clock & initiates the transfers
Multiple slaves on the I2C bus, but there is typically only one
master.
Both master and slave can transfer data over the I2C bus, but that
transfer is always controlled by the master.
T
h
e
 
I
2
C
 
P
h
y
s
i
c
a
l
 
P
r
o
t
o
c
o
l
Start and stop sequences mark the
beginning and end of a transaction
Initiated by the master
The only time the SDA (data line) is
changed while the SCL (clock line) is
high.
During data transfer, SDA must not
change while SCL is high
Data is transferred in sequences of 8
bits.
Bits are sent with the MSB (Most
Significant Bit) first.
The SCL line is pulsed high, then low for
each bit
After each 8 bits transfer, the slave
sends back an acknowledge bit
It takes  9 SCL clock pulses to
transfer 8 bytes of data
The standard clock (SCL) speed for I2C
is up to 100KHz
Image credit: http://www.robot-
electronics.co.uk/acatalog/I2C_Tutorial.html
I
2
C
 
D
e
v
i
c
e
 
A
d
d
r
e
s
s
i
n
g
All I2C addresses are 7 bits or 10 bits---most are 7 (ours are)
Can have up to 128 devices on the I2C bus
Addresses are still sent in 8 bits
The extra bit (the last bit) indicates read or write
If the bit is zero the master is writing to the slave.
If the bit is 1 the master is reading from the slave
Image credit: http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html
T
h
e
 
I
2
C
 
W
r
i
t
e
 
P
r
o
t
o
c
o
l
Procedure to write to a slave device:
1. Send a start sequence
2. Send the I2C address of the slave with the R/W bit low (even address)
3. Send the internal register number you want to write to
4. Send the data byte
5. [Optionally, send any further data bytes]
slave will automatically increment the internal register address after each byte
6. Send the stop sequence.
T
h
e
 
I
2
C
 
W
r
i
t
e
 
P
r
o
t
o
c
o
l
 
 
Image credit:  http://invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf
T
h
e
 
I
2
C
 
R
e
a
d
 
P
r
o
t
o
c
o
l
A read is more complicated
Before reading data from a slave device, you must tell it which of its
internal addresses you want to read
A read starts off by writing to the slave
Procedure
1. Send a start sequence
2. Send I2C address of the device with the R/W bit low (even address)
3. Send the Internal register address
4. Send a start sequence again (repeated start)
5. Send the I2C address of the device with the R/W bit high (odd address)
6. Read data byte from the register
7. Send the stop sequence.
T
h
e
 
I
2
C
 
R
e
a
d
 
P
r
o
t
o
c
o
l
Image credit:  http://invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf
A Read Example with 
MPU 6050
F
o
r
 
M
P
U
-
6
0
5
0
:
ACCEL_XOUT_H 
 register 
3B
ACCEL_XOUT_L 
 register 
3C
ACCEL_YOUT_H 
 register 
3D
ACCEL_YOUT_L 
 register 
3E
ACCEL_ZOUT_H 
 register 
3F
ACCEL_ZOUT_L 
 register 40
 
I2C read using 
WiringPi I2C Library
int fd;
int16_t ax, ay, az;
uint8_t  MSB, LSB;
fd = wiringPiI2CSetup(0x68);     // I2C address of MPU6050
MSB = wiringPiI2CReadReg8(fd, 0x3B);
LSB = wiringPiI2CReadReg8(fd, 0x3C);
ax = (((uint16_t)MSB) << 8) | LSB;
MSB = wiringPiI2CReadReg8(fd, 0x3D);
LSB = wiringPiI2CReadReg8(fd, 0x3E);
ay = (((uint16_t)MSB) << 8) | LSB;
I2C read using 
WiringPi I2C Library
I2Ctest.cpp
Install in PiBits/MPU6050-Pi-Demo directory
(Installed later in lecture)
A modified 
Makefile
Replace the Makefile in the MPU6050-Pi-Demo package with this
one
G
i
v
e
 
t
h
e
 
c
o
m
m
a
n
d
:
 
 
m
a
k
e
 
I
2
C
t
e
s
t
 
 
 
t
o
 
c
o
m
p
i
l
e
 
t
h
e
 
p
r
o
g
r
a
m
MPU-6050
 
The Physical Connection
Connecting the MPU to the Pi
M
P
U
6
0
5
0
 
 
 
 
 
 
 
 
 
 
 
P
i
 
P
i
n
 
I
D
P
i
n
 
I
D
V
D
D
 
 
-
-
>
 
 
 
 
3
.
3
V
 
o
n
 
P
i
GND  
 
-->    GND on Pi
SCL    
 
-->    SCL on Pi
SDA   
 
-->    SDA on Pi
XDA
XCL
ADO  
 
-->     GND on Pi
INT
The Code
T
h
e
r
e
 
i
s
 
a
 
l
i
b
r
a
r
y
 
n
a
m
e
d
 
I
2
C
d
e
v
l
i
b
 
f
o
r
 
a
c
c
e
s
s
i
n
g
 
t
h
e
 
M
P
U
-
6
0
5
0
 
a
n
d
o
t
h
e
r
 
I
2
C
 
d
e
v
i
c
e
s
 
w
r
i
t
t
e
n
 
b
y
 
J
e
f
f
 
R
o
w
b
e
r
g
.
 
T
h
i
s
 
c
o
d
e
 
i
s
 
f
o
r
 
t
h
e
A
r
d
u
i
n
o
.
T
h
i
s
 
c
o
d
e
 
w
a
s
 
p
o
r
t
e
d
 
t
o
 
t
h
e
 
R
P
i
 
b
y
 
R
i
c
h
a
r
d
 
G
h
r
i
s
t
 
o
f
 
S
e
r
v
o
b
l
a
s
t
e
r
f
a
m
e
.
 
I
t
 
i
s
 
a
v
a
i
l
a
b
l
e
 
i
n
 
t
h
e
 
s
a
m
e
 
P
i
B
i
t
s
 
G
i
t
H
u
b
 
r
e
p
o
s
i
t
o
r
y
.
 
 
L
o
o
k
 
i
n
d
i
r
e
c
t
o
r
y
 
M
P
U
6
0
5
0
-
P
i
-
D
e
m
o
There are three demo programs
one displays raw accel and gyro data from the MPU6050
another displays more useful data (angle of rotation, rotation matrix,
quaternion, Euler Angle, for example) using the on-chip DMP to do the
processing.
the third demo draws a simple 3D wireframe model on the screen
Installation Instructions
git clone git://github.com/richardghirst/PiBits.git
cd 0PiBits/MPU6050-Pi-Demo
sudo apt-get install libgtkmm-3.0-dev
nano I2Cdev.cpp
Change all occurrences of  "/dev/i2c-0" to "/dev/i2c-1“  & save file
nano setup-i2c.sh
Change  "/dev/i2c-0" to "/dev/i2c-1““  & save file
make
./setup-i2c.sh
sudo i2cdetect -y 1
(the IMU should use address 68)
./demo_raw
Execute the version of program displaying raw accel and gyro values
Output is Ax, Ay, Az,    Gx, Gy, Gz
./demo_dmp
Execute the version of program displaying output from the DMP
Output is 
quaternions
, & yaw (about z), pitch (about y), roll (about x) angles
Setting up a X11 Connection
On a Windows platform
Install 
MobaXterm
 (select the free version) & run
In the /home/mobaxterm window, type:
ssh –X pi@lastName.cs.unca.edu (or use your wireless IP)
cd PiBits/MPU6050-Pi-Demo
./demo_3d
Ctrl-C Ctrl-C to stop the program
On Linux or Mac
ssh –X pi@lastName.cs.unca.edu (or use your wireless IP)
cd PiBits/MPU6050-Pi-Demo
./demo_3d
Ctrl-C Ctrl-C to stop the program
Slide Note
Embed
Share

Gyroscopes and accelerometers are essential components in robotics, providing information on orientation and movement. Gyroscopes measure angular velocity, while accelerometers detect acceleration forces. Together, they form IMUs with multiple degrees of freedom. The combination of these sensors allows for precise tracking of position and orientation in various devices, including smartphones, game controllers, and drones. Learn how these sensors function and how they contribute to the field of robotics.

  • Robotics
  • Gyroscopes
  • Accelerometers
  • IMUs
  • Sensors

Uploaded on Dec 13, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Robotics System Lecture 4: Gyro Reading using Arduino By: Nur Uddin, Ph.D 1

  2. IMUs There are small devices indicating changing orientation in smart phones, video game remotes, quad-copters, etc. These devices contains gyroscopes combined with accelerometers and/or compasses and are referred to as an IMU, or Inertial Measurement Unit The number of sensor inputs in an IMU are referred to as DOF (Degrees of Freedom), so a chip with a 3-axis gyroscope and a 3- axis accelerometer would be a 6- DOF IMU.

  3. Accelerometers Each accelerometer has a zero-g voltage level, you can find it in spec Accelerometers also have a sensitivity, usually expressed in mV/g Divide the zero-g level corrected reading by the sensitivity to produce the final reading Image credit: http://www.freescale.com/files/sensors/doc/app_note/AN3461.pdf Proof mass deflection is measured as a change in capacitance between the proof mass and sensing plates Internal circuitry converts the tiny capacitance to a voltage signal which is digitized and output

  4. Accelerometers Computing orientation from an accelerometer relies on a constant gravitational pull of 1g (9.8 m/s^2) downwards If no additional forces act on the accelerometer (a risky assumption), the magnitude of the acceleration is 1g, and the sensor s rotation can be computed from the position of the acceleration vector If the Z-axis is aligned along the gravitational acceleration vector, it is impossible to compute rotation around the Z-axis from the accelerometer. Digital accelerometers give information using a serial protocol like I2C , SPI or USART; analog accelerometers output a voltage level within a predefined range

  5. Accelerometer cos(Axr) = Rx / R cos(Ayr) = Ry / R cos(Azr) = Rz / R R = SQRT( Rx^2 + Ry^2 + Rz^2) Find angles by using arccos() function (the inverse cos() function ): Axr = arccos(Rx/R) Ayr = arccos(Ry/R) Azr = arccos(Rz/R) Image credit: http://www.starlino.com/imu_guide.html

  6. Gyroscope A gyroscope measures angular velocity (the rate of change in orientation angle), not angular orientation itself Must first initialize the sensor position with a known value (possibly from the accelerometer), then measure the angular velocity ( ) around the X, Y and Z axes at measured intervals ( t) t = change in angle The new orientation angle is the original angle plus this change This is integrating - adding up many small computed intervals - to find orientation Repeatedly adding up increments of t results in small systematic errors becoming magnified over time Gyroscopic drift---over long timescales the gyroscope data will become increasingly inaccurate

  7. Gyroscope Uses Coriolis effect to transform an angular velocity into a displacement The Coriolis force acts perpendicular to the rotation axis and to the velocity of the body in the rotating frame Fc= -2m x v The displacement induces a change in capacitance between the mass and the housing, thus transforming the angular rate input to the gyroscope into an electrical output Image credit: http://www.digikey.com/us/en/techzone/sensors/reso urces/articles/MEMS-Accelerometers.html

  8. Gyroscopes Each gyroscope measures the rotation around one axis Axz is the angle between the Rxz (projection of R on XZ plane) and Z axis Ayz is the angle between the Ryz (projection of R on YZ plane) and Z axis Gyroscopes measure the rate of change of these angles. Image credit: http://www.starlino.com/imu_guide.html

  9. Computing Rotation Angles Rotation from accelerometer data: tan(Axz) = Rx/Rz => Axz = atan2(Rx,Rz) Rotation from gyroscope data: Axz(n-1) = atan2( RxEst(n-1) , RzEst(n-1) ) Axz(n) = Axz(n-1) + RateAxz(n) * T Image credit: http://www.starlino.com/imu_guide.html

  10. Sensor Fusion An accelerometer measures inertial force, such as gravity (and ideally only by gravity), but it might also be caused by acceleration (movement) of the device. Even if the accelerometer is relatively stable, it is very sensitive to vibration and mechanical noise. A gyroscope is less sensitive to linear mechanical movements, the type of noise that accelerometer suffers from. Gyroscopes have other types of problems like drift (not coming back to zero-rate value when rotation stops). Averaging the data that comes from accelerometers and gyroscopes can produce a better estimate of orientation than obtained using accelerometer data alone.

  11. Fusion Algorithms Several choices: Kalman Filter, Complementary Filter, Combine orientation estimated from Accelerometer readings with that estimated from the Gyroscope readings Racc current readings from accelerometer Rgyro obtained from Rest(n-1) and current gyroscope readings A weighted average: Rest(n) = (Racc * w1 + Rgyro * w2 ) / (w1 + w2)

  12. Sensor Fusion Image credit: http://memscentral.com/Secondlayer/ mems_motion_sensor_perspectives-sensor-susion-high-res.htm

  13. MPU-6050 The MPU-6050 is the world s first integrated 6-axis MotionTracking device It combines a 3-axis gyroscope, 3-axis accelerometer, and a Digital Motion Processor (DMP) all in a small 4x4x0.9mm package. It uses a standard I2C bus for data transmission. With it s I2C bus, it can accepts inputs from an external 3-axis compass to provide a complete 9-axis MotionFusion output. A number of different breakout boards are available containing the MPU-6050 chip, we have the GY-521.

  14. I2C Understanding I2C The physical I2C bus Masters and Slaves The physical protocol I2C device addressing The software protocol I2C support in the WiringPi Library A good Tutorial Image credit: http://quick2wire.com/articles/i 2c-and-spi/

  15. The physical I2C bus Image credit: http://electronics.stackexc hange.com/questions/703 12/n-ch-fet-with-open- drain-output Image credit: http://www.robot- electronics.co.uk/acatalog/I2C_Tutorial.html Two wires: SCL and SDA SCL is the clock line: used to synchronize all data transfers SDA is the data line Both SCL and SDA lines are "open drain" drivers Can only be driven low For the line to go high provide a pull-up resistors to 5v

  16. Masters and Slaves The devices on the I2C bus are either masters or slaves The master drives the clock & initiates the transfers Multiple slaves on the I2C bus, but there is typically only one master. Both master and slave can transfer data over the I2C bus, but that transfer is always controlled by the master.

  17. The I2C Physical Protocol Data is transferred in sequences of 8 bits. Bits are sent with the MSB (Most Significant Bit) first. The SCL line is pulsed high, then low for each bit After each 8 bits transfer, the slave sends back an acknowledge bit It takes 9 SCL clock pulses to transfer 8 bytes of data The standard clock (SCL) speed for I2C is up to 100KHz Image credit: http://www.robot- electronics.co.uk/acatalog/I2C_Tutorial.html Start and stop sequences mark the beginning and end of a transaction Initiated by the master The only time the SDA (data line) is changed while the SCL (clock line) is high. During data transfer, SDA must not change while SCL is high

  18. I2C Device Addressing Image credit: http://www.robot-electronics.co.uk/acatalog/I2C_Tutorial.html All I2C addresses are 7 bits or 10 bits---most are 7 (ours are) Can have up to 128 devices on the I2C bus Addresses are still sent in 8 bits The extra bit (the last bit) indicates read or write If the bit is zero the master is writing to the slave. If the bit is 1 the master is reading from the slave

  19. The I2C Write Protocol Procedure to write to a slave device: 1. Send a start sequence 2. Send the I2C address of the slave with the R/W bit low (even address) 3. Send the internal register number you want to write to 4. Send the data byte 5. [Optionally, send any further data bytes] slave will automatically increment the internal register address after each byte 6. Send the stop sequence.

  20. The I2C Write Protocol Image credit: http://invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf

  21. The I2C Read Protocol A read is more complicated Before reading data from a slave device, you must tell it which of its internal addresses you want to read A read starts off by writing to the slave Procedure 1. Send a start sequence 2. Send I2C address of the device with the R/W bit low (even address) 3. Send the Internal register address 4. Send a start sequence again (repeated start) 5. Send the I2C address of the device with the R/W bit high (odd address) 6. Read data byte from the register 7. Send the stop sequence.

  22. The I2C Read Protocol Image credit: http://invensense.com/mems/gyro/documents/PS-MPU-6000A-00v3.4.pdf

  23. A Read Example with MPU 6050 For MPU-6050: ACCEL_XOUT_H register 3B ACCEL_XOUT_L register 3C ACCEL_YOUT_H register 3D ACCEL_YOUT_L register 3E ACCEL_ZOUT_H register 3F ACCEL_ZOUT_L register 40

  24. I2C read using WiringPi I2C Library int fd; int16_t ax, ay, az; uint8_t MSB, LSB; fd = wiringPiI2CSetup(0x68); // I2C address of MPU6050 MSB = wiringPiI2CReadReg8(fd, 0x3B); LSB = wiringPiI2CReadReg8(fd, 0x3C); ax = (((uint16_t)MSB) << 8) | LSB; MSB = wiringPiI2CReadReg8(fd, 0x3D); LSB = wiringPiI2CReadReg8(fd, 0x3E); ay = (((uint16_t)MSB) << 8) | LSB;

  25. I2C read using WiringPi I2C Library I2Ctest.cpp Install in PiBits/MPU6050-Pi-Demo directory (Installed later in lecture) A modified Makefile Replace the Makefile in the MPU6050-Pi-Demo package with this one Give the command: make I2Ctest to compile the program

  26. MPU-6050

  27. The Physical Connection Connecting the MPU to the Pi MPU6050 Pi Pin ID Pin ID VDD GND SCL SDA XDA XCL ADO INT --> 3.3V on Pi --> GND on Pi --> SCL on Pi --> SDA on Pi --> GND on Pi

  28. The Code There is a library named I2Cdevlib for accessing the MPU-6050 and other I2C devices written by Jeff Rowberg. This code is for the Arduino. This code was ported to the RPi by Richard Ghrist of Servoblaster fame. It is available in the same PiBits GitHub repository. Look in directory MPU6050-Pi-Demo There are three demo programs one displays raw accel and gyro data from the MPU6050 another displays more useful data (angle of rotation, rotation matrix, quaternion, Euler Angle, for example) using the on-chip DMP to do the processing. the third demo draws a simple 3D wireframe model on the screen

  29. Installation Instructions git clone git://github.com/richardghirst/PiBits.git cd 0PiBits/MPU6050-Pi-Demo sudo apt-get install libgtkmm-3.0-dev nano I2Cdev.cpp Change all occurrences of "/dev/i2c-0" to "/dev/i2c-1 & save file nano setup-i2c.sh Change "/dev/i2c-0" to "/dev/i2c-1 & save file make ./setup-i2c.sh sudo i2cdetect -y 1 (the IMU should use address 68) ./demo_raw Execute the version of program displaying raw accel and gyro values Output is Ax, Ay, Az, Gx, Gy, Gz ./demo_dmp Execute the version of program displaying output from the DMP Output is quaternions, & yaw (about z), pitch (about y), roll (about x) angles

  30. Setting up a X11 Connection On a Windows platform Install MobaXterm (select the free version) & run In the /home/mobaxterm window, type: ssh X pi@lastName.cs.unca.edu (or use your wireless IP) cd PiBits/MPU6050-Pi-Demo ./demo_3d Ctrl-C Ctrl-C to stop the program On Linux or Mac ssh X pi@lastName.cs.unca.edu (or use your wireless IP) cd PiBits/MPU6050-Pi-Demo ./demo_3d Ctrl-C Ctrl-C to stop the program

Related


More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#