🛒 Arduino, ESP32 & modules

Gyroscope, Accelerometer, Compass

Motion and heading sensors — MPU6050 gyroscope + accelerometer (GY-521) and HMC5883L 3-axis compass (GY-273). For drones, balancing robots, gesture recognition and navigation projects.

Gyroscope, Accelerometer, Compass — buying guide

Gyroscopes measure rotation, accelerometers measure acceleration, and compasses measure direction relative to the Earth's magnetic field. The Gyroscope, Accelerometer, and Compass category is for projects where you need to know the orientation of a device in space.

What to look for

  • Motion: MPU6050 (GY-521) combines a 3-axis gyroscope and a 3-axis accelerometer in one chip. It does not output a ready-made angle; the angle is calculated from these two data sources.
  • Direction: GY-273 measures the magnetic field along three axes. The chip on these boards may vary. If a library does not work, use an I2C scanner to check the address.
  • Drift: a gyroscope reading drifts over time. Combining it with an accelerometer reduces this problem.
  • Magnetic interference: motors, batteries and iron parts affect compass readings. Place the sensor away from them and calibrate it in its final position.

Typical projects

  • Self-balancing robot on two wheels.
  • Remote control operated by tilting your hand.
  • Compass system that keeps a robot on course.

Related categories

How to measure the angle with the MPU6050?

The accelerometer measures slowly changing angles well, while the gyroscope captures fast changes well. A filter in the library combines these two data sources and outputs a stable angle.

Can MPU6050 and GY-273 share the same pins?

Yes, both use I2C and can share the SDA and SCL lines because their addresses are different.