meta data for this page
Differences
This shows you the differences between two versions of the page.
| sensor:mpu_6050 [2026/03/22 01:24] – created vamsan | sensor:mpu_6050 [2026/03/22 02:13] (current) – [Pinout Table (HW-123, GY-521)] vamsan | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== lamaPLC: MPU-6050 6-axis MotionTracking device ====== | + | ====== lamaPLC: MPU-6050 |
| - | The MPU-6050 is a widely used 6-axis | + | {{ : |
| + | The MPU-6050 | ||
| **Key Technical Specifications** | **Key Technical Specifications** | ||
| Line 9: | Line 10: | ||
| * **Gyroscope: | * **Gyroscope: | ||
| * **Accelerometer: | * **Accelerometer: | ||
| - | * **Communication: | + | * **Communication: |
| * **Operating Voltage:** 2.375V to 3.46V for the raw chip; common breakout modules like the GY-521 include a 3.3V regulator for 5V compatibility. | * **Operating Voltage:** 2.375V to 3.46V for the raw chip; common breakout modules like the GY-521 include a 3.3V regulator for 5V compatibility. | ||
| * **I²C Addresses: | * **I²C Addresses: | ||
| + | **Notable Features** | ||
| + | |||
| + | * **Digital Motion Processor (DMP):** An on-chip co-processor that offloads complex sensor fusion calculations (like converting raw data into quaternions or Euler angles) from the main microcontroller. | ||
| + | * **FIFO Buffer:** A 1024-byte buffer that allows the system processor to read data in bursts, reducing power consumption by letting the host stay in sleep mode longer. | ||
| + | * **Auxiliary I²C Bus:** Allows the MPU-6050 to act as a master to external sensors, such as a 3rd-party magnetometer, | ||
| + | |||
| + | ==== Pinout Table (HW-123, GY-521) ==== | ||
| + | |< 100%>| | ||
| + | ^Pin Name^Description^Note| | ||
| + | ^VCC|Power Supply|Typically 3V to 5V (due to onboard regulator).| | ||
| + | ^GND|Ground|Common ground for the system.| | ||
| + | ^SCL|I²C Serial Clock|Connect to MCU clock line (e.g., A5 on Uno).| | ||
| + | ^SDA|I²C Serial Data|Connect to MCU data line (e.g., A4 on Uno).| | ||
| + | ^XDA|Aux Serial Data|For connecting external I²C sensors (optional).| | ||
| + | ^XCL|Aux Serial Clock|For connecting external I²C sensors (optional).| | ||
| + | ^AD0|Address Select|Low (default) = 0x68; High = 0x69.| | ||
| + | ^INT|Interrupt Output|Signals the MCU when new data is available.| | ||
| + | |||
| + | **Pin Functions & Wiring Tips** | ||
| + | |||
| + | * **I²C Communication: | ||
| + | * **Multi-Sensor Setup:** Use the AD0 pin to change the I²C address if you need to use two MPU-6050s on the same bus. | ||
| + | * **External Master:** The XDA and XCL pins allow the MPU-6050 to act as a master to a secondary sensor, such as a magnetometer, | ||
| + | * **Interrupts: | ||
| + | |||
| + | ==== Arduino example code ==== | ||
| + | To connect the MPU-6050 to an Arduino, the simplest method is to use the **Adafruit MPU6050** library, which handles I²C communication and converts raw data to standard units (//mls²// for acceleration and //rad/s// for rotation). | ||
| + | |||
| + | This code initializes the sensor and prints real-time movement data to the Serial Monitor at 115200 baud. | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | Adafruit_MPU6050 mpu; | ||
| + | |||
| + | void setup(void) { | ||
| + | Serial.begin(115200); | ||
| + | if (!mpu.begin()) { | ||
| + | while (1) { delay(10); } // Loop if sensor not found | ||
| + | } | ||
| + | // Optional: Set ranges | ||
| + | mpu.setAccelerometerRange(MPU6050_RANGE_8_G); | ||
| + | mpu.setFilterBandwidth(MPU6050_BAND_21_HZ); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | sensors_event_t a, g, temp; | ||
| + | mpu.getEvent(& | ||
| + | |||
| + | // Print accel and gyro data to Serial Monitor | ||
| + | Serial.print(a.acceleration.x); | ||
| + | Serial.print(g.gyro.x); | ||
| + | delay(500); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | **Tips for Better Results** | ||
| + | |||
| + | * **Calibration: | ||
| + | * **Filtering: | ||
| + | |||
| + | ===== I2C topics on lamaPLC ===== | ||
| + | {{topic> | ||
| + | |||
| + | {{tag> | ||
| + | |||
| + | This page has been accessed for: Today: {{counter|today}}, | ||