Skip to content
/ MPU Public
forked from BonaDrone/MPU9250

Cross-platform C++ library for InvenSense MPU Inertial Measurement Sensors

License

Notifications You must be signed in to change notification settings

Hish15/MPU

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository derives from a few different Arduino sketches created by Kris Winer to support the InvenSense MPU line of Internal Measurement Unit (IMU) sensors.

Here's what I changed:

  • Reorganized Kris's source code into the modern Arduino library format
  • Simplified the API
  • Added support for RaspberryPi via WiringPi
  • Added support for NVIDIA Jetson via i2cdev
  • Simplified the examples by removing code requiring components other than the MPU sensors

The following sensors are currently supported:

  • MPU6000
  • MPU6050
  • MPU6500
  • MPU9250

To use this library you will also need to clone the cross-platform support library.

The MPU6000 and 6500 communicate over the SPI bus. The MPU6050 communicates over the I2C bus. The MPU9250 is a bit more complicated: in master mode you access both sensors (MPU6500 accelerometer/gyrometer, AK8963 magnetometer) at once, over the I2C or SPI bus. In pass-through mode you communicate directly with the IMU and magnetometer over the I2C.

I have tested this library on the following hardware:

  • Butterfly STM32L433 development board, I2C

  • Teensy 3.2 development board, I2C

  • Raspberry Pi 3, I2C

  • Raspberry Pi Zero with PXFMini autopilot shield, SPI

  • NVIDIA Jetson TX1, I2C

  • Omnibus F3 flight controller (MPU6000)

  • Alienflight F3 V1 flight controller (MPU6050)

  • SPRacing F3 flight controller (MPU6500)

RaspberryPi users should download and install WiringPi, then cd to one of the example folders (e.g., extras/code/wiringpi/MPU6050 and type sudo make run.

NVIDIA Jetson users should install I2C support by running the command:

  sudo apt-get install libi2c-dev i2c-tools

Design Principles

As shown in the class hiearchy diagram below, the MPU library makes extensive use of C++ inheritance to share common code:

Because the MPU9250 contains an MPU6500, the MPU9250 is allowed to be a “friend” class of the MPU6500, sharing some of the latter's code.

About

Cross-platform C++ library for InvenSense MPU Inertial Measurement Sensors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 91.8%
  • Makefile 8.2%