2023-08-10 07:35 AM
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.
2023-08-10 07:44 AM
Compare your board schematics with the schematics of boards produced by SparkFun and Adafruit.
2023-08-10 08:28 AM
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.
2023-08-10 09:56 AM
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