GY-521 / MPU-6050 Module
The InvenSense MPU-6050 sensor contains a MEMS accelerometer and a MEMS gyro in a single chip.
It is very accurate, as it contains 16-bits analog to digital conversion hardware for each channel.
Therefor it captures the x, y, and z channel at the same time.
The MPU-6050 is not expensive, especially given the fact that it combines both an accelerometer and a gyro.
Also note that Invensense has combined the MPU-6050 with a magnetometer (compass) in a single chip called MPU-9150.
Reading raw values is easy, the rest is not Reading the raw values for the accelerometer and gyro is easy.
The sleep mode has to be disabled, and then the registers for the accelerometer and gyro can be read.
But the sensor also contains a 1024 byte FIFO buffer.
The sensor values can be programmed to be placed in the FIFO buffer.
And the buffer can be read by the Arduino.
The FIFO buffer is used together with the interrupt signal.
If the MPU-6050 places data in the FIFO buffer, it signals the Arduino with the interrupt signal so the Arduino knows that there is data in the FIFO buffer waiting to be read.
A little more complicated is the ability to control a second I2C-device.
The MPU-6050 always acts as a slave to the Arduino with the SDA and SCL pins connected to the I2C-bus.
But beside the normal I2C-bus, it has it’s own I2C controller to be a master on a second (sub)-I2C-bus. It uses the pins AUX_DA and AUX_CL for that second (sub)-I2C-bus.
It can control, for example, a magnetometer.
The values of the magnetometer can be passed on to the Arduino.
Things get really complex with the “DMP”.
The sensor has a “Digital Motion Processor” (DMP), also called a “Digital Motion Processing Unit”.
This DMP can be programmed with firmware and is able to do complex calculations with the sensor values.
For this DMP, InvenSense has a discouragement policy, by not supplying enough information how to program the DMP.
However, some have used reverse engineering to capture firmware.
The DMP (“Digital Motion Processor”) can do fast calculations directy on the chip.
This reduces the load for the microcontroller (like the Arduino).
The DMP is even able to do calculations with the sensor values of another chip, for example a magnetometer connected to the second (sub)-I2C-bus.
Product Images are shown for illustrative purposes only and may differ from actual product.