SlideShare a Scribd company logo
Vijay Kumar
Professor
Mechanical Engineering
Chitkara University
IMU Fundamental
Micro: Very small in size. Measured in micrometer(μm)
1 μm = 10-6 m
Electro: MEMS have electrical components
Mechanical: MEMS have moving parts
Systems: Refers to integration of components.
We find MEMS in
Automobiles (Air bag sensors)
Computer printers (Ink jet print heads)
Cell phones (RF devices)
Optical devices (Micromirrors)
MEMS
They have also found application in the healthcare domain in devices
such as blood pressure monitors, pacemakers, ventilators, and respirators.
Air bag crash sensors
Active suspension systems
Antilock brake systems
Ride control systems
V K Jadon, Prof., Mechanical Engineering, Chitkara University 2
Accelerometer
𝑥, 𝑎
𝑘
𝑚
𝑥, 𝑎
𝑘
𝑚
𝑥, 𝑎
−𝑘𝑥 = 𝑚𝑎
𝑘
𝑚 𝑚𝑎𝑠𝑠 𝑖𝑠 𝑑𝑖𝑠𝑝𝑙𝑎𝑐𝑒𝑑
𝑎 = −
𝑘
𝑚
𝑥
𝑎 = 𝑓(𝑥)
External Force in the direction of
displacement =mass×acceleration
𝑚
𝑘𝑥 𝑎
𝐶 = 𝑓(𝐴/𝑥)
𝐶 = 𝑓(𝐴/𝑎)
Accelerometer measures linear acceleration
Acceleration is opposite to
the displacement
𝐶 = 𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑎𝑛𝑐𝑒
𝐴 = surface area of
capacitor plates
V K Jadon, Prof., Mechanical Engineering, Chitkara University 3
Displacement of the frame changes the differential capacitance
Capacitive accelerometers offer high sensitivities and
are utilized for low-amplitude, low-frequency devices.
Accelerometer
𝒙
𝒛
𝒚
Internal moveable
assembly
Proof mass
Spring
External Fixed assembly
MPU6050 measures linear acceleration in terms of g force
Usefulness of accelerometer in
IMU will be discussed later
V K Jadon, Prof., Mechanical Engineering, Chitkara University 4
VCC
GND
SCL
SDA
XDA
XCL
ADO
INT
X
Y
I2C ProtocolGyro Accelerometer
MPU6050 Pinout
Clock pulse for I2C Communication
Data through I2C communication
Data to external sensors
Clock pulse to external sensors
I2C Slave Address
Interrupt digital output
The SCL line is the clock signal which synchronize the
data transfer between the devices on the I2C bus.
Clock signal is generated by the master device.
The full scale range of the digital output can be adjusted to ±2g,
±4g, ±8g, or ±16g.
Three-Axis MEMS Accelerometer with 16-bit ADCs and Signal Conditioning
MPU6050: MEMS Accelerometer
The MPU-60X0’s 3-Axis accelerometer uses separate proof masses for
each axis.
Acceleration along an axis induces displacement on the corresponding
proof mass, and capacitive sensors detect the displacement differentially.
When the device is placed on a flat surface, it will measure
0g on the X- and Y-axes and +1g on the Z-axis (upward).
Each sensor has a dedicated ADC for providing digital outputs.
V K Jadon, Prof., Mechanical Engineering, Chitkara University 6
UNO
Arduino
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
TX-1
RX-0
IOREF
RESET
3.3V
5V
GND
GND
Vin
A0
A1
A2
A3
A4
A5
ON
TX
RX
L
Arduino Uno Pinout
master out slave in
master in slave out
Serial Clock
Slave Select
V K Jadon, Prof., Mechanical Engineering, Chitkara University 7
UNO
Arduino
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
TX-1
RX-0
IOREF
RESET
3.3V
5V
GND
GND
Vin
A0
A1
A2
A3
A4
A5
ON
TX
RX
L
MPU6050 Connection
V K Jadon, Prof., Mechanical Engineering, Chitkara University 8
I2C Protocol
I2C Protocol
V K Jadon, Prof., Mechanical Engineering, Chitkara University 10
• Begins with a start bit
• 7 bit Address is transmitted
• 1 control bit to indicate Master to Read from or
write to slave
• If communicated slave send ack bit to Master
• Master to send 8 bit Internal Register Address
• Slave send back ack bit
• Master transmits data in 8 bits chunk
• Write request – Slave sends ack bit to Master
• Read request – Master sends ack bit to Slave
I2C addresses are generally 7 bits, yielding an
address between 0 and 127.
The addresses from 0 to 7 are not used because are
reserved. So, the first address that can be used is 8
S B6 B5 B4 B3 B2 B1 B0 R/W Ack
B7 B6 B5 B4 B3 B2 B1 B0 Ack
B7 B6 B5 B4 B3 B2 B1 B0 Ack S
7 bit Device Address sequence
8 bit internal Register Address sequence
8 bit data sequence
• Ends with a stop bit
V K Jadon, Prof., Mechanical Engineering, Chitkara University 11
<Wire.h> Library
Wire.begin(address) function initiates Wire library
Wire.beginTransmission(address) begins transmission to
the particular sensor
Wire.beginTransmission(0b1101000)
Wire.endTransmission(address) Transmits data in
buffer and return a status byte, 0 for success.
Wire.endTransmission(0b1101000)
write() buffers data for sending
Wire.write(value)
Wire.write(string)
Wire.write(data, length)
value: a value to send as a single byte
string: a string to send as a series of bytes
data: an array of data to send as bytes
length: the number of bytes to transmit
write() will return the number of bytes written, though
reading that number is optional
address: the 7-bit slave address (optional);
if not specified, join the bus as a master.
Start condition to the slave device with the given address.
It asks for data from the internal registers of the
slave device
S B6 B5 B4 B3 B2 B1 B0 R/W A B7 B6 B5 B4 B3 B2 B1 B0 A B7 B6 B5 B4 B3 B2 B1 B0 A S
V K Jadon, Prof., Mechanical Engineering, Chitkara University 12
<Wire.h> Library
requestFrom() Used by the master to request bytes
from a slave device..
The default value is true.
If true, requestFrom() sends a stop message after the
request, releasing the I2C bus.
If false, requestFrom() sends a restart message after
the request.
Wire.requestFrom(address, quantity)
Wire.requestFrom(address, quantity, stop)
If false, the bus will not be released, which prevents
another master device from requesting between
messages. This allows one master device to send
multiple requests while in control.
The Wire.available() function will return the number
of bytes available for retrieval and if that number
match with our requested bytes
Wire.read() function we will read the bytes from
the two registers of the X axis.
I2C Scanner
MPU6050-
Accelerometer
UNO
Arduino
AREF
GND
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
TX-1
RX-0
IOREF
RESET
3.3V
5V
GND
GND
Vin
A0
A1
A2
A3
A4
A5
ON
TX
RX
L
MPU6050 Connection
V K Jadon, Prof., Mechanical Engineering, Chitkara University 14
V K Jadon, Prof., Mechanical Engineering, Chitkara University 15
MPU6050 Setup Read Accelerometer data using Arduino
Start I2C Communication
― Use Wire.begin() to initiate wire.h
― Wire.beginTransmission(SDA)
Slave Device Address (SDA)=1101000 AD0=Low
Slave Device Address (SDA)=1101001 AD0=High
Reference – Product Specifications (Revision 3.4)
Section 9.2 pp33
― Wire.write(0x6B)
Internal Register Address Sequence to
access Power management register (0x6B)
― Wire.write(0b00000000)
Data Transfer Bit Sequence to awake MPU
― Wire.endTransmission(1101000)
FS Range AFS_SEL Register Bit LSB Sensitivity ADC Bits
±2g 0 0b00000000 16384 LSB/g 15 bit
±4g 1 0b00001000 8192 LSB/g 14 bits
±8g 2 0b00010000 4096 LSB/g 13 bits
±16g 3 0b00011000 2048 LSB/g 12 bits
𝑥 ≈ 0
𝑦 ≈ 0
𝑧 ≈ 1𝑔
𝑦 ≈ 0
𝑧 ≈ 0
𝑥 ≈ 1𝑔
𝑧 ≈ 0
𝑥 ≈ 0
𝑦 ≈ 1𝑔
V K Jadon, Prof., Mechanical Engineering, Chitkara University 16
Accelerometer Setup
The MPU-60X0 features three 16-bit ADCs for digitizing the accelerometer outputs.
For precision tracking of both fast and slow motions, the parts feature a user-
programmable accelerometer full-scale range of ±2g, ±4g, ±8g, and ±16g.
Reference – Product Specifications (Revision 3.4)
Section 6.2 pp13
― Wire.beginTransmission(0b1101000)
― Wire.write(0b00000000)
― Wire.endTransmission(0b1101000)
― Wire.write(0x1C)Reference – Register Map and Description (Revision 4.2)
Section 4.5 pp15
Reference – Product Specifications (Revision 3.4)
Section 3.1 pp7
V K Jadon, Prof., Mechanical Engineering, Chitkara University 17
Read Accelerometer Data
Reference – Register Map (Revision 4.2)
Section 3 pp7
Wire.beginTransmission(0b1101000)
3B and 3C stores Acceleration data along x-axis
3D and 3E stores Acceleration data along y-axis
3F and 40 stores Acceleration data along z-axis
We should give starting Internal Register Address to access
all Read only registers after that.
To transmit all acceleration data, we should write to 0x3B
register.
― Wire.write(0x3B)
Slave device transmit data in 8 bits(1 byte)
Master store integers in 16 bits.
― Wire.endTransmission(0b1101000)
V K Jadon, Prof., Mechanical Engineering, Chitkara University 18
Read Accelerometer Data
For getting hold of the data available in buffer, master has to request using Wire.requestFrom(address, quantity)
Wire.requestFrom(0b1101000, 6)Check availability of the data requested by the master Wire.available()
It returns the number of received bytes from receive-buffer.
Reads a byte that was transmitted from a slave device to a master after a call to requestFrom()
using Wire.read() function.
The each acceleration data is stored in two register (2 bytes)
The data read is to be stored in one variable of int datatype.
Every repeated Wire.read() gives the next byte available.
accel_rawX = Wire.read()<<8|Wire.read();
00001010
00001111
00001010-00000000
00001010-00001111
00001010
V K Jadon, Prof., Mechanical Engineering, Chitkara University 19
Arduino Pseudo Code
Set-Up MPU6050
Configure Accelerometer
Read Accelerometer Data
Every task starts with beginning communication with slave device
and ends with terminating communication with slave device
begin communication – Slave device address sequence
access power management register – internal register address sequence
Update power management register to disable SLEEP mode – data
transfer sequence
terminate communication – stop bit
(one time execution)
(one time execution)
begin communication – Slave device address sequence
access accelerometer configure register – internal register
address sequence
update accelerometer register to set full scale range – data
transfer sequence
terminate communication – stop bit
(data needed continuously)
Disable SLEEP mode
Set Full Scale range
Read accelerometer data
V K Jadon, Prof., Mechanical Engineering, Chitkara University 20
Arduino Pseudo Code
Set-Up MPU6050 Configure Accelerometer
Read Accelerometer Data
Every task starts with beginning communication with slave device
and ends with terminating communication with slave device
(data needed continuously)
Disable SLEEP mode Set Full Scale range
Access Register Read Data
begin communication
stop communication
access accelerometer first data
register
Read accelerometer data
begin communication
stop communication
Request data
Check availability Read 8 bits and
store in 16 bits data
V K Jadon, Prof., Mechanical Engineering, Chitkara University 21
Angle Measurement
𝐹𝑥
𝒙
𝒚
𝒛
𝐹𝑦
𝐹𝑧
𝐹𝑥
2
+ 𝐹𝑦
2
+ 𝐹𝑧
2
𝐹𝑥
2
+ 𝐹𝑦
2
𝐹𝑦
2
+ 𝐹𝑧
2
𝐹𝑥
2
+ 𝐹𝑧
2
𝒙
𝒚
𝒛
𝐹𝑥
2
+ 𝐹𝑦
2
𝐹𝑦
2
+ 𝐹𝑧
2
𝐹𝑥
2
+ 𝐹𝑧
2
V K Jadon, Prof., Mechanical Engineering, Chitkara University 22
There are six possible orderings of these three rotation
matrices and, in principle, all are equally valid
Angle Measurement
𝜓, ∅, 𝜃 are called as Roll, Pitch, and Yaw Angles
𝑅 𝑥 =
1 0 0
0 𝑐𝑜𝑠𝜓 −𝑠𝑖𝑛𝜓
0 𝑠𝑖𝑛𝜓 𝑐𝑜𝑠𝜓
𝑅 𝑦 =
𝑐𝑜𝑠∅ 0 𝑠𝑖𝑛∅
0 1 0
−𝑠𝑖𝑛∅ 0 𝑐𝑜𝑠∅
𝑅 𝑧 =
𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0
𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0
0 0 1
Initial force vector=
0
0
1
𝑮 𝒑 =
𝑮 𝒑𝒙
𝑮 𝒑𝒚
𝑮 𝒑𝒛
= 𝑹
0
0
1
𝑹 𝒙𝒚𝒛
0
0
1
= 𝑹 𝒙(𝜓)𝑹 𝒚(∅) 𝑹 𝒛(𝜃)
0
0
1
𝑹 𝒚𝒛𝒙
0
0
1
= 𝑹 𝒚(∅) 𝑹 𝒛(𝜃)𝑹 𝒙(𝜓)
0
0
1
𝑹 𝒚𝒙𝒛
0
0
1
= 𝑹 𝒚(∅) 𝑹 𝒙(𝜓)𝑹 𝒛(𝜃)
0
0
1
𝑹 𝒛𝒙𝒚
0
0
1
= 𝑹 𝒛(𝜃)𝑹 𝒙(𝜓)𝑹 𝒚(∅)
0
0
1
𝑹 𝒙𝒛𝒚
0
0
1
= 𝑹 𝒙(𝜓)𝑹 𝒛(𝜃)𝑹 𝒚(∅)
0
0
1
𝑹 𝒛𝒚𝒙
0
0
1
= 𝑹 𝒛(𝜃)𝑹 𝒚(∅)𝑹 𝒙(𝜓)
0
0
1
V K Jadon, Prof., Mechanical Engineering, Chitkara University 23
The last four rotation sequences result in the accelerometer
output being function of all three rotation angles and cannot
therefore be solved.
It is conventional therefore to select either the rotation
sequence 𝑅 𝑥𝑦𝑧 or the sequence 𝑅 𝑦𝑥𝑧 to eliminate the yaw
rotation ψ and allow solution for the roll φ and pitch θ angles.
Angle Measurement
𝑮 𝒑 =
𝑮 𝒑𝒙
𝑮 𝒑𝒚
𝑮 𝒑𝒛
=
𝟏
𝐺 𝑝𝑥
2
+ 𝐺 𝑝𝑦
2
+ 𝐺 𝑝𝑧
2
𝐺 𝑝𝑥
𝐺 𝑝𝑦
𝐺 𝑝𝑧
=
𝐺 𝑝𝑥
𝐺 𝑝𝑦
𝐺 𝑝𝑧 𝑅 𝑥𝑦𝑧
0
0
1
= 𝑅 𝑥(𝜓)𝑅 𝑦(∅) 𝑅 𝑧(𝜃)
0
0
1
𝑅 𝑥𝑦𝑧 =
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜃 −𝑠𝑖𝑛∅
𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓 − 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃 + 𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓
𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅ + 𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜓𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
𝑅 𝑥𝑦𝑧 =
−𝑠𝑖𝑛∅
𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
𝑅 𝑦𝑥𝑧 = 𝑅 𝑦(∅) 𝑅 𝑥(𝜓)𝑅 𝑧(𝜃)
0
0
1
=
−𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃
𝑠𝑖𝑛𝜓
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
𝑅 𝑥𝑧𝑦 = 𝑅 𝑥(𝜓)𝑅 𝑧(𝜃)𝑅 𝑦(∅)
0
0
1
=
−𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅
𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 + 𝑐𝑜𝑠𝜓𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃
𝑐𝑜𝑠𝜓𝑐𝑜𝑠∅ − 𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃
𝑅 𝑥𝑧𝑦 = 𝑅 𝑥(𝜓)𝑅 𝑧(𝜃)𝑅 𝑦(∅)
0
0
1
=
𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠𝜓𝑠𝑖𝑛∅
𝑐𝑜𝑠𝜃𝑠𝑖𝑛𝜓
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 + 𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃
𝑅 𝑧𝑦𝑥 = 𝑅 𝑧(𝜃)𝑅 𝑦(∅)𝑅 𝑥(𝜓)
0
0
1
=
𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅
𝑐𝑜𝑠𝜃𝑠𝑖𝑛𝜓 + 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃𝑠𝑖𝑛∅
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
𝑅 𝑧𝑥𝑦 = 𝑅 𝑧(𝜃) 𝑅 𝑥(𝜓)𝑅 𝑦(∅)
0
0
1
=
𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅
𝑐𝑜𝑠𝜃𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 + 𝑠𝑖𝑛∅𝑐𝑜𝑠𝜃
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
Accelerometer Readings
V K Jadon, Prof., Mechanical Engineering, Chitkara University 24
Angle Measurement
Solving 𝑅 𝑥𝑦𝑧 for the Roll (𝜓) and Pitch (∅) Angles
The rotation sequence 𝑅 𝑥𝑦𝑧 is widely used in the aerospace
industry and is termed the 'aerospace rotation sequence‘.
𝐺 𝑝𝑥
𝐺 𝑝𝑦
𝐺 𝑝𝑧
=
−𝑠𝑖𝑛∅
𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓
𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
𝐺 𝑝𝑥 = −𝑠𝑖𝑛∅
𝐺 𝑝𝑦 = 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓
𝐺 𝑝𝑧 = 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓
tan 𝜓 𝑥𝑦𝑧 =
𝐺 𝑝𝑦
𝐺 𝑝𝑧
tan ∅ 𝑥𝑦𝑧 =
−𝐺 𝑝𝑥
𝐺 𝑝𝑦
2
+ 𝐺 𝑝𝑧
2
𝜋
4
−
3𝜋
4
𝑠𝑖𝑛
𝜋
4
=
1
2
𝑐𝑜𝑠
𝜋
4
=
1
2
𝑡𝑎𝑛
𝜋
4
= 1
𝑠𝑖𝑛 −
3𝜋
4
= −
1
2
𝑐𝑜𝑠 −
3𝜋
4
= −
1
2
𝑡𝑎𝑛 −
3𝜋
4
= 1
𝑡𝑎𝑛−1
1
1
= 𝑡𝑎𝑛−1
−1
−1
atan function does not distinguish
between opposite angles
atan2 function takes into account the ratio
and sign of 𝑦 and 𝑥
𝑎𝑡𝑎𝑛2 1, 1 =
𝜋
4
𝑎𝑡𝑎𝑛2 −1, −1 = −
3𝜋
4
Gyroscope
𝝎
𝑿𝒁
𝒀
MEMS gyroscopes measure the angular
rate of rotation of one or more axes
V K Jadon, Prof., Mechanical Engineering, Chitkara University
Gyroscope
𝒗 𝑨 = 𝝎 × 𝒓 𝑨
𝝎
𝒙
𝒛
𝒚
Path of the ball as seen by an
observer moving with table
Path of the ball as
seen from fixed frame
𝒗 𝑪
𝒙
𝒛
𝒚
Position of ball
after some time ∆𝑡
𝒗 𝑩
𝑩
𝑩
Point B after time∆𝑡
𝒗 𝑨
𝒗 𝒃𝒂𝒍𝒍
Ball has two velocities
V K Jadon, Prof., Mechanical Engineering, Chitkara University
Gyroscope
𝒗 𝑨 = 𝝎 × 𝒓 𝑨
𝒗 𝒃𝒂𝒍𝒍
𝝎
𝒙
𝒛
𝒚
𝝎 𝒗 𝒃𝒂𝒍𝒍
MEMS gyroscopes use vibrating
mechanical elements (proof-mass) to
sense rotation caused by Coriolis
acceleration.
The ADC sample rate is programmable from 8,000 samples per second,
down to 3.9 samples per second, and user-selectable low-pass filters
enable a wide range of cut-off frequencies.
Three-Axis MEMS Gyroscope with 16-bit ADCs and Signal Conditioning
Gyroscope Setup-MPU6050
V K Jadon, Prof., Mechanical Engineering, Chitkara University 28
The MPU-60X0 consists of three independent vibratory MEMS rate
gyroscopes, which detect rotation about the X-, Y-, and Z- Axes.
When the gyros are rotated about any of the sense axes, the Coriolis
Effect causes a vibration that is detected by a capacitive pickoff.
The signal is amplified, demodulated, and filtered to produce a voltage
that is proportional to the angular rate.
This voltage is digitized using individual on-chip 16-bit Analog-to-
Digital Converters (ADCs) to sample each axis.
The full-scale range of the gyro sensors may be digitally programmed
to ±250, ±500, ±1000, or ±2000 degrees per second (dps).
𝑟𝑝𝑚 =
𝑟𝑎𝑛𝑔𝑒(°/𝑠)
360
× 60
Range Condition 𝒅𝒆𝒕𝒆𝒄𝒕𝒂𝒃𝒍𝒆 𝒓𝒑𝒎 Register Bit
±250 0 41.67 0x00000000
±500 1 83.33 0x00001000
±1000 2 166.7 0x00010000
±2000 3 333.3 0x00011000
Gyroscope Setup
V K Jadon, Prof., Mechanical Engineering, Chitkara University 29
V K Jadon, Prof., Mechanical Engineering, Chitkara University
For a FS_SEL =1
LSB Sensitivity = 65.5
Register Bit = 0x00001000
𝜔(𝑦𝑎𝑤 𝑟𝑜𝑡𝑎𝑡𝑖𝑜𝑛) = 1 0
𝑠 𝑔𝑦𝑟𝑜 𝑧 = 65.5
𝜔(𝑦𝑎𝑤 𝑟𝑜𝑡𝑎𝑡𝑖𝑜𝑛) = 5 0
𝑠 𝑔𝑦𝑟𝑜 𝑧 = 327.5
At any
particular
time
To convert Gyro values into instantaneous angular rate
𝑖𝑛𝑠𝑡𝑎𝑛𝑡𝑎𝑛𝑒𝑜𝑢𝑠 𝑎𝑛𝑔𝑢𝑙𝑎𝑟 𝑟𝑎𝑡𝑒 =
𝑔𝑦𝑟𝑜 𝑥,𝑦,𝑧
𝐿𝑆𝐵 𝑆𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦
=
327.5
65.5
= 5 0
𝑠
To measure total angle travelled
add all instantaneous angles obtained for
small time duration, ∆𝑡
𝜔 =
𝑑𝜃
𝑑𝑡
𝑑𝜃 = 𝜔𝑑𝑡 𝜃 =
𝑡1
𝑡2
𝜔𝑑𝑡
Gyroscope Data
V K Jadon, Prof., Mechanical Engineering, Chitkara University
𝜃 =
𝑡1
𝑡2
𝜔𝑑𝑡
𝜔
𝑡
𝜔
𝑡
∆𝑒
Drift error
Drift error is gradual divergence between the true
orientation and estimated orientation by gyro due to error
in measurement.
𝑒
𝑡
Use other sensors to bring down the drift error to
zero. Take angles with reference to world frame.
Gradually apply corrections.
• These correction are to be fast enough to fully
compensate the drift error.
• Slow enough to avoid jerky compensations
Tilt Error or (roll and pitch angle error)
Yaw Error
Linear accelerometer
Magnetometer
The noise part is
also integrated
V K Jadon, Prof., Mechanical Engineering, Chitkara University
gyro_pitch_angle=gyro_pitch_angle+ gyro_roll_angle * sin(gyro_z)
gyro_roll_angle=gyro_roll_angle- gyro_pitch_angle * sin(gyro_z)
Transfer of Yaw angles
V K Jadon, Prof., Mechanical Engineering, Chitkara University
The gyroscope drift is mainly due to the integration of two components: a slow changing, near-dc variable
called bias instability and a higher frequency noise variable called angular random walk (ARW).
The yaw axis is most sensitive to this drift. A good portion of the pitch (attitude) and roll axis gyroscope drift
can be removed within an IMU through the use of accelerometer feedback to monitor position relative to
gravity.
Ideally, two references are needed to correct for gyroscope drift on all axes.
An IMU with nine degrees of freedom typically provides additional magnetometer sensors - about 3 axes.
A magnetometer senses field strength relative to the Earth’s magnetic North. These sensors can be used
together with accelerometer data, as another external reference, to mitigate the impact of gyroscope drift
error on the yaw axis.
V K Jadon, Prof., Mechanical Engineering, Chitkara University
However, design of proper spatial magnetometers can be a less reliable vector than an
accelerometer, as there are many things that create magnetic fields within the same order of
magnitude as that of the Earth.
Another one of the more effective methods for cancelling long-term drift is to implement a zero
angular velocity update to the gyroscope. Any time the device is known to be completely stationary,
the gyroscope offset can be nulled to zero for that respective axis.
This opportunity can vary wildly depending on the application. But any instance that the system is at a
recurring resting state can be used for nulling, such as an idling car, a stationary autonomous robot,
or the time between human foot steps.
Of course, using a state-of-the-art IMU that has minimal bias instability within the design at the onset
may offer the most immediate impact on gyroscope drift.
The constant bias error of a gyroscope can be measured by taking the average of the output over a
long period of time while the device is not rotating.
Thanks
V K Jadon, Prof., Mechanical Engineering, Chitkara University 35

