Electronic – Weird readings from ITG3200 gyro

gyroi2c

I am having trouble making this gyroscope to work. I can sort of get Z axis readings from it. If I don't move it, the X and Y axises constantly display -1. When I move the gyro, the X and Y would jump a little bit (a few hundred) but as soon as I stop, they go back to -1. Any suggestion is appreciated. Thanks!!

Best Answer

I've struggled with I2C sensors and broken library implementations. In my experience the fastest way to debug the problem is capturing a trace and making sure it looks correct.

There are many common ways to screw up with I2C:

  • No pull-ups or too weak pull-ups
  • Confusing 7-bit and 8-bit I2C addresses
  • Broken software implementation omitting the NACK at the end of a read
  • Not using repeated starts when they are required
  • SDA and SCL are swapped

Check out my tutorial of I2C with more debugging tips.

For the ITG3200 I would make sure reading the WHO_AM_I register is successful before trying to read the values. Also see this question which details the weirdness of the Vlogic with that gyro.