MPU6050 Accelerometer and Gyroscope Module
The MPU6050 module is a Micro Electro-Mechanical Systems (MEMS) which consists of a 3-axis Accelerometer and 3-axis Gyroscope inside it. This helps us to measure acceleration, velocity, orientation, displacement and many other motion related parameter of a system or object.
MPU6050 Pinout Configuration
Pin Number |
Pin Name |
Description |
1 |
Vcc |
Provides power for the module, can be +3V to +5V. Typically +5V is used |
2 |
Ground |
Connected to Ground of system |
3 |
Serial Clock (SCL) |
Used for providing clock pulse for I2C Communication |
4 |
Serial Data (SDA) |
Used for transferring Data through I2C communication |
5 |
Auxiliary Serial Data (XDA) |
Can be used to interface other I2C modules with MPU6050. It is optional |
6 |
Auxiliary Serial Clock (XCL) |
Can be used to interface other I2C modules with MPU6050. It is optional |
7 |
AD0 |
If more than one MPU6050 is used a single MCU, then this pin can be used to vary the address |
8 |
Interrupt (INT) |
Interrupt pin to indicate that data is available for MCU to read. |
MPU6050 Features
- MEMS 3-aixs accelerometer and 3-axis gyroscope values combined
- Power Supply: 3-5V
- Communication : I2C protocol
- Built-in 16-bit ADC provides high accuracy
- Built-in DMP provides high computational power
- Can be used to interface with other IIC devices like magnetometer
- Configurable IIC Address
- In-built Temperature sensor
More features and technical specifications be found in the MPU6050 datasheet attached at the bottom of the article.
Alternative for MPU6050
ADXL335 (3-axis accelerometer), ADXL345 (3-axis accelerometer), MPU9250 (9-axis IMU)
Other Accelerometer
Where to Use MPU6050
The MPU6050 is a Micro Electro-Mechanical Systems (MEMS) which consists of a 3-axis Accelerometer and 3-axis Gyroscope inside it. This helps us to measure acceleration, velocity, orientation, displacement and many other motion related parameter of a system or object. This module also has a (DMP) Digital Motion Processor inside it which is powerful enough to perform complex calculation and thus free up the work for Microcontroller.
The module also have two auxiliary pins which can be used to interface external IIC modules like an magnetometer, however it is optional. Since the IIC address of the module is configurable more than one MPU6050 sensor can be interfaced to a Microcontroller using the AD0 pin. This module also has well documented and revised libraries available hence it’s very easy to use with famous platforms like Arduino. So if you are looking for a sensor to control motion for your RC Car, Drone, Self balancing Robot, Humanoid, Biped or something like that then this sensor might be the right choice for you.
How to Use MPU6050 Sensor
The hardware of the module is very simple, it actually comprises of the MPU6050 as the main components as shown above. Since the module works on 3.3V, a voltage regulator is also used. The IIC lines are pulled high using a 4.7k resistor and the interrupt pin is pulled down using another 4.7k resistor.
The MPU6050 module allows us to read data from it through the IIC bus. Any change in motion will be reflected on the mechanical system which will in turn vary the voltage. Then the IC has a 16-bit ADC which it uses to accurately read these changes in voltage and stores it in the FIFO buffer and makes the INT (interrupt) pin to go high. This means that the data is ready to be read, so we use a MCU to read the data from this FIFO buffer through IIC communication. As easy as it might sound, you may face some problem while actually trying to make sense of the data. However there are lots of platforms like Arduino using which you can start using this module in no time by utilizing the readily available libraries explained below.
Interfacing MPU6050 with Arduino
It is very easy to interface the MPU6050 with Arudino, thanks to the library developed by Jeff Rowberg. You can download the library from the below link
Jeff Rowberg MPU6050 Library for Arudino
Once you have added this library to you Arduino IDE, follow the below schematics to establish an IIC connection between your Arduino and MPU6050.
The library provides two example programs, which can be found at File -> Examples -> MPU6050. In these two examples one will give raw values while the other will give optimised values using the DMP. The following data values can be obtained using this example program.
- Quaternion Components [w, x, y, z]
- Euler angles
- Yaw, Pitch, Roll
- Real world Acceleration
- World frame acceleration
- Teapot invent sense Values
Out of all these data, the Yaw, Pitch, Roll us commonly used. However the library is capable of performing more than that and can be used for different purposes. Once the program is uploaded, open serial monitor and set it to 115200 baud rate and you should see the data being printed on the screen.
Applications
- Used for IMU measurement
- Drones / Quad copters
- Self balancing robots
- Robotic arm controls
- Humanoid robots
- Tilt sensor
- Orientation / Rotation Detector
2D Model of MPU6050