Skip to content
wmeizhi edited this page Dec 21, 2016 · 8 revisions

What is an IMU?

An inertial measurement unit (IMU) is an electronic device that measures and reports an object's specific force (G), angular rate, and magnetic field surrounding the object, using a combination of accelerometers, gyroscopes, and magnetometers.

Hardware

For our project, we used the 9DOF Sensor Stick IMU which utilizes the LSM9DS1 motion-sensing chip and houses a 3-axis accelerometer, 3-axis gyroscope, 3-axis magnetometer, and temperature reader. We have provided a datasheet for the LSM9DS1 in our repository as well as an object class for the IMU that is used in our car system.

Link to IMU product

I2C

The IMU is connected to the Raspberry Pi via I2C by physically connecting to the 3.3V, Ground, SDA, and SCL pins. In order to enable your Raspberry Pi I2C, please follow this guide. Adafruit Guide

Software

We utilized an existing API, the BerryIMU repository, and modified it completely for our specific IMU LSM9DS1 chip. Link to BerryIMU

The IMU object that we created can measure:

  • acceleration (x,y,z)
  • angular rate (x,y,z)
  • magnetic field (x,y,z)
  • temperature (Celsius)

It imports a file that houses all of the data registers from the chip, called LSM9DS1.py. We included separate python codes to read accelerometer, gyroscope, magnetometer, and thermometer, and users may change the sensor's modes as needed. For more information, please check imu modes and imu datasheet.

In our actual car system, we ended up only sampling for acceleration in y axis, yaw rate, and temperature. Using the raw data, we did some simple calculation such as converting acceleration to velocity and converting angular rate to turning angle. Note that We also used the encoder velocity to initialize V0 which is used to calculate the imu velocity.

Code modified and tested by:

Kristen Koyanagi and Meizhi Wang

Clone this wiki locally