Accelerometer MPU 6050 Communication With AVR MCU

About: Rudra Narayan Paul, M.TECH (Comp.Sc.Engg.), BPUT......... ODISHA, INDIA. . (Home Town:- Jamshedpur, Jharkhand).....

MPU6050 sensor module is an integrated 6-axis Motion tracking device.

  • It has a 3-axis Gyroscope, 3-axis Accelerometer, Digital Motion Processor and a Temperature sensor, all in a single IC.
  • It can accept inputs from other sensors like 3-axis magnetometer, pressure sensor using its Auxiliary I2C bus.
  • If external 3-axis magnetometer is connected, it can provide complete 9-axis Motion Fusion output
  • Gyroscope and accelerometer reading along X, Y and Z axes are available in 2’s complement form. Temperature reading is available in signed integer form.
  • Gyroscope readings are in degrees per second (dps) unit; Accelerometer readings are in g unit; and Temperature reading is in degrees Celsius.
  • It has Auxiliary I2C bus to communicate with other sensor devices like 3-axis Magnetometer, Pressure sensor etc.

3-Axis Gyroscope

The MPU6050 consist of 3-axis Gyroscope with Micro Electro Mechanical System(MEMS) technology. It is used to detect rotational velocity along the X, Y, Z

Orientation and polarity

  • When the gyros are rotated about any of the sense axes, the Coriolis Effect causes a vibration that is detected by a MEM inside MPU6050.
  • The resulting signal is amplified, demodulated, and filtered to produce a voltage that is proportional to the angular rate.
  • This voltage is digitized using 16-bit ADC to sample each axis.
  • The full-scale range of output are +/- 250, +/- 500, +/- 1000, +/- 2000. - It measures the angular velocity along each axis in degree per second unit.

DMP (Digital Motion Processor)

The embedded Digital Motion Processor (DMP) is used to compute motion processing algorithms. It takes data from gyroscope, accelerometer and additional 3rd party sensor such as magnetometer and processes the data. It provides motion data like roll, pitch, yaw angles, landscape and portrait sense etc. It minimizes the processes of host in computing motion data. The resulting data can be read from DMP registers.

On-chip Temperature Sensor

On-chip temperature sensor output is digitized using ADC. The reading from temperature sensor can be read from sensor data register.

Step 1: MPU-6050 Module

The MPU-6050 module has 8 pins,

INT: Interrupt digital output pin.

AD0: I2C Slave Address LSB pin. This is 0th bit in 7-bit slave address of device. If connected to VCC then it is read as logic one and slave address changes.

XCL: Auxiliary Serial Clock pin. This pin is used to connect other I2C interface enabled sensors SCL pin to MPU-6050.

XDA: Auxiliary Serial Data pin. This pin is used to connect other I2C interface enabled sensors SDA pin to MPU-6050.

SCL: Serial Clock pin. Connect this pin to microcontrollers SCL pin. SDA: Serial Data pin. Connect this pin to microcontrollers SDA pin.

GND: Ground pin. Connect this pin to ground connection.

VCC: Power supply pin. Connect this pin to +5V DC supply. MPU-6050 module has Slave address (When AD0 = 0, i.e. it is not connected to Vcc) as,

Slave Write address(SLA+W): 0xD0

Slave Read address(SLA+R): 0xD1

Step 2: Calculations

Note:- that gyroscope and accelerometer sensor data of MPU6050 module consists of 16-bit raw data in 2’s complement form. Temperature sensor data of MPU6050 module consists of 16-bit data (not in 2’s complement form). Now suppose we have selected,

  • - Accelerometer full scale range of +/- 2g with Sensitivity Scale Factor of 16,384 LSB(Count)/g.
  • - Gyroscope full scale range of +/- 250 °/s with Sensitivity Scale Factor of 131 LSB (Count)/°/s. then,

To get sensor raw data, we need to first perform 2’s complement on sensor data of Accelerometer and gyroscope. After getting sensor raw data we can calculate acceleration and angular velocity by dividing sensor raw data with their sensitivity scale factor as follows--

Accelerometer values in g (g force)

  • Acceleration along the X axis = (Accelerometer X axis raw data/16384) g.
  • Acceleration along the Y axis = (Accelerometer Y axis raw data/16384) g.
  • Acceleration along the Z axis = (Accelerometer Z axis raw data/16384) g.

Gyroscope values in °/s (degree per second)

  • Angular velocity along the X axis = (Gyroscope X axis raw data/131) °/s.
  • Angular velocity along the Y axis = (Gyroscope Y axis raw data/131) °/s.
  • Angular velocity along the Z axis = (Gyroscope Z axis raw data/131) °/s.

Temperature value in °/c (degree per Celsius)

Temperature in degrees C = ((temperature sensor data)/340 + 36.53) °/c.

For example,

Suppose, after 2’ complement we get accelerometer X axes raw value = +15454

Then Ax = +15454/16384 = 0.94 g.

Step 3: Atmega - MPU6050 Connections

Just Connect everyting as given in the diagram....

  • To program MPU6050 (Gyro meter + Accelerometer + Temperature) sensor module with AVR based ATmega32 to read all sensor values and send all values on computer terminals over USART.
  • As MPU-6050 has I2C communication interface to connect it with I2C of ATmega32.
  • Module requires +5V DC power supply, so connect it to VCC pin of module.
  • Connect ground to GND pin of module.Here we have used PL2303 (Plorific usb ttL) serial to USB converter to send values serially to computer terminal.

Download Prolific Driver------------

http://www.prolific.com.tw/UserFiles/files/PL2303G...

Step 4: Results and Conclusion

shortly...

Share

    Recommendations

    • Party Challenge

      Party Challenge
    • Gardening Contest

      Gardening Contest
    • Arduino Contest 2019

      Arduino Contest 2019

    Discussions