ESP32 THING MOTION SHIELD RETURNS ONLY ZEROS

I hooked up the Motion Shield to the ESP32 thing as described in the hookup guide.

tutorials/esp32-thing-motion-shield-hookup-guide

When I run the example script from the library (see code linked about), everything compiles and upload just fine.

The problem I have is the motion sensor LSM9DS1 returns only 0.00 on all axes for Gyro, Accel and Mag

The initialization in the void_setup seem to work since I don’t get “Failed to communicate with LSM9DS1.”

I also checked and imu.gyroAvailable() returns True.

If I run the I2C_scanner I get the same addresses used in the example.

LSM9DS1_M 0x1E

LSM9DS1_AG 0x6B

I’m also successfully logging all data to the shield sd card.

Should I be using a different library for this shield?

Is there onboard resistors I have to address somehow?

Thanks for your help.

Dan

P.S. Others have reported this same problem on the old forum.

Solution: There is a line of code missing in the example code provided at

tutorials/esp32-thing-motion-shield-hookup-guide

You need to add the following to setup() after Serial.begin(115200);

Wire.begin();

This missing line of code was discovered by looking in the file SparkFunLSM9DS1.cpp which reads as follows:

// We expect caller to begin their I2C port, with the speed of their choice external to the library

// But if they forget, we could start the hardware here.

// settings.device.i2c->begin(); // Initialize I2C library

Instead of modifying the SparkFunLSM9DS1.cpp we recommend adding Wire.begin();

to the code for the SparkFun ESP32 Thing and Motion Shield.

Reference: https://www.arduino.cc/en/Reference/WireBegin

Hello dan_bruton,

I apologize for the delay. However, I’m delighted that you found a solution. You are absolutely right. I have notified our tutorial writers and we’ll make this fix as soon as possible.

Great catch, thank you!