• Stars
    star
    1,025
  • Rank 44,923 (Top 0.9 %)
  • Language
    C++
  • Created over 10 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Arduino sketches for MPU9250 9DoF with AHRS sensor fusion

MPU-9250

Arduino sketch for MPU-9250 9 DoF sensor with AHRS sensor fusion

Most modern and correct version is: MPU9250_MS5637_AHRS_t3.ino, all require quaternionFilters.ino in the IDE folder also to use the Madgwick and/or Mahony sensor fusion algorithms.

Demonstrate MPU-9250 basic functionality including parameterizing the register addresses, initializing the sensor, getting properly scaled accelerometer, gyroscope, and magnetometer data out, calibration and self-test of sensors. Added display functions to allow display to on-breadboard monitor. Addition of 9 DoF sensor fusion using open source Madgwick and Mahony filter algorithms. Sketch runs on the 3.3 V 8 MHz Pro Mini and the Teensy 3.1.

A discussion of the use and limitations of this sensor and sensor fusion in general is found here.

I have also added a program to allow sensor fusion using the MPU-9250 9-axis motion sensor with the STM32F401 Nucleo board using the mbed compiler. The STM32F401 achieves a sensor fusion filter update rate using the Madgwick MARG fusion filter of 4800 Hz running the M4 Cortex ARM processor at 84 MHz; compare to the sensor fusion update rate of 2120 Hz achieved using the same filter with the Teensy 3.1 running its M4 Cortex ARM processor at 96 MHz.

One reason for this difference is the single-precision floating point engine embedded in the STM32F401 core. While both ARM processors achieve impressive rates of filtering, really more than necessary for most applications, the factor of two difference translates into much lower power consumption for the same sensor fusion performance. If adequate sensor fusion filtering, say, 1000 Hz, can be achieved at much lower processor clock speed, then over all power consumption will be reduced. This really matters for wearable and other portable motion sensing and control applications.

I added a version of the basic sketch that uses the i2c_t3.h 'Wire' library specifically designed for Teensy 3.1. It allows easy access to Teensy-specific capabilities such as specification of which set of hardware i2c pins will be used, the bus speed (up to 1 MHz!) and also allows master and/or slave designation to handle multiplexing between i2c devices. See www.pjrc.com/teensy and http://forum.pjrc.com/threads/21680-New-I2C-library-for-Teensy3 for details.

I added another version of the sketch intended specifically for the MPU9250_MS5637 Mini Add-On shield for the Teensy 3.1.

MPU9250 + MS5637 Micro (left) and Mini (right) add-on shields, which solder onto the bottom pads 23-34 or pins 8 -17 on the Teensy 3.1, respectively.

It can be simply modified to work with the corresponding micro shield as well. It uses SDA/SCL on pins 17/16, respectively, and it uses the Teensy 3.1-specific Wire library i2c_t3.h. The MS5637 is a simple but high resolution pressure sensor, which can be used in its high resolution mode with power consumption of 20 microAmp, or in a lower resolution mode with power consumption of only 1 microAmp. The choice will depend on the application. The sketch calculates and outputs temperature in degrees Centigrade, pressure in millibar, and altitude in feet. In high resolution mode, the pressure is accurate to within 10 Pa or 0.1 millibar, and the height discrimination is about 13 cm. This is much better performance than achievable from the venerable MPL3115A2 and the MS5637 is in a very small package perfect for the small micro and mini add-on Teensy 3.1 shields.

For a discussion of the relative merits of modern board-mounted pressure sensors, see here.

I added sketches for the various new Mini add-on shields for Teensy 3.1 with the MPU9250 9-axis motion sensor and either the MPL3115A2 or the newer LPS25H pressure sensor/altimeter. Now there are three flavors of 10 DoF Mini add-on boards specially designed for the Teensy 3.1 with state-of-the-art 20-bit (MPL3115A2) and 24-bit (MS5637 and LPS25H) altimeters. The LPS25H has a 32-byte FIFO and sophisticated hardware filtering which allows very low power operation while maintaining 0.01 millibar resolution. This is really quite a feat; this sensor deserves serious consideration for any airborne application you might have in mind.

