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.
Table of Contents
- 1) Hardware
- 2) Software
- 3) Building and running
- 4) Conclusion
- 5) Video
1.1 Hardware Requirements:
1.2 Hardware Setup:
First, connect the Sensors Mezzanine to DragonBoard410c via low-speed expansion connector. Then, connect MPU6050 to I2C0 of Sensors Mezzanine.
2.1 Operating System
2.2 Package Dependencies
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install libmraa-dev python-opengl python-pygame
3. Building and Running:
$ 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