Skip to main content
Explorer
August 10, 2023
Question

LSM6DS3TR-C not detected via adafruit library

  • August 10, 2023
  • 2 replies
  • 1710 views

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

    This topic has been closed for replies.

    2 replies

    Graduate II
    August 10, 2023

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

    Super User
    August 10, 2023

    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.

    Explorer
    August 10, 2023

    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