An IMU or inertial measurement unit measures 6 degrees of freedom (DoF) which will tell us the acceleration in all three directions (x, y, z) as well as the angular velocity and rotation about the 3 axes (roll, pitch, yaw). An IMU is typically comprised of an accelerometer and a gyroscope. The accelerometer is responsible for measuring the acceleration in all 3 directions. However, it has difficulty differentiating between device acceleration and the earth's gravity when moving. The Gyroscope helps maintain this balance and ensures accurate readings. The gyroscope is responsible for measuring the angular velocity. The part is called a GY-521; however, the ship is an MPU6050. This chip can also measure temperature. It communicates using I2C which stands for Inter-Integrated Circuit and is typically pronounced eye-squared-see.
Arduino Uno Pinout:
See the complete example below with information on how to set up and use the MPU6050 IMU sensor using the Adafruit MPU6050 library.
https://create.arduino.cc/editor/mjdargen_ravens/e06300fc-a50c-45cb-a92e-6f39238a750a/preview