More Repositories

1

MPU6050

Basic MPU6050 Arduino sketch of sensor function
C++
716
star
2

ESP32

Arduino sketches for the ESP32
C++
163
star
3

EM7180_SENtral_sensor_hub

(Affordable) Ultimate Sensor Fusion Solution
C++
96
star
4

CMWX1ZZABZ

Collection of sketches using the Arduino core for Murata's CMWX1ZZABZ (STM32L082 and SX1276)
C++
94
star
5

MPU9150

Arduino sketch for MPU9150 9DoF with AHRS sensor fusion
Arduino
75
star
6

ESP8285

ESP8285 Development Board
C++
55
star
7

BNO055

Teensiduino sketch for 9-axis BNO055 motion sensor + MS5637 pressure sensor
Arduino
54
star
8

LSM9DS1

ST's new smaller, lower-power 9-axis motion sensor
C++
40
star
9

LSM9DS0

LSM9DS0 9DOF sensor AHRS sketch
Arduino
39
star
10

ICM42688

Collection of Arduino sketches for TDK's combo accel/gyro motion sensor
C++
32
star
11

MPU6050HMC5883AHRS

9 DoF sensor fusion with AHRS output for MPU-6050 gyro/accel + HMC5883 magnetometer sensor
Arduino
28
star
12

ESP8266_Flight_Controller

Arduino
26
star
13

BMX-055

Arduino
22
star
14

VL53L5CX

Some sketches for the VL53L5CX ranging camera for use with the Arduino IDE
C++
22
star
15

IIS3DWB

Arduino sketches for ST's IIS3DWB vibration analyzer accelerometer
C++
21
star
16

Dragonfly

Arduino sketches for use with the Dragonfly (STM32L4)
C++
21
star
17

BME680

Arduino
21
star
18

ICM42605

C++ Arduino sketch with quaternion output
C++
21
star
19

AS7265X

18-channel, 40-nm FWHM spectrometer
C++
19
star
20

HT16K33_Display_Driver

Simple demo of driving four seven segment bubble displays with one HT16K33 display driver
Arduino
16
star
21

LSM6DSO

Sketches demonstrating utility of the LSM6DSO for motion sensing
C++
15
star
22

nRF52832DevBoard

C++
15
star
23

DS3231RTC

Basic sketch for the DS3231 Real Time Clock
Arduino
14
star
24

Butterfly

C++
13
star
25

nRF51822_IoT_Breakout

C++
12
star
26

VL6180X

Proximity sensor using ir laser range finding
C++
12
star
27

Katydid_STM32WB55

Arduino sketches for the STM32WB-based Katydid (aka Connected Motion Sense) wearable IoT platform
C++
12
star
28

VL53L0X

Arduino
11
star
29

CCS811

Arduino sketch for the BME280_CCS811 Air Quality Sensor Breakout
C++
11
star
30

PAA3905

Optical flow X-Y velocity sensor plus 35 x 35 pixel 15 Hz video camera
C++
10
star
31

GY-80

10DoF sensor fusion with AHRS
Arduino
10
star
32

MAX21100

MAX21100 6 DoF motion sensor with hardware 9 DoF sensor fusion
Arduino
10
star
33

STHS34PF80

ST IR temperature sensor with embedded presence and motion detection
C++
10
star
34

Teensy_Prop_Shield

Arduino
9
star
35

STM32F401

STM32F401 Nucleo 6- and 9-axis sensor fusion examples
C++
9
star
36

MMC5983MA

Arduino sketch for 10 DoF AHRS using the MMC5983MA magnetometer
C++
9
star
37

Ladybug

C++
9
star
38

SensorTile

Sensor Tile-eyes and ears
Arduino
9
star
39

LIS2DW12

Arduino sketches demonstrating operation of ST's LIS2DW12 low-power accelerometer
C++
9
star
40

