Gyro-Accelerometer
The sensor module for MPU6050 is a small device that tracks motion in 6 axes. It includes a 3-axis gyroscope, a 3-axis accelerometer, and a digital motion processor. Additionally, it has a built-in temperature sensor for extra features. The module can communicate with microcontrollers through its I2C bus interface.
Additionally, the module has an Auxiliary I2C bus that enables communication with other sensor devices such as a 3-axis Magnetometer or a Pressure sensor. If a 3-axis Magnetometer is connected to the auxiliary I2C bus, the MPU6050 sensor module can provide a complete 9-axis Motion Fusion output.
The "gyroscope sensor 6050" likely refers to the MPU-6050, which is a popular gyroscope and accelerometer sensor module. The MPU-6050 is a MEMS (Microelectromechanical Systems) device that combines a 3-axis gyroscope and a 3-axis accelerometer in a single chip.
Key features of the MPU-6050 include:
3-Axis Gyroscope: The gyroscope measures angular velocity along three axes (X, Y, and Z) and provides information about the device's orientation and rotation.
3-Axis Accelerometer: The accelerometer measures linear acceleration along three axes (X, Y, and Z) and can be used to determine the device's movement and orientation with respect to gravity.
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 axes as shown in below figure.
- 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.
3-Axis Accelerometer
The MPU6050 consist 3-axis Accelerometer with Micro Electro Mechanical (MEMs) technology. It used to detect angle of tilt or inclination along the X, Y and Z axes as shown in below figure.
- Acceleration along the axes deflects the movable mass.
- This displacement of moving plate (mass) unbalances the differential capacitor which results in sensor output. Output amplitude is proportional to acceleration.
- 16-bit ADC is used to get digitized output.
- The full-scale range of acceleration are +/- 2g, +/- 4g, +/- 8g, +/- 16g.
- It measured in g (gravity force) unit.
- When device placed on flat surface it will measure 0g on X and Y axis and +1g on Z axis.
MPU6050 Pin Description
The MPU-6050 module has 8 pins,
Specification of MPU6050 Sensor
Gyroscope:
Accelerometer:
Supply Voltage:
Other Features:
Connections:
Once the connections are made, follow these steps:
Install the necessary libraries:
Open the Arduino IDE on your computer.
Go to "Sketch" > "Include Library" > "Manage Libraries."
Search for "MPU6050" and install the "MPU6050" library by Jeff Rowberg.
Also, install the "Wire" library if you haven't already (it should be pre-installed with the Arduino IDE).
#include <Wire.h>
const int MPU = 0x68; // MPU-6050 I2C address
int16_t AcX, AcY, AcZ, GyX, GyY, GyZ;
void setup() {
Wire.begin();
Wire.beginTransmission(MPU);
Wire.write(0x6B); // Power management register
Wire.write(0); // Wake up the MPU-6050
Wire.endTransmission(true);
Serial.begin(9600);
}
void loop() {
Wire.beginTransmission(MPU);
Wire.write(0x3B); // Starting register for accelerometer data
Wire.endTransmission(false);
Wire.requestFrom(MPU, 14, true); // Request 14 bytes of data
AcX = Wire.read() << 8 | Wire.read();
AcY = Wire.read() << 8 | Wire.read();
AcZ = Wire.read() << 8 | Wire.read();
int16_t Temp = Wire.read() << 8 | Wire.read(); // Temperature
GyX = Wire.read() << 8 | Wire.read();
GyY = Wire.read() << 8 | Wire.read();
GyZ = Wire.read() << 8 | Wire.read();
// Print the sensor data
Serial.print("Accelerometer: ");
Serial.print("X = "); Serial.print(AcX);
Serial.print(" | Y = "); Serial.print(AcY);
Serial.print(" | Z = "); Serial.println(AcZ);
Serial.print("Gyroscope: ");
Serial.print("X = "); Serial.print(GyX);
Serial.print(" | Y = "); Serial.print(GyY);
Serial.print(" | Z = "); Serial.println(GyZ);
// Print temperature in degrees Celsius
float temperature = (Temp / 340.0) + 36.53;
Serial.print("Temperature: ");
Serial.println(temperature);
delay(1000); // Delay for readability
}