IntermediateSensors and Displays

MPU6050 Digital Inclinometer

Measure tilt from accelerometer axes and show an approximate angle on a small OLED.

Estimated time: 1–2 hours · Skills: I²C, accelerometer axes, calibration, basic trigonometry

Parts from the database

Other supplies

Amazon links may be affiliate links. As an Amazon Associate, Electronics Hobby Hub earns from qualifying purchases.

Connections

  1. Connect both breakouts to 3V3/GND and I²C: SDA GP4, SCL GP5.
  2. Mount the accelerometer board flat and securely; vibration and movement corrupt angle estimates.
  3. Confirm address pins and module voltage compatibility before powering.

Build steps

  1. Install a maintained MPU6050 library and the SSD1306 display libraries.
  2. Run the library example to confirm raw accelerometer and gyro values change as the board rotates.
  3. Compute roll/pitch from the accelerometer at rest; apply a zero offset while the board is level.
  4. Display the angle and compare against a known level or protractor at several positions.

Software and firmware setup

Firmware is required, but a complete combined display sketch is not included yet. Install Adafruit MPU6050, Adafruit Unified Sensor, Adafruit SSD1306, and Adafruit GFX. Run the MPU6050 sensor example first; then calculate roll/pitch from the accelerometer and draw the result on the OLED.

Test your build

At rest, the display should show near-zero angle after zeroing; tilting slowly should change the angle smoothly. Acceleration during motion affects the estimate.

Troubleshooting

  • If values are stuck, check I²C addresses (0x68/0x69) and the AD0 pin.
  • If the displayed angle drifts while still, use accelerometer-based tilt only or add sensor fusion for dynamic motion.
  • If screen text is clipped, verify display geometry and library configuration.

Safety and limitations

This is an educational inclinometer, not a vehicle, medical, or structural safety instrument.

Manufacturer and platform documentation

Community Notes for This Project

These are unverified visitor contributions, separate from the build guide and manufacturer specifications. Verify technical advice against the linked datasheets before relying on it.

Set up the comments service to load community notes.

Share a tip or question about this build

← Browse all projects