The MPU6050 is a very cheap accelerometer and gyroscopic force sensor that uses I2C to communicate. As such, it can be easily connected to your ESP32 for a variety of purposes. In this tutorial we illustrate it in action.
The source can be found on Github here:
https://github.com/nkolban/esp32-snip...