Skip to main content

A Python Library for Efficient MPU6050 DMP Access.

Project description

MPU6050 DMP Library

Abstract

This library is primarily derived from the contributions of Geir Istad and has been released as a pip-installable package. This library aims to simplify the use of digital motion processor (DMP) inside inertial motion unit (IMU), along with other motion data. The main focus of this package is on providing orientaion of the device in space as quaternion, which is convertable to euler angles. The resulting data are processed and denoised using extended Kalman filter (EKF), inside the DMP module.

To install this package, execute the following command:

pip install mpu6050

My main contributions to this library are towards enhancing the DMP results, detailed examples, usage description and making the library PyPI-installable. Apart from the great work done by Geir Istad, there were some issues encounterd in practice.

The enhancements are listed below:

  • Quaternion to euler angles conversion (roll, pitch, yaw) enhanced using scipy library

  • Linear (world-frame) acceleration rewritten using new formulas, based on quaternion

  • Better access to DMP frequency

  • Comprehensible, Practical examples with detailed explanation

  • Available on PyPI (pip installable)

This library is tested on Nvidia Jetson with I2C communication.

Introduction

The MPU6050 is a versatile accelerometer gyroscope chip with six axes of sensing capability and a 16-bit measurement resolution. This chip is widely popular due to its high accuracy and cost-effectiveness, making it a preferred choice among DIY enthusiasts and even in commercial products. The combination of gyroscope and accelerometers in the MPU6050 forms what is known as an Inertial Measurement Unit (IMU), which finds applications in various fields like mobile phones, tablets, robotics, and more.

The Digital Motion Processor (DMP) is a powerful feature of certain motion sensing chips, such as the MPU6050, which is a versatile accelerometer and gyroscope chip with six axes of sensing capability and a 16-bit measurement resolution. The DMP is an onboard processor that handles complex sensor processing and fusion, offloading these tasks from the microcontroller. This allows for faster and more accurate sensor readings, which is particularly important in applications where real-time motion tracking is crucial.

Main Contributions

Here we go through the main changes in this library and the enhancements done for the ease of use.

Euler angles

One of the practical outputs coming from DMP is the quaternion, which represents the exact orientation of the IMU in space. In many uses, there is a need for Euler angles, which consists of roll, pitch and yaw.

The problem with the old library was that the conversion from quaternion to Euler angles was mostly incorrect. Thus, the new conversion method uses scipy to do the conversion. The results were satisfactory, after experiments done on Nvidia Jetson.

World-frame acceleration

The acceleration data acquired from an IMU is typically represented in a "body-frame," aligning with the IMU's axes.

However, in the realm of Inertial Navigation Systems (INS), having access to a world-frame acceleration vector is essential for accurate navigation. The illustration below illustrates the orientation of the world-frame and body-frame axes:

The rotation of a vector using a quaternion is achieved through the following formula:

$$A_p=q\times A\times q^*$$

where $q^*$ represents the conjugate of the quaternion q, and $A_p$ denotes the rotated original vector $A$.

The old library had mathematical issues with calculating the world-frame acceleration and the results were impractical. The following method

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mpu6050-0.0.2.tar.gz (20.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mpu6050-0.0.2-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file mpu6050-0.0.2.tar.gz.

File metadata

  • Download URL: mpu6050-0.0.2.tar.gz
  • Upload date:
  • Size: 20.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for mpu6050-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4740171923f544ba6410423a58ff94b636469fb1b1d3f9f1909a969191a62294
MD5 3cb5bd1e8e0a97f02cbf397272ab2b68
BLAKE2b-256 a8572d23c9eb289b35197f092e215970fc2f661e8fcd83fb44de6620e340e5fa

See more details on using hashes here.

File details

Details for the file mpu6050-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: mpu6050-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for mpu6050-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f549351f2fa055b2ad36efe2b55a75717f48bdd706b9de2fe10da23c136e03d3
MD5 048d80001d1c8d0876c756026268a4cf
BLAKE2b-256 d11517945ba93be1e5ef66003b72e48cd22074a9041b58b799396fa983c8ba69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page