This project shows how to interface 6 DoF IMU (Intertial Measurement Unit) with 96Boards. Sensor value will be read by a C program and passed to a Python script which does 3D rendering with the help of OpenGL and pygame. This allows us to visualize the rotation about X and Y axes graphically. Unix socket is used for IPC (Inter Process Communication) between C and Python processes.
First, connect the Sensors Mezzanine to DragonBoard410c via low-speed expansion connector. Then, connect MPU6050 to I2C0 of Sensors Mezzanine.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install libmraa-dev python-opengl python-pygame
$ git clone https://github.com/96boards-projects/imu.git
$ cd projects/imu
$ make
Now, hold the sensor in horizontal manner and run the generated binary as a background process
$ sudo ./imu&
Next, invoke the python script to visualize IMU data
$ sudo python visualize.py
Sensor can be moved about X and Y axes so that the tile on display also moves accordingly. Simply close the pygame window to exit both processes gracefully.
Before running the binary again, delete /tmp/socket as below:
$ sudo rm -rf /tmp/socket