MEAM.Design - MAEVARM - mIMU 9-DOF Inertial-Measurement Unit


Operating on the mBUS peripheral subsystem, the mIMU module includes an Invensense MPU6050 co-located 3-axis accelerometer and 3-axis rate gyro, along with a Honeywell HMC5883L 3-axis magnetometer. The full-scale range for the 16-bit output from the Invensense chip can be configured to +/- 1g, 2g, 4g, or 8g for the accelerometer and +/- 125deg/s, 250 deg/s, 500deg/s, or 2000deg/s for the gyro, while the 12-bit magnetometer output is configured to 1090 LSB per gauss, providing better than 2-degree compass-heading accuracy. The update rate for the accelerometer and gyro are set to 8kHz, while the magnetometer updates at 15Hz.

NOTE: It appears that this first batch of mIMU operate with a halved full-scale range due to them being pre-production devices.

The mIMU can be connected to the m2 via either the 5-pin end connector or the 0.1" spaced through holes lining the sides of the board (CLK=D0, DAT=D1, INT=D2).


To use the mIMU module, you will first need to download and include support for the mBUS subsystem, which can be done from here. You will then need to download the following mIMU-specific support files:

Be sure to include the C file in your project:

  • For Windows OS users, if you're using Option 1, you will then need to right-click on the Source Files folder, and select Add Existing Source File(s)..., then select the m_imu.c file, and if you're using Option 2, place m_imu.c in src/.
  • For Mac and Linux users, if you're using Option 1, edit your Makefile to add "m_imu.o" after "main.o" on the OBJECTS line, and if you're using Option 2, place m_imu.c in src/.

Also, place the H file next to your main file for Option or place the H file in inc/ for Option 2, and include m_imu.h in your main routine.


A set of routines have been developed to easily configure and extract data from the sensors.

unsigned char = m_imu_init(unsigned char accel_scale, unsigned char gyro_scale)

Where accel_scale is one of the following: 0 (+/-1g), 1 (+/-2g), 2 (+/-4g), 3 (+/-8g), while gyro_scale is one of the following0 (+/-125deg/s), 1 (+/-250deg/s), 2 (+/-500deg/s), 3 (+/-1000deg/s) [Note: The production version of the Invensense MPU-6050 at the core of the mIMU has twice the range as the chip currently in the device, which is actually an "early engineering sample" version]. The function returns 1 if successful, or 0 if there is an error communicating with the device. While not included in this initialization routine, there are numerous other adjustable settings for both sensors, as can be discovered via the datasheet links above.

Once initialized, you can request data from the sensor using the following:

unsigned char = m_imu_raw(int* data)

Where data is the pointer to a nine-element int buffer. The function returns 1 if successful, and 0 if there is an error communicating with the device. The data in the buffer will be structured as follows:


NOTE: There is a rumor that my and mz are actually reversed!