В момента ресурсът е наличен само на английски

How to interface IMU with Raspberry Pi Pro Preview

Before we can program the car to learn how to move arround and to know its orientation in the space around, we need to setup the IMU.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #882
  • 01 Apr 2019

What is an IMU?

IMU is an abreviation for Inertia Measurement Unit. It is an electronic device combining accelerometers, gyroscopes and magnetometers. IMUS are usually used in aircrafts, smartphones and other devices that need to know their position and orientation in space. 

What is the IMU we are using?

The sensor we will be using is 10DOF (10 degrees of freedom) IMU Sensor manufactured by Waveshare. This means that it incorporates 10 different sensors. Those sensors are splitted among two modules - MPU9250 and BMP180. The MPU9250 consistes of 3-axis gyroscope, 3-axis accelerometer, and 3-axis magnetometer. This is the sensor that we will use. The BMP180 is barometric pressure sensor and we will not cover it in this section.

How to connect it?

The sensor comes with 6 male pins:

  • VCC (Voltage Common Collector) - This is a power supply pin. We should connect it to the 3.3V power pin on the raspberry.
  • GND (Ground) - This again is a power supply pin. As you may have guessed, we should connect it to a GND pin on the raspberry.
  • SDA (Serial Data Line) - This is the data line of the I2C bus. it should be connected to the 3rd pin of the raspberry (GPIO2).
  • SCL (Serial Clock Line) - This is the clock line of the I2C bus. It should be connected to the 5th pin of the raspberry (GPIO3).
  • INT (Interrupt Output) - This is the MPU9255 digital interrupt output. We will not use it for now.
  • FSYNC (Frame sync signal) - This is the MPU9255 frame sync input that latches to capture external bus interrupts. We will not use this pin too.

Setting up I2C on the raspberry

The image we have provided earlier in the course comes with I2C communication enabled. Once you have connected the IMU to the raspeberry, log on via ssh and run the following command:

sudo i2cdetect -y 1

If everything works fine you should see the following output:

      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77