Exploring MPU6050 Motion Data with Arduino

Exploring MPU6050 Motion Data with Arduino — photograph from the project archive.

The MPU6050 combines accelerometer and gyroscope data in one I2C device. This folder preserves a raw-reading example and a digital motion processor example, together with a board photo, a module schematic and the original motion demonstration.

How the project works

The DMP sketch initializes the sensor, waits for a character in the Serial Monitor and enables an interrupt when data is ready. It reads packets from the FIFO and checks for overflow before decoding orientation data.

OUTPUT_READABLE_QUATERNION is enabled in the saved source. Euler angles, yaw/pitch/roll, linear acceleration and Teapot output are available as alternative compile-time options. The raw example is a separate starting point for inspecting accelerometer and gyroscope measurements without the DMP output format.

Hardware and configuration

ItemIn the supplied code
Sensor connectionI2C
Data-ready interruptExternal interrupt 0 / Uno D2
DMP serial rate115200 baud
Selected outputQuaternion

Working with the supplied code

Start with the connection test and check that packets arrive consistently. Change one output mode at a time so the Serial Monitor or visualization tool receives the format it expects.

The gyro and accelerometer offsets in the sketch were selected for a particular sensor. Recalibrate instead of copying them as universal constants. FIFO overflow messages are useful evidence of a servicing or timing problem; avoid adding lengthy delays to the packet-processing loop.

Exploring MPU6050 Motion Data with Arduino — photograph from the project archive.
Exploring MPU6050 Motion Data with Arduino — photograph from the project archive.

Video demonstration

Arduino MPU6050 6Axis — Ovidiu Carstea on YouTube

Source code and project files

Browse this project on GitHub. The files below are useful starting points for the sketches and references discussed in this post.

Download the used libraries (ZIP, 14.7 MB).

The sketches use the I2Cdev/MPU6050 example structure by Jeff Rowberg; retain the source notices.

These notes describe the archived source and project media. The sketches have not been rebuilt or tested on hardware for this article.

Scroll to Top