MPU6050 IMU (Accelerometer + Gyroscope)

The MPU6050 is a 6-axis Motion Tracking device.

Sensors5 blocksMicroPythonC++
MPU-6050 6-DOF IMU (Accelerometer + Gyro)

At a glance

Pins and properties exactly as the circuit editor and simulator define this part. The text below explains how to use them.

Pinout

Pinout of the MPU-6050 6-DOF IMU (Accelerometer + Gyro), drawn as in the circuit editor. Select a label to see that pin in the table below.

Pins

Pins of this part
PinLabelType
VCCVCCPower in
GNDGNDGround
SCLSCLSignal in
SDASDABidirectional
XDAXDABidirectional
XCLXCLSignal out
AD0AD0Signal in
INTINTSignal out

Properties

What you can change in the Property Inspector.

Properties of this part
PropertyRange or choicesDefault
Roll Angle (ϕ)-180 to 180 °0 °
Pitch Angle (θ)-90 to 90 °0 °
Yaw Angle (ψ)-180 to 180 °0 °
Accel X (Ax)-2 to 2 g0 g
Accel Y (Ay)-2 to 2 g0 g
Accel Z (Az)-2 to 2 g1 g
I2C Address0x68 (AD0=GND), 0x69 (AD0=VCC)0x68 (AD0=GND)

The MPU6050 is a 6-axis Motion Tracking device. It integrates a 3-axis gyroscope (for measuring angular velocity) and a 3-axis accelerometer (for measuring linear acceleration) alongside an onboard Digital Motion Processor (DMP) and an internal temperature sensor. In Open Maker Studio, it is used for tilt detection, gesture controls, and self-balancing systems.


1. Hardware Specifications

  • Operating Voltage: 3.3V to 5.0V.
  • Communication Interface: I2C (Address 0x68 / 104 when AD0 is LOW; 0x69 when AD0 is HIGH).
  • Measurement Ranges:
    • Accelerometer: Adjustable ±2g, ±4g, ±8g, ±16g.
    • Gyroscope: Adjustable ±250°/s, ±500°/s, ±1000°/s, ±2000°/s.
  • Pin Configuration:
    • VCC: Power (3.3V or 5V).
    • GND: Ground.
    • SCL / SDA: I2C clock and data.
    • XDA / XCL: Auxiliary I2C (for connecting external sensors like magnetometers).
    • AD0: Address select pin.
    • INT: Interrupt output pin.

[!NOTE] The bundled MicroPython driver (Section 5) and the C++ MPU6050 library both always read at the default ±2g / ±250°/s full-scale ranges — neither exposes a block to switch to the wider ±4g/±8g/±16g or ±500/±1000/±2000°/s ranges Section 1 lists as real hardware options, and this extension doesn't touch the onboard DMP (Digital Motion Processor) mentioned above either — everything here reads the raw accelerometer/gyroscope registers directly instead.


2. How it Works (6-Axis Measurement)

  • MEMS Accelerometer: Measures linear acceleration (including gravity). At rest, axes flat to the earth read 0g, and the vertical Z axis reads 1.0g.
  • MEMS Gyroscope: Measures rotational velocity. Reading remains 0°/s when static and spikes during rotation.
  • Sensor Fusion: Accelerometer and Gyroscope values are often combined using a complementary filter or Kalman filter to calculate stable pitch and roll angles without gyroscope drift or accelerometer vibration noise:
    Anglenew=0.98×(Angleprev+ω⋅dt)+0.02×Angleaccel\text{Angle}_{new} = 0.98 \times (\text{Angle}_{prev} + \omega \cdot dt) + 0.02 \times \text{Angle}_{accel}

3. Component Properties

The MPU6050 now has a real simulated component (mpu6050_imu) — drag it onto the Circuit Canvas from the Components palette. It exposes:

  • Roll Angle (roll) — range -180° to 180°, default 0°.
  • Pitch Angle (pitch) — range -90° to 90°, default 0°.
  • Yaw Angle (yaw) — range -180° to 180°, default 0°.
  • Accel X / Y / Z (accelX/accelY/accelZ) — g, range -2 to 2, defaults 0 / 0 / 1. These update live as you tilt/rotate the board (Section 4) using the standard gravity-vector projection: ax = -sin(pitch), ay = sin(roll)·cos(pitch), az = cos(roll)·cos(pitch) — matches a real accelerometer at rest (Section 2: flat = 0g on X/Y, 1.0g on Z).
  • I2C Address (i2cAddress) — select 0x68 (AD0 = GND, default) or 0x69 (AD0 = VCC) — matches Section 1's real AD0-pin address-select behavior exactly.

All eight real pins are wired: VCC/GND power the module, SDA/SCL carry real I2C pull-up resistors, AD0/INT/XDA/XCL are real (idle-low) digital pins.


4. Simulator Behavior

With the component placed and the circuit running:

  • Click-drag inside the 3D trackball to set pitch (-90° to 90°) and roll (-180° to 180°) — a real 3D rotation, not a flat indicator.
  • Click-drag the outer ring to set yaw (-180° to 180°).
  • Click a quick-preset button (0° Flat, Pitch 45°, Roll 45°, Yaw 90°, 180° Flip — visible only during simulation) to jump straight to that orientation.
  • A live text readout shows Ax:<accelX>g Ay:<accelY>g Az:<accelZ>g | R:<roll>° P:<pitch>° Y:<yaw>° continuously while powered — always-visible, not a hover-only tooltip.

5. Supported Blockly Blocks

Drawing the blocks…

MPU6050 IMU (Accelerometer + Gyroscope) — OMS Parts