Code for ESP32 control of LSM9DS0 through relay shield with IoT

Please direct me towards code for using the ESP32 IoT to connect LSM9DS0 units through my relay controller shields. I have tried a number of approaches and have not been successful.

We have Arduino sample code for the LSM9DS0 here:

I cut and pasted the sample code into the arduino ide, set the board to the adafruit feather, which has worked for our relay controller app, and uploaded the code to the esp32 module on the relay board. I then plugged the relay board into a proper power supply, attached the LSM9DS0 using the provided cable and …nada. I get the printout of the X,Y, and Z axis of rotation, acceleration, and Magnetic field but they are all zeroed out.

Try this I2C scan code and monitor the Serial output of the ESP32 module. It should output the address’s of the I2C devices connected:

It came back with 3 devices: 28 32 106

32 would be the relay board. 106 is going to be the Gyro in the LSM9DS0 and I’d bet 28 is the Accelorometer in the LSM9DS0 but it looks like the sample code is set for 30 rather than 28. you might try changing that Addr_Accl variable from 0x1E to 0x1C and see if that works.

I realize that the 32 relates to the relay board so I changed the address for the Accl to 1C. This didn’t work well so I flipped the addresses around so that Gyro was 1C and Accl was 6A. This generated data. I am still not seeing Magnetic field data but there is acceleration and rotation.

Hi,

That code was contributed so I cannot speak for it’s validity. I’d say its really just more of a starting point. You might take a look at the data sheet for the LSM9DS0 to get a better understanding of it’s interaction over the I2C bus.