Below we show the detailed schematic we use for the Tilt Meter we are developing based on the MPU6050 IMU sensor.
This is the simple code for measuring acceleration in the x and y axis. We will develop this much further in future lessons, but this is just to verify things are hooked up correctly, and that we can measure accelleration.
from imu import MPU6050
from machine import I2C,Pin
i2c=I2C(0, sda=Pin(16), scl=Pin(17), freq=400000)
mpu = MPU6050(i2c)
print('x: ',xAccel,' G ', 'y: ',yAccel,' G')