AnnyCaroline / ceu-gy521

2 stars 0 forks source link

Gy521 returning zeros #1

Closed AnnyCaroline closed 5 years ago

AnnyCaroline commented 5 years ago

In some executions, the examples "directly-use-i2c" only return 0s for gyroscope and accelerometer.

AnnyCaroline commented 5 years ago

According to Arduino forum:

This is a very common problem, and fortunately, one that is very easy to fix. When the device powers on, it starts up in sleep mode, which must be explicitly disabled in order to begin normal operations. To do this, simply write a 0 to the PWR_MGMT_1 (0x6B) register. If you are using the I2Cdev MPU6050 class, calling device.setSleepEnabled(false) will set the correct bit for you.

The reason why it seemed like a "random" behavior to me, was because I was testing the Arduino example as well, which configures PWR_MGMT_1 register correctly. Since I was frequently uploading Céu examples after the Arduino example, without turning off the Arduino, I was not seeing the problem.

AnnyCaroline commented 5 years ago

It was also necessary to re-measure the energy expenditure, since before I was measuring while the gy-521 was sleeping.