I am trying to get the LSM9DS1 to talk to my ESP32 using I2C... but cant get it to work. Used various libraries that can be installed rough the Arduino IDE but no cigar.
I2C scanner detects the device on the default address 0x6B but initialization fails.
Is there someone who can help me in the right direction?
#include <Wire.h>
#include <SPI.h>
#include <SparkFunLSM9DS1.h>
LSM9DS1 imu;
#define LSM9DS1_AG 0x6B
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Wire.begin();
if (imu.begin() == false) // with no arguments, this uses default addresses (AG:0x6B, M:0x1E) and i2c port (Wire).
{
Serial.println("Failed to communicate with LSM9DS1.");
Serial.println("Double-check wiring.");
Serial.println("Default settings in this sketch will " \
"work for an out of the box LSM9DS1 " \
"Breakout, but may need to be modified " \
"if the board jumpers are.");
while (1);
}
}
void loop() {
// put your main code here, to run repeatedly:
}
@jremington most of them are SPI... I wanted to use I2C because it is easy to attach other sensors later. But perhaps I will need to use ISP if I2C is not working.
@Idahowalker initialisation is not working... if you look at the first message... I get "Failed to communicate with LSM9DS1", immediately.
The LSM9DS1 usually requires a soft reset at start-up, and a delay of I think 250 ms before it's available for general use... Might want to check up on that in your library source
That was it... after I connected the VDDIO pin it worked...using Adafruit as well as SparkFun library. Also I2C tester returns two default addresses as it should (0x1E and 0x6B). The VDDIO pin is the power supply for I/O pins as mentioned in the datasheet of the sensor https://www.st.com/resource/en/datasheet/lsm9ds1.pdf