cancel
Showing results for 
Search instead for 
Did you mean: 

LSM6DS3TR-C not detected via adafruit library

shahriar193
Associate II

I recently bought LSM6DS3TR-C sensor from local market. I tried to measure the accelerometer using Adafruit_LSM6DS and SparkFun_LSM6DS3_Arduino_Library library. In both case the sensor was not recognized. I found the sensor was working. It responded to my I2C communication. The identification register aka WHO_AM_I register held the value 0x6A. I am new in this area. Is the sensor the right one. Is there any easy library for reading accelerometer data from the sensor? I am attaching the sensor's picture. Your help will be very much appreciated.


WhatsApp Image 2023-08-10 at 8.32.06 PM.jpegWhatsApp Image 2023-08-10 at 8.32.07 PM.jpeg

3 REPLIES 3
RhSilicon
Lead

Compare your board schematics with the schematics of boards produced by SparkFun and Adafruit.

TDK
Guru

If you were able to communicate with it and it returned the correct WHO_AM_I value, seems like a library problem. I'd look more into why exactly the library fails to recognize it, and what they're doing differently compared to your own code which read it correctly.

If you feel a post has answered your question, please click "Accept as Solution".

shahriar193_0-1691686157487.png

This portion of the code is executed and it prints "Failed to find LSMD63TR-C chip". This is the github link: SparkFun_LSM6DS3_Arduino_Library
My code is straight forward. It uses wire and finds the address:

#include <Wire.h>

void setup() {
Wire.begin();
Serial.begin(9600);
}

void loop() {
// I2C address of the LSM6DS3TR-C sensor
byte sensorAddress = 0x6A;

// WHO_AM_I register address
byte whoAmIRegister = 0x0F;

// Read the WHO_AM_I register value
Wire.beginTransmission(sensorAddress);
Wire.write(whoAmIRegister);
Wire.endTransmission();

Wire.requestFrom(sensorAddress, 1);

if (Wire.available()) {
byte whoAmIValue = Wire.read();

Serial.println(whoAmIValue);

}

delay(5000); // Delay between readings
}

Can you help me how to solve this