Interface an inertial measurement unit (IMU) with raspberry pi

GY-512 MPU-6050
IMU’s green light switches on.
sudo raspi-config
Raspberry pi configuration tool.
Select P15 for selecting I2C.
from mpu6050 import mpu6050
sensor = mpu6050(0x68)
while (1):
accelerometer_data = sensor.get_accel_data()
temp = sensor.get_temp()
gyro_data = sensor.get_gyro_data()
print("Acceleration")
print("-----------------")
print(accelerometer_data)
print("-----------------")
print("Temperatue")
print("-----------------")
print(temp)
print("-----------------")
print("Gyro data")
print("-----------------")
print(gyro_data)
print("-----------------")
Output in the terminal
Photo by Anna Louise on Unsplash

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store