I'm trying to communicate with an MPU6500 sensor via SPI as I need the fastest possible update rate. I have trouble finding an easy to understand sample code, or perhaps a lightweight library how to configure and initialize the sensor and read gyro / accelerometer data via SPI.

So far I started adapting the code and info found at https://playground.arduino.cc/Main/MPU-6050 thought it would be fairly easy to use SPI instead of I2C "Wire", and adapt the configuration and registers based on the datasheet, but I realized there's too many possible pitfalls.

Any recommendations?

  • What library you already found? And what part of the sample code you have questions about? Feb 28 '18 at 14:56
  • @MichelKeijzers added info.
    – Z4-
    Feb 28 '18 at 16:48
  • I retracted my close flag, I never tried this sensor, normally components are either for SPI or I2C (or another communication means), but not supporting both, so I am surprised you can even change from I2C to SPI. Feb 28 '18 at 17:22
  • Read the data sheet and SPI protocol is quite easy to implement!
    – MaNyYaCk
    Mar 1 '18 at 9:51
  • Thanks Michel, yes it does definitely support both.
    – Z4-
    Mar 1 '18 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.