GY-521 MPU6050 3-Axis Acceleration Gyroscope 6DOF Module
- Model: GY-521
- Color: Blue
- Material: PCB + Plastic + copper
- Chip: MPU-6050
- Power supply: 3~5V
- Communication mode: standard IIC communication protocol
- Chip built-in 16bit AD converter, 16bit data output
- Gyroscopes range: +/- 250 500 1000 2000 degree/sec
- Acceleration range: +/- 2g, +/- 4g, +/- 8g, +/- 16g
- Immersion Gold plating PCB, machine welding process to ensure quality
- Pin pitch: 2.54mm
- Great for DIY projects
Example Sketch & Diagram
Library: MPU6050.zip
#include "Wire.h" #include "I2Cdev.h" #include "MPU6050.h" MPU6050 accelgyro; int16_t ax, ay, az; int16_t gx, gy, gz; #define LED_PIN 13 bool blinkState = false; void setup() { Wire.begin(); Serial.begin(38400); Serial.println("Initializing I2C devices..."); accelgyro.initialize(); Serial.println("Testing device connections..."); Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed"); pinMode(LED_PIN, OUTPUT); } void loop() { accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz); Serial.print("a/g:t"); Serial.print(ax); Serial.print("t"); Serial.print(ay); Serial.print("t"); Serial.print(az); Serial.print("t"); Serial.print(gx); Serial.print("t"); Serial.print(gy); Serial.print("t"); Serial.println(gz); blinkState = !blinkState; digitalWrite(LED_PIN, blinkState); delay(250); }