Tags: MPU6050, Triple, Axis, Accelerometer, and, Gyro, Breakout, GY-521

Accelerometer Gyro 3 Axis Breakout GY-521 MPU6050

  • 30.00 AED
    • Ex Tax:30.00 AED
    • Product Code: GY-521
    • Availability: In Stock
    MPU6050 consists of three 16 bit Analog to Digital Converters (ADCs) for digitizing the analog data from inbuilt Gyroscope and Accelerometer units. Gyroscope is available with the full scale range of ±250, ±500, ±1000, ±2000°/sec (dps) and Accelerometer is available with full-scale range of ±2g, ±4g..

    MPU6050 consists of three 16 bit Analog to Digital Converters (ADCs) for digitizing the analog data from inbuilt Gyroscope and Accelerometer units. Gyroscope is available with the full scale range of ±250, ±500, ±1000, ±2000°/sec (dps) and Accelerometer is available with full-scale range of ±2g, ±4g, ±8g, and ±16g. It also features on board Digital Low Pass Filter (DLPF) and supports I2C,SPI interfaces for communication. This breakout board also has the 5v Low Dropout Regulator (LDO), which allows us to use the Sensors Mezzanine I2C port for communication.

    SPECIFICATIONS: 

    • Three-axis gyroscope and three-axis accelerometer
    • Power Supply: 4.3 to 9 V
    • Communication Modes: standard IIC (I2C) communications protocol
    • Chip built-in 16bit ADC converter, 16-bit data output
    • Gyroscope Range: +/-250, +/-500, +/-1000, +/-2000 °/s
    • Acceleration Range: +/-2g, +/-4g, +/-8g, +/-16g
    • Dimensions (excluding pins): 21.2mm (0.84") length x 16.4mm (0.65") width x 3.3mm (0.13") height
    • Weight: 2.1g (0.07oz)

    This simple module contains everything required to interface to the Arduino and other controllers via I2C (use the Wire Arduino library) and give motion sensing information for 3 axes - X, Y and Z.

    And In this video we will show you how to set up MPU-6050 with Arduino:


    CLICK HERE to get the LIBRARIES AND SKETCHES for MPU6050  Accelerometer and Gyro Breakout GY-521.


    This module is an essential part of the Self Balancing bot and here is a link to learn how to do it by your self :

    IMU is the Inertial Measurement Unit used to measure acceleration, angular velocity and magnetic field. IMU commonly consists of 3 parts:

    1. Accelerometer - Used to measure acceleration/tilt
    2. Gyroscope - Used to measure angular velocity/orientation
    3. Magnetometer - Used to measure magnetic field

    Most of the time, these sensors are combined to form an Interial Measurement Unit (IMU). If Accelerometer is used alone it can give 3 degree of freedom which is also called 3-DoF. If a combination of Accelerometer and Gyroscope is used, we can get 6 degree of freedom which is also called 6-DoF. A combination of all of the above three sensors will give 9 degree of freedom which is also called 9-DoF.

     we are going to see how to interface 6-DoF IMU-MPU6050 with 96boards. Since our end goal is to build a Self Balancing bot, we don’t need magnetometer at all.

    MPU6050

    Accelerometer and Gyroscope readings are stored in 3 different registers for each axis. Each axis gives 16bit data, which can be read using the following code snippet:

    /* read raw accel data */
    accel_data[0] = i2c_read_word(i2c, MPU6050_REG_RAW_ACCEL_X) / MPU6050_ACCEL_SCALE;
    accel_data[1] = i2c_read_word(i2c, MPU6050_REG_RAW_ACCEL_Y) / MPU6050_ACCEL_SCALE;
    accel_data[2] = i2c_read_word(i2c, MPU6050_REG_RAW_ACCEL_Z) / MPU6050_ACCEL_SCALE;
    
    /* read raw gyro data */
    gyro_data[0] = i2c_read_word(i2c, MPU6050_REG_RAW_GYRO_X) / MPU6050_GYRO_SCALE;
    gyro_data[1] = i2c_read_word(i2c, MPU6050_REG_RAW_GYRO_Y) / MPU6050_GYRO_SCALE;			 
    gyro_data[2] = i2c_read_word(i2c, MPU6050_REG_RAW_GYRO_Z) / MPU6050_GYRO_SCALE;
    

    libmraa is used to communicate IMU using I2C0 bus.

    Complementary Filter

    In general, the Accelerometer data is prone to noise and Gyroscope data will drift over time. So, we can’t use those two data independently. The solution is to use some sort of sensor fusion algorithm which combines these two data and also filters out the noise/drift. Vastly employed filter is the Complementary filter, which is a combination of LPF, HPF and an Integrator. More detailed explanation can be found here.

    Complementary filter usage is shown in src/imu.c as follows:

    /* implement complementary filter for sensor fusion */
    angle_x = (0.98)*(angle_x + (gyro_data[0] * 0.02)) + (0.02 * x_rot);
    angle_y = (0.98)*(angle_y + (gyro_data[1] * 0.02)) + (0.02 * y_rot);
    

    3D rendering

    Alright, we are now done with getting data from IMU. But it’d be great to visualize the data using graphics processing capability of 96Boards. For doing this, we are going to use OpenGL and pygame inorder to get data from IMU and render it on 3D space.

    A small python script will implement 3D processing based on obtained data from C program. Basically, these two processes (C and Python) communicates using Unix SocketIPC mechanism. But, for running two processes simultaneously we have to run the C program (server) in background and Python program (client) in foreground.

    Source code and detailed instructions can be found in 96Boards projects repository.

    Demonstration video:


    Conclusion

    So, we have seen how to interface 6 DoF IMU with 96boards as well as rendering the data using OpenGL. 

    There are no reviews for this product.

    Write a review

    Please login or register to review