Motion Tracking Using MPU-6000 and Raspberry Pi

Introduction: Motion Tracking Using MPU-6000 and Raspberry Pi

MPU-6000 is a 6-Axis Motion Tracking Sensor which has 3-Axis accelerometer and 3-Axis gyroscope embedded in it. This sensor is capable of efficient tracking of exact position and location of an object in the 3-dimensional plane. It can be employed in the systems which require position analysis to the highest precision.

In this tutorial the interfacing of the MPU-6000 sensor module with raspberry pi has been illustrated. To read the values of acceleration and rotational angle, we have used raspberry pi with an I2c adapter.This I2C adapter makes the connection to the sensor module easy and more reliable.

Step 1: Hardware Required:

The materials that we need for accomplishing our goal includes the following hardware components:

Step 2: Hardware Hookup:

The hardware hookup section basically explains the wiring connections required between the sensor and the raspberry pi. Ensuring correct connections is the basic necessity while working on any system for the desired output. So, the requisite connections are as follows:

The MPU-6000 will work over I2C . Here is the example wiring diagram, demonstrating how to wire up each interface of the sensor.

Out-of-the-box, the board is configured for an I2C interface, as such we recommend using this hookup if you’re otherwise agnostic.

All you need is four wires! Only four connections are required Vcc, Gnd, SCL and SDA pins and these are connected with the help of I2C cable.

These connections are demonstrated in the pictures above.

Step 3: Code for Motion Tracking:

The advantage of using raspberry pi is, that is provides you the flexibility of the programming language in which you want to program the board in order to interface the sensor with it. Harnessing this advantage of this board, we are demonstrating here its programming in the python. Python is one of the easiest programming languages with easiest syntax. The python code for MPU-6000 can be downloaded from our github community that is Control Everything Community.

As well as for the ease of the users, we are explaining the code here also:

As the first step of coding you need to download the SMBus library in case of python, because this library supports the functions used in the code. So, to download the library you can visit the following link:

The output of the sensor is shown in the picture above for the reference of the user.

Step 4: Applications:

MPU-6000 is a motion tracking sensor, which finds its application in the motion interface of smartphones and tablets. In smartphones these sensors can be employed in the applications such as gesture commands for applications and phone control, enhanced gaming, augmented reality, panoramic photo capture and viewing, and pedestrian and vehicle navigation. MotionTracking technology can convert handsets and tablets into powerful 3D intelligent devices that can be used in applications ranging from health and fitness monitoring to location-based services.