More Related Content

PPTX
MPU6050 IMU with Arduino
PPTX
UART Communication
PPTX
Atmel and pic microcontroller
PPT
PPTX
MR3491 SENSORS AND INSTRUMENTATION (UNIT V - SIGNAL CONDITIONING AND DAQ SYST...
PPT
Adc interfacing
PPT
I2 c
MPU6050 IMU with Arduino
UART Communication
Atmel and pic microcontroller
MR3491 SENSORS AND INSTRUMENTATION (UNIT V - SIGNAL CONDITIONING AND DAQ SYST...
Adc interfacing
I2 c

What's hot (20)

PPTX
8051 timer counter
PPSX
ATmega32
PPT
Wireless personal area networks(PAN)
PPTX
PPTX
Sequential cmos logic circuits
PPTX
Home automation voice control
PPT
Sensors
PPTX
Serial Communication & Embedded System Interface
PDF
Sensors for Biomedical Devices and systems
PPTX
Electronic Voting Machine
PPT
biomedical signal processing
PPTX
Smart sensors and their Application
PPTX
PIC Microcontroller | ADC Interfacing
PPTX
Iot Based fish aquarium
PPTX
COUNTERS(Synchronous & Asynchronous)
PPTX
Spi in arm7(lpc2148)
PDF
Automatic water level monitoring and control system using IoT
PPTX
Case study on smart card (embeded system) based on IOT
PPTX
VLSIM4.pptx
PPTX
UART(universal asynchronous receiver transmitter ) PPT
8051 timer counter
ATmega32
Wireless personal area networks(PAN)
Sequential cmos logic circuits
Home automation voice control
Sensors
Serial Communication & Embedded System Interface
Sensors for Biomedical Devices and systems
Electronic Voting Machine
biomedical signal processing
Smart sensors and their Application
PIC Microcontroller | ADC Interfacing
Iot Based fish aquarium
COUNTERS(Synchronous & Asynchronous)
Spi in arm7(lpc2148)
Automatic water level monitoring and control system using IoT
Case study on smart card (embeded system) based on IOT
VLSIM4.pptx
UART(universal asynchronous receiver transmitter ) PPT
Ad

Similar to Inertial Measurement Unit-Accelerometer and Gyroscope MPU6050 (20)

DOCX
Motorized pan tilt(Arduino based)
PDF
Short Range Radar System using Arduino Uno
PDF
Ee24832835
PDF
Netzer ds 247-128-specsheet
PDF
Ju2416921695
PPT
"Empowering Motion: A Dive into Actuators"
PDF
Assembler4
PDF
Netzer ds 37-16-specsheet
PDF
Gesture Controlled Chair
PDF
Design of Counter Using SRAM
PPT
Meeting w10 chapter 3 part 3
PPT
UAV Presentation
PPT
IMPLEMENTING A DIGITAL MULTIMETER
PDF
Design and Implementation of Schmitt Trigger using Operational Amplifier
PDF
Hand Gesture Control Robot
PDF
MaxBotix Code Examples
PPTX
Xbee Wireless Throttle Position Sensor And Control
PPT
Wireless Microcontroller (IEEE802.15.4 and ZigBee): JN5139
DOCX
Training Report on embedded Systems and Robotics
PDF
Scaling Down Instrumentation Deploying Analog Mixed Signal Technology
Motorized pan tilt(Arduino based)
Short Range Radar System using Arduino Uno
Ee24832835
Netzer ds 247-128-specsheet
Ju2416921695
"Empowering Motion: A Dive into Actuators"
Assembler4
Netzer ds 37-16-specsheet
Gesture Controlled Chair
Design of Counter Using SRAM
Meeting w10 chapter 3 part 3
UAV Presentation
IMPLEMENTING A DIGITAL MULTIMETER
Design and Implementation of Schmitt Trigger using Operational Amplifier
Hand Gesture Control Robot
MaxBotix Code Examples
Xbee Wireless Throttle Position Sensor And Control
Wireless Microcontroller (IEEE802.15.4 and ZigBee): JN5139
Training Report on embedded Systems and Robotics
Scaling Down Instrumentation Deploying Analog Mixed Signal Technology
Ad

More from Vijay Kumar Jadon (16)

PPTX
PDF
Session 2 jan17
PPTX
Outcome Based Education and Assessment
PPTX
Analysis and design eccentric loading
PPTX
Program outcome maping
PPTX
Concept of state of stress and strain
PPTX
Free Body Diagram - FBD
PPTX
tensile test - stress strain curve
PPTX
Design equation for static load
PPTX
Introduction to Aerial Robotics
PPTX
Aerial Robotics
PPTX
Tensile test
PPTX
Design equation for static load
PPTX
Machine design philosophy
PDF
quadcopter modelling and controller design
PPTX
Mechanics of Quadcopter
Session 2 jan17
Outcome Based Education and Assessment
Analysis and design eccentric loading
Program outcome maping
Concept of state of stress and strain
Free Body Diagram - FBD
tensile test - stress strain curve
Design equation for static load
Introduction to Aerial Robotics
Aerial Robotics
Tensile test
Design equation for static load
Machine design philosophy
quadcopter modelling and controller design
Mechanics of Quadcopter

Recently uploaded (20)

PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
communication and presentation skills 01
PDF
Design Guidelines and solutions for Plastics parts
PPTX
Information Storage and Retrieval Techniques Unit III
PPTX
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Artificial Intelligence
PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
Safety Seminar civil to be ensured for safe working.
communication and presentation skills 01
Design Guidelines and solutions for Plastics parts
Information Storage and Retrieval Techniques Unit III
Sorting and Hashing in Data Structures with Algorithms, Techniques, Implement...
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Artificial Superintelligence (ASI) Alliance Vision Paper.pdf
Categorization of Factors Affecting Classification Algorithms Selection
AUTOMOTIVE ENGINE MANAGEMENT (MECHATRONICS).pptx
Exploratory_Data_Analysis_Fundamentals.pdf
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
Automation-in-Manufacturing-Chapter-Introduction.pdf
Artificial Intelligence
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
August 2025 - Top 10 Read Articles in Network Security & Its Applications
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
"Array and Linked List in Data Structures with Types, Operations, Implementat...

Inertial Measurement Unit-Accelerometer and Gyroscope MPU6050

  • 2. Micro: Very small in size. Measured in micrometer(μm) 1 μm = 10-6 m Electro: MEMS have electrical components Mechanical: MEMS have moving parts Systems: Refers to integration of components. We find MEMS in Automobiles (Air bag sensors) Computer printers (Ink jet print heads) Cell phones (RF devices) Optical devices (Micromirrors) MEMS They have also found application in the healthcare domain in devices such as blood pressure monitors, pacemakers, ventilators, and respirators. Air bag crash sensors Active suspension systems Antilock brake systems Ride control systems V K Jadon, Prof., Mechanical Engineering, Chitkara University 2
  • 3. Accelerometer 𝑥, 𝑎 𝑘 𝑚 𝑥, 𝑎 𝑘 𝑚 𝑥, 𝑎 −𝑘𝑥 = 𝑚𝑎 𝑘 𝑚 𝑚𝑎𝑠𝑠 𝑖𝑠 𝑑𝑖𝑠𝑝𝑙𝑎𝑐𝑒𝑑 𝑎 = − 𝑘 𝑚 𝑥 𝑎 = 𝑓(𝑥) External Force in the direction of displacement =mass×acceleration 𝑚 𝑘𝑥 𝑎 𝐶 = 𝑓(𝐴/𝑥) 𝐶 = 𝑓(𝐴/𝑎) Accelerometer measures linear acceleration Acceleration is opposite to the displacement 𝐶 = 𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑎𝑛𝑐𝑒 𝐴 = surface area of capacitor plates V K Jadon, Prof., Mechanical Engineering, Chitkara University 3
  • 4. Displacement of the frame changes the differential capacitance Capacitive accelerometers offer high sensitivities and are utilized for low-amplitude, low-frequency devices. Accelerometer 𝒙 𝒛 𝒚 Internal moveable assembly Proof mass Spring External Fixed assembly MPU6050 measures linear acceleration in terms of g force Usefulness of accelerometer in IMU will be discussed later V K Jadon, Prof., Mechanical Engineering, Chitkara University 4
  • 5. VCC GND SCL SDA XDA XCL ADO INT X Y I2C ProtocolGyro Accelerometer MPU6050 Pinout Clock pulse for I2C Communication Data through I2C communication Data to external sensors Clock pulse to external sensors I2C Slave Address Interrupt digital output The SCL line is the clock signal which synchronize the data transfer between the devices on the I2C bus. Clock signal is generated by the master device.
  • 6. The full scale range of the digital output can be adjusted to ±2g, ±4g, ±8g, or ±16g. Three-Axis MEMS Accelerometer with 16-bit ADCs and Signal Conditioning MPU6050: MEMS Accelerometer The MPU-60X0’s 3-Axis accelerometer uses separate proof masses for each axis. Acceleration along an axis induces displacement on the corresponding proof mass, and capacitive sensors detect the displacement differentially. When the device is placed on a flat surface, it will measure 0g on the X- and Y-axes and +1g on the Z-axis (upward). Each sensor has a dedicated ADC for providing digital outputs. V K Jadon, Prof., Mechanical Engineering, Chitkara University 6
  • 7. UNO Arduino AREF GND 13 12 ~11 ~10 ~9 8 7 ~6 ~5 4 ~3 2 TX-1 RX-0 IOREF RESET 3.3V 5V GND GND Vin A0 A1 A2 A3 A4 A5 ON TX RX L Arduino Uno Pinout master out slave in master in slave out Serial Clock Slave Select V K Jadon, Prof., Mechanical Engineering, Chitkara University 7
  • 10. I2C Protocol V K Jadon, Prof., Mechanical Engineering, Chitkara University 10 • Begins with a start bit • 7 bit Address is transmitted • 1 control bit to indicate Master to Read from or write to slave • If communicated slave send ack bit to Master • Master to send 8 bit Internal Register Address • Slave send back ack bit • Master transmits data in 8 bits chunk • Write request – Slave sends ack bit to Master • Read request – Master sends ack bit to Slave I2C addresses are generally 7 bits, yielding an address between 0 and 127. The addresses from 0 to 7 are not used because are reserved. So, the first address that can be used is 8 S B6 B5 B4 B3 B2 B1 B0 R/W Ack B7 B6 B5 B4 B3 B2 B1 B0 Ack B7 B6 B5 B4 B3 B2 B1 B0 Ack S 7 bit Device Address sequence 8 bit internal Register Address sequence 8 bit data sequence • Ends with a stop bit
  • 11. V K Jadon, Prof., Mechanical Engineering, Chitkara University 11 <Wire.h> Library Wire.begin(address) function initiates Wire library Wire.beginTransmission(address) begins transmission to the particular sensor Wire.beginTransmission(0b1101000) Wire.endTransmission(address) Transmits data in buffer and return a status byte, 0 for success. Wire.endTransmission(0b1101000) write() buffers data for sending Wire.write(value) Wire.write(string) Wire.write(data, length) value: a value to send as a single byte string: a string to send as a series of bytes data: an array of data to send as bytes length: the number of bytes to transmit write() will return the number of bytes written, though reading that number is optional address: the 7-bit slave address (optional); if not specified, join the bus as a master. Start condition to the slave device with the given address. It asks for data from the internal registers of the slave device S B6 B5 B4 B3 B2 B1 B0 R/W A B7 B6 B5 B4 B3 B2 B1 B0 A B7 B6 B5 B4 B3 B2 B1 B0 A S
  • 12. V K Jadon, Prof., Mechanical Engineering, Chitkara University 12 <Wire.h> Library requestFrom() Used by the master to request bytes from a slave device.. The default value is true. If true, requestFrom() sends a stop message after the request, releasing the I2C bus. If false, requestFrom() sends a restart message after the request. Wire.requestFrom(address, quantity) Wire.requestFrom(address, quantity, stop) If false, the bus will not be released, which prevents another master device from requesting between messages. This allows one master device to send multiple requests while in control. The Wire.available() function will return the number of bytes available for retrieval and if that number match with our requested bytes Wire.read() function we will read the bytes from the two registers of the X axis. I2C Scanner
  • 15. V K Jadon, Prof., Mechanical Engineering, Chitkara University 15 MPU6050 Setup Read Accelerometer data using Arduino Start I2C Communication ― Use Wire.begin() to initiate wire.h ― Wire.beginTransmission(SDA) Slave Device Address (SDA)=1101000 AD0=Low Slave Device Address (SDA)=1101001 AD0=High Reference – Product Specifications (Revision 3.4) Section 9.2 pp33 ― Wire.write(0x6B) Internal Register Address Sequence to access Power management register (0x6B) ― Wire.write(0b00000000) Data Transfer Bit Sequence to awake MPU ― Wire.endTransmission(1101000)
  • 16. FS Range AFS_SEL Register Bit LSB Sensitivity ADC Bits ±2g 0 0b00000000 16384 LSB/g 15 bit ±4g 1 0b00001000 8192 LSB/g 14 bits ±8g 2 0b00010000 4096 LSB/g 13 bits ±16g 3 0b00011000 2048 LSB/g 12 bits 𝑥 ≈ 0 𝑦 ≈ 0 𝑧 ≈ 1𝑔 𝑦 ≈ 0 𝑧 ≈ 0 𝑥 ≈ 1𝑔 𝑧 ≈ 0 𝑥 ≈ 0 𝑦 ≈ 1𝑔 V K Jadon, Prof., Mechanical Engineering, Chitkara University 16 Accelerometer Setup The MPU-60X0 features three 16-bit ADCs for digitizing the accelerometer outputs. For precision tracking of both fast and slow motions, the parts feature a user- programmable accelerometer full-scale range of ±2g, ±4g, ±8g, and ±16g. Reference – Product Specifications (Revision 3.4) Section 6.2 pp13 ― Wire.beginTransmission(0b1101000) ― Wire.write(0b00000000) ― Wire.endTransmission(0b1101000) ― Wire.write(0x1C)Reference – Register Map and Description (Revision 4.2) Section 4.5 pp15 Reference – Product Specifications (Revision 3.4) Section 3.1 pp7
  • 17. V K Jadon, Prof., Mechanical Engineering, Chitkara University 17 Read Accelerometer Data Reference – Register Map (Revision 4.2) Section 3 pp7 Wire.beginTransmission(0b1101000) 3B and 3C stores Acceleration data along x-axis 3D and 3E stores Acceleration data along y-axis 3F and 40 stores Acceleration data along z-axis We should give starting Internal Register Address to access all Read only registers after that. To transmit all acceleration data, we should write to 0x3B register. ― Wire.write(0x3B) Slave device transmit data in 8 bits(1 byte) Master store integers in 16 bits. ― Wire.endTransmission(0b1101000)
  • 18. V K Jadon, Prof., Mechanical Engineering, Chitkara University 18 Read Accelerometer Data For getting hold of the data available in buffer, master has to request using Wire.requestFrom(address, quantity) Wire.requestFrom(0b1101000, 6)Check availability of the data requested by the master Wire.available() It returns the number of received bytes from receive-buffer. Reads a byte that was transmitted from a slave device to a master after a call to requestFrom() using Wire.read() function. The each acceleration data is stored in two register (2 bytes) The data read is to be stored in one variable of int datatype. Every repeated Wire.read() gives the next byte available. accel_rawX = Wire.read()<<8|Wire.read(); 00001010 00001111 00001010-00000000 00001010-00001111 00001010
  • 19. V K Jadon, Prof., Mechanical Engineering, Chitkara University 19 Arduino Pseudo Code Set-Up MPU6050 Configure Accelerometer Read Accelerometer Data Every task starts with beginning communication with slave device and ends with terminating communication with slave device begin communication – Slave device address sequence access power management register – internal register address sequence Update power management register to disable SLEEP mode – data transfer sequence terminate communication – stop bit (one time execution) (one time execution) begin communication – Slave device address sequence access accelerometer configure register – internal register address sequence update accelerometer register to set full scale range – data transfer sequence terminate communication – stop bit (data needed continuously) Disable SLEEP mode Set Full Scale range Read accelerometer data
  • 20. V K Jadon, Prof., Mechanical Engineering, Chitkara University 20 Arduino Pseudo Code Set-Up MPU6050 Configure Accelerometer Read Accelerometer Data Every task starts with beginning communication with slave device and ends with terminating communication with slave device (data needed continuously) Disable SLEEP mode Set Full Scale range Access Register Read Data begin communication stop communication access accelerometer first data register Read accelerometer data begin communication stop communication Request data Check availability Read 8 bits and store in 16 bits data
  • 21. V K Jadon, Prof., Mechanical Engineering, Chitkara University 21 Angle Measurement 𝐹𝑥 𝒙 𝒚 𝒛 𝐹𝑦 𝐹𝑧 𝐹𝑥 2 + 𝐹𝑦 2 + 𝐹𝑧 2 𝐹𝑥 2 + 𝐹𝑦 2 𝐹𝑦 2 + 𝐹𝑧 2 𝐹𝑥 2 + 𝐹𝑧 2 𝒙 𝒚 𝒛 𝐹𝑥 2 + 𝐹𝑦 2 𝐹𝑦 2 + 𝐹𝑧 2 𝐹𝑥 2 + 𝐹𝑧 2
  • 22. V K Jadon, Prof., Mechanical Engineering, Chitkara University 22 There are six possible orderings of these three rotation matrices and, in principle, all are equally valid Angle Measurement 𝜓, ∅, 𝜃 are called as Roll, Pitch, and Yaw Angles 𝑅 𝑥 = 1 0 0 0 𝑐𝑜𝑠𝜓 −𝑠𝑖𝑛𝜓 0 𝑠𝑖𝑛𝜓 𝑐𝑜𝑠𝜓 𝑅 𝑦 = 𝑐𝑜𝑠∅ 0 𝑠𝑖𝑛∅ 0 1 0 −𝑠𝑖𝑛∅ 0 𝑐𝑜𝑠∅ 𝑅 𝑧 = 𝑐𝑜𝑠𝜃 −𝑠𝑖𝑛𝜃 0 𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 0 0 0 1 Initial force vector= 0 0 1 𝑮 𝒑 = 𝑮 𝒑𝒙 𝑮 𝒑𝒚 𝑮 𝒑𝒛 = 𝑹 0 0 1 𝑹 𝒙𝒚𝒛 0 0 1 = 𝑹 𝒙(𝜓)𝑹 𝒚(∅) 𝑹 𝒛(𝜃) 0 0 1 𝑹 𝒚𝒛𝒙 0 0 1 = 𝑹 𝒚(∅) 𝑹 𝒛(𝜃)𝑹 𝒙(𝜓) 0 0 1 𝑹 𝒚𝒙𝒛 0 0 1 = 𝑹 𝒚(∅) 𝑹 𝒙(𝜓)𝑹 𝒛(𝜃) 0 0 1 𝑹 𝒛𝒙𝒚 0 0 1 = 𝑹 𝒛(𝜃)𝑹 𝒙(𝜓)𝑹 𝒚(∅) 0 0 1 𝑹 𝒙𝒛𝒚 0 0 1 = 𝑹 𝒙(𝜓)𝑹 𝒛(𝜃)𝑹 𝒚(∅) 0 0 1 𝑹 𝒛𝒚𝒙 0 0 1 = 𝑹 𝒛(𝜃)𝑹 𝒚(∅)𝑹 𝒙(𝜓) 0 0 1
  • 23. V K Jadon, Prof., Mechanical Engineering, Chitkara University 23 The last four rotation sequences result in the accelerometer output being function of all three rotation angles and cannot therefore be solved. It is conventional therefore to select either the rotation sequence 𝑅 𝑥𝑦𝑧 or the sequence 𝑅 𝑦𝑥𝑧 to eliminate the yaw rotation ψ and allow solution for the roll φ and pitch θ angles. Angle Measurement 𝑮 𝒑 = 𝑮 𝒑𝒙 𝑮 𝒑𝒚 𝑮 𝒑𝒛 = 𝟏 𝐺 𝑝𝑥 2 + 𝐺 𝑝𝑦 2 + 𝐺 𝑝𝑧 2 𝐺 𝑝𝑥 𝐺 𝑝𝑦 𝐺 𝑝𝑧 = 𝐺 𝑝𝑥 𝐺 𝑝𝑦 𝐺 𝑝𝑧 𝑅 𝑥𝑦𝑧 0 0 1 = 𝑅 𝑥(𝜓)𝑅 𝑦(∅) 𝑅 𝑧(𝜃) 0 0 1 𝑅 𝑥𝑦𝑧 = 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜃 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜃 −𝑠𝑖𝑛∅ 𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓 − 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃 + 𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅ + 𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜓𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 𝑅 𝑥𝑦𝑧 = −𝑠𝑖𝑛∅ 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 𝑅 𝑦𝑥𝑧 = 𝑅 𝑦(∅) 𝑅 𝑥(𝜓)𝑅 𝑧(𝜃) 0 0 1 = −𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑠𝑖𝑛𝜓 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 𝑅 𝑥𝑧𝑦 = 𝑅 𝑥(𝜓)𝑅 𝑧(𝜃)𝑅 𝑦(∅) 0 0 1 = −𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅ 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 + 𝑐𝑜𝑠𝜓𝑠𝑖𝑛∅𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜓𝑐𝑜𝑠∅ − 𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑅 𝑥𝑧𝑦 = 𝑅 𝑥(𝜓)𝑅 𝑧(𝜃)𝑅 𝑦(∅) 0 0 1 = 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠𝜓𝑠𝑖𝑛∅ 𝑐𝑜𝑠𝜃𝑠𝑖𝑛𝜓 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 + 𝑠𝑖𝑛∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 𝑅 𝑧𝑦𝑥 = 𝑅 𝑧(𝜃)𝑅 𝑦(∅)𝑅 𝑥(𝜓) 0 0 1 = 𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠𝜓𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅ 𝑐𝑜𝑠𝜃𝑠𝑖𝑛𝜓 + 𝑐𝑜𝑠𝜓𝑠𝑖𝑛𝜃𝑠𝑖𝑛∅ 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 𝑅 𝑧𝑥𝑦 = 𝑅 𝑧(𝜃) 𝑅 𝑥(𝜓)𝑅 𝑦(∅) 0 0 1 = 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓𝑠𝑖𝑛𝜃 − 𝑐𝑜𝑠𝜃𝑠𝑖𝑛∅ 𝑐𝑜𝑠𝜃𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 + 𝑠𝑖𝑛∅𝑐𝑜𝑠𝜃 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 Accelerometer Readings
  • 24. V K Jadon, Prof., Mechanical Engineering, Chitkara University 24 Angle Measurement Solving 𝑅 𝑥𝑦𝑧 for the Roll (𝜓) and Pitch (∅) Angles The rotation sequence 𝑅 𝑥𝑦𝑧 is widely used in the aerospace industry and is termed the 'aerospace rotation sequence‘. 𝐺 𝑝𝑥 𝐺 𝑝𝑦 𝐺 𝑝𝑧 = −𝑠𝑖𝑛∅ 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 𝐺 𝑝𝑥 = −𝑠𝑖𝑛∅ 𝐺 𝑝𝑦 = 𝑐𝑜𝑠∅𝑠𝑖𝑛𝜓 𝐺 𝑝𝑧 = 𝑐𝑜𝑠∅𝑐𝑜𝑠𝜓 tan 𝜓 𝑥𝑦𝑧 = 𝐺 𝑝𝑦 𝐺 𝑝𝑧 tan ∅ 𝑥𝑦𝑧 = −𝐺 𝑝𝑥 𝐺 𝑝𝑦 2 + 𝐺 𝑝𝑧 2 𝜋 4 − 3𝜋 4 𝑠𝑖𝑛 𝜋 4 = 1 2 𝑐𝑜𝑠 𝜋 4 = 1 2 𝑡𝑎𝑛 𝜋 4 = 1 𝑠𝑖𝑛 − 3𝜋 4 = − 1 2 𝑐𝑜𝑠 − 3𝜋 4 = − 1 2 𝑡𝑎𝑛 − 3𝜋 4 = 1 𝑡𝑎𝑛−1 1 1 = 𝑡𝑎𝑛−1 −1 −1 atan function does not distinguish between opposite angles atan2 function takes into account the ratio and sign of 𝑦 and 𝑥 𝑎𝑡𝑎𝑛2 1, 1 = 𝜋 4 𝑎𝑡𝑎𝑛2 −1, −1 = − 3𝜋 4
  • 26. 𝝎 𝑿𝒁 𝒀 MEMS gyroscopes measure the angular rate of rotation of one or more axes V K Jadon, Prof., Mechanical Engineering, Chitkara University Gyroscope 𝒗 𝑨 = 𝝎 × 𝒓 𝑨 𝝎 𝒙 𝒛 𝒚 Path of the ball as seen by an observer moving with table Path of the ball as seen from fixed frame 𝒗 𝑪 𝒙 𝒛 𝒚 Position of ball after some time ∆𝑡 𝒗 𝑩 𝑩 𝑩 Point B after time∆𝑡 𝒗 𝑨 𝒗 𝒃𝒂𝒍𝒍
  • 27. Ball has two velocities V K Jadon, Prof., Mechanical Engineering, Chitkara University Gyroscope 𝒗 𝑨 = 𝝎 × 𝒓 𝑨 𝒗 𝒃𝒂𝒍𝒍 𝝎 𝒙 𝒛 𝒚 𝝎 𝒗 𝒃𝒂𝒍𝒍 MEMS gyroscopes use vibrating mechanical elements (proof-mass) to sense rotation caused by Coriolis acceleration.
  • 28. The ADC sample rate is programmable from 8,000 samples per second, down to 3.9 samples per second, and user-selectable low-pass filters enable a wide range of cut-off frequencies. Three-Axis MEMS Gyroscope with 16-bit ADCs and Signal Conditioning Gyroscope Setup-MPU6050 V K Jadon, Prof., Mechanical Engineering, Chitkara University 28 The MPU-60X0 consists of three independent vibratory MEMS rate gyroscopes, which detect rotation about the X-, Y-, and Z- Axes. When the gyros are rotated about any of the sense axes, the Coriolis Effect causes a vibration that is detected by a capacitive pickoff. The signal is amplified, demodulated, and filtered to produce a voltage that is proportional to the angular rate. This voltage is digitized using individual on-chip 16-bit Analog-to- Digital Converters (ADCs) to sample each axis. The full-scale range of the gyro sensors may be digitally programmed to ±250, ±500, ±1000, or ±2000 degrees per second (dps).
  • 29. 𝑟𝑝𝑚 = 𝑟𝑎𝑛𝑔𝑒(°/𝑠) 360 × 60 Range Condition 𝒅𝒆𝒕𝒆𝒄𝒕𝒂𝒃𝒍𝒆 𝒓𝒑𝒎 Register Bit ±250 0 41.67 0x00000000 ±500 1 83.33 0x00001000 ±1000 2 166.7 0x00010000 ±2000 3 333.3 0x00011000 Gyroscope Setup V K Jadon, Prof., Mechanical Engineering, Chitkara University 29
  • 30. V K Jadon, Prof., Mechanical Engineering, Chitkara University For a FS_SEL =1 LSB Sensitivity = 65.5 Register Bit = 0x00001000 𝜔(𝑦𝑎𝑤 𝑟𝑜𝑡𝑎𝑡𝑖𝑜𝑛) = 1 0 𝑠 𝑔𝑦𝑟𝑜 𝑧 = 65.5 𝜔(𝑦𝑎𝑤 𝑟𝑜𝑡𝑎𝑡𝑖𝑜𝑛) = 5 0 𝑠 𝑔𝑦𝑟𝑜 𝑧 = 327.5 At any particular time To convert Gyro values into instantaneous angular rate 𝑖𝑛𝑠𝑡𝑎𝑛𝑡𝑎𝑛𝑒𝑜𝑢𝑠 𝑎𝑛𝑔𝑢𝑙𝑎𝑟 𝑟𝑎𝑡𝑒 = 𝑔𝑦𝑟𝑜 𝑥,𝑦,𝑧 𝐿𝑆𝐵 𝑆𝑒𝑛𝑠𝑖𝑡𝑖𝑣𝑖𝑡𝑦 = 327.5 65.5 = 5 0 𝑠 To measure total angle travelled add all instantaneous angles obtained for small time duration, ∆𝑡 𝜔 = 𝑑𝜃 𝑑𝑡 𝑑𝜃 = 𝜔𝑑𝑡 𝜃 = 𝑡1 𝑡2 𝜔𝑑𝑡 Gyroscope Data
  • 31. V K Jadon, Prof., Mechanical Engineering, Chitkara University 𝜃 = 𝑡1 𝑡2 𝜔𝑑𝑡 𝜔 𝑡 𝜔 𝑡 ∆𝑒 Drift error Drift error is gradual divergence between the true orientation and estimated orientation by gyro due to error in measurement. 𝑒 𝑡 Use other sensors to bring down the drift error to zero. Take angles with reference to world frame. Gradually apply corrections. • These correction are to be fast enough to fully compensate the drift error. • Slow enough to avoid jerky compensations Tilt Error or (roll and pitch angle error) Yaw Error Linear accelerometer Magnetometer The noise part is also integrated
  • 32. V K Jadon, Prof., Mechanical Engineering, Chitkara University gyro_pitch_angle=gyro_pitch_angle+ gyro_roll_angle * sin(gyro_z) gyro_roll_angle=gyro_roll_angle- gyro_pitch_angle * sin(gyro_z) Transfer of Yaw angles
  • 33. V K Jadon, Prof., Mechanical Engineering, Chitkara University The gyroscope drift is mainly due to the integration of two components: a slow changing, near-dc variable called bias instability and a higher frequency noise variable called angular random walk (ARW). The yaw axis is most sensitive to this drift. A good portion of the pitch (attitude) and roll axis gyroscope drift can be removed within an IMU through the use of accelerometer feedback to monitor position relative to gravity. Ideally, two references are needed to correct for gyroscope drift on all axes. An IMU with nine degrees of freedom typically provides additional magnetometer sensors - about 3 axes. A magnetometer senses field strength relative to the Earth’s magnetic North. These sensors can be used together with accelerometer data, as another external reference, to mitigate the impact of gyroscope drift error on the yaw axis.
  • 34. V K Jadon, Prof., Mechanical Engineering, Chitkara University However, design of proper spatial magnetometers can be a less reliable vector than an accelerometer, as there are many things that create magnetic fields within the same order of magnitude as that of the Earth. Another one of the more effective methods for cancelling long-term drift is to implement a zero angular velocity update to the gyroscope. Any time the device is known to be completely stationary, the gyroscope offset can be nulled to zero for that respective axis. This opportunity can vary wildly depending on the application. But any instance that the system is at a recurring resting state can be used for nulling, such as an idling car, a stationary autonomous robot, or the time between human foot steps. Of course, using a state-of-the-art IMU that has minimal bias instability within the design at the onset may offer the most immediate impact on gyroscope drift. The constant bias error of a gyroscope can be measured by taking the average of the output over a long period of time while the device is not rotating.
  • 35. Thanks V K Jadon, Prof., Mechanical Engineering, Chitkara University 35