LC709204F

OnSemi low-power LiPo battery fuel gauge
C++
8
star
41

IS31FL3246

36-channel led driver from Lumissil
C++
8
star
42

CaliPile

Arduino sketch for Excelitas' CaliPile TPiS 1S 1385 Thermoipile I2C sensor
C++
8
star
43

AS7331

Sample sketches for the AS7331 UVA/B/C light sensor by AMS
C++
8
star
44

LSM6DSM_LIS2MDL_LPS22HB

C++
8
star
45

BMA280

C++
7
star
46

LP5036

TI 12x rgb led driver
C++
7
star
47

ESP8266

Arduino
6
star
48

MMA8452Q

Sketch for the MMA8452Q Accelerometer
Arduino
6
star
49

FRDM-FXS-MULT

Freescale sensor evaluation board
Arduino
6
star
50

IS31FL3194

C++
5
star
51

AMG8833

Arduino
5
star
52

ILPS22QS

High-accuracy barometer and QVAR (touch) sensor
C++
5
star
53

APDS9500

Arduino
5
star
54

Rodan

Multi-sensor data logger with BLE programmable via USB using the Arduino IDE
C++
4
star
55

MC3635

mCube's ultra-low-power wake-on-motion 3-axis accelerometer
C++
4
star
56

PAW3902

Optical flow sensor with three light levels
C
4
star
57

SPIFlash

C++
4
star
58

LSM6DSV_GestureEngine

High-accuracy accel/gyro and barometer configured as gesture engine
C++
4
star
59

H3LIS331D

ST Microelectronics' Hi-g accelerometer
Arduino
4
star
60

BMP-180

Bosch's newest low-power, small-footprint, high-precision pressure sensor/altimeter
Arduino
4
star
61

VEML6075

Arduino
3
star
62

PAF9701

Arduino sketches for PixArt Imaging's 8 x 8 pixel IR thermal imaging camera
C++
3
star
63

PMW3901

C++
3
star
64

AssetTracker

C++
3
star
65

VEML6070

VEML6070 UV Sensor
Arduino
3
star
66

LSM6DSM_master_LIS2MDL_slave

Arduino sketches for two or more LSM6DSM on an I2C bus
C++
3
star
67

IS31FL3236A

Led ring of 36 white leds driven by the IS31FL3236A led driver
C++
3
star
68

APDS9253

Arduino sketch for the APDS9253 I2C RGBiR light sensor with threshold interrupt
C++
2
star
69

DRV8837

Arduino
2
star
70

TM915_RFID_Reader

Arduino
2
star
71

BME280

C++
2
star
72

M24M02_EEPROM

Arduino
2
star
73

HDC2010

Low-Power Digital Temperature and Humidity Sensor
C++
2
star
74

A1454-Hall-Sensor

Arduino sketch for A1454 I2C Hall Effect Sensor
C++
2
star
75

LP55231_LED_Driver

Arduino
2
star
76

Firefly

C++
1
star
77

BMA400

Arduino class for the BMA400 accelerometer
C++
1
star
78

TMP007

TI's IR thermopile temperature sensor in a small breakout board
Arduino
1
star
79

IQS624

C++
1
star
80

BM1422AGM

Arduino sketch to test BM1422AGM against LIS2MDL magnetometer
C++
1
star
81

AK9753

C++
1
star
82

VEML6040

Teensiduino sketch for Vishay's VEML6040 RGBW color sensor
C++
1
star
83

MLX90621

Arduino
1
star
84

BMA222E

Arduino
1
star
85

Teensy_Flight_Controller

Teensy Flight Control board test programs
C++
1
star
86

ITG3701_LSM303D_MS5637

Arduino
1
star
87

LSM303AGR

ST's combo accel/magnetometer (e-compass), sketch for Arduino
C++
1
star
88

KTD2061

Demo sketch for 36-channel KTD2058/KTD2061 rgb led driver family
C++
1
star