Difference between revisions of "TS-7180 IMU"

From Technologic Systems Manuals
(Replaced content with "{{:MPU-9250_IMU_userspace}}")
Tag: Replaced
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The TS-7180 has an optional MPU-9250 motion-tracking device.  This device provides:
* 3-axis Gyroscope
* 3-axis Accelerometer
* 3-axis Magnetometer
* Temperature sensor
The MPU-9250 is connected to the CPU via I2C.  The device is actually two chips in one: The first contains the gyroscope, accelerometer, and temperature sensor.  The second contains the magnetometer.  Because there are two chips, there are two I2C chip addresses: 0x69, and 0x0C.
User interface to the device is done through the sys filesystem. 
The gyroscope, accelerometer, and temperature readings are available at: '''/sys/bus/iio/devices/iio:device1'''
The magnetometer readings are available at: '''/sys/bus/iio/devices/iio:device2'''

Latest revision as of 08:50, 19 May 2020

This platform can support an MPU-9250 IMU (Inertial Measurement Unit) device. This provides a MEMS (Microelectromechanical Systems) gyroscope, accelerometer, and magnetometer. The physical interface is over an I2C bus, and the controlling software is entirely userspace. This allows for easy integration in to applications and reduces overhead of kernel calls. Support for this MPU-9250 is provided through a project called BB-MPU9150. While it is targeted at the MPU-9150, the MPU-9250 used on this platform is a lower power variant.

The following commands can be used to download, build, install, calibrate, and run the application for the IMU:

Clone the repository:

git clone https://github.com/embeddedarm/bb_mpu9150
cd bb_mpu9150/src/linux-mpu9150/

Build the project:

DEFS="-DMPU9250" make

# If building via a cross compiler, it can be passed on the command line:
CROSS_COMPILE=arm-linux-gnueabihf- DEFS="-DMPU9250" make

# It is also possible to specify the default I2C bus on the command line:
DEFS="-DMPU9250 -DDEFAULT_I2C_BUS=<bus>" make

See the I2C section for a listing of the I2C buses.

Calibration has two steps, one for the accelerometer and one for the magnetometer. The output of the calibration is saved in the current directory. In order to properly calibrate the IMU the tool must be started, and while it is running, the whole physical device must be slowly rotated completely through every axis. Being slow is key as this process is measuring the effect of gravity on the device for minimum and maximum values. Rapid movements during this time will increase the forces applied and will throw off the calibration. Once all of the axes have been rotated through, press ctrl+c to end the calibration and write the calibration file to disk.

Note the the proper I2C bus number must be passed in order for the tool to communicate with the IMU. See the I2C section for a listing of the I2C buses. If the tool was built with the correct

./imucal -b<bus> -a  # To calibrate the accelerometer, must move slowly
./imucal -b<bus> -m  # To calibrate the magnetometer, can move faster

The calibration tool will output 'accelcal.txt' and 'magcal.txt'. If these files are in the same folder as the 'imu' binary then they will automatically be loaded when the binary is executed.

At this point, the 'imu' binary can be run to gather and display samples of the data. The readings below were taken from a unit sitting flat on a desk after calibration was complete:

./imu -b<bus>

Initializing IMU .......... done

Entering read loop (ctrl-c to exit)

X: 1 Y: 3 Z: 76

For further information on using this tool, the various modes of operation it supports, and developing applications that use it please see the documentation in the BB-MPU9150 project github.