Hello,
This is the product that I am using: MinIMU-9 v5 Gyro, Accelerometer, and Compass (LSM6DS33 and LIS3MDL Carrier).
I am trying to interface this sensor to arduino uno and implement the Serial monitor example code. I have the following connections:
LSM6DS33 Arduino Uno
SCL--------------------> A5
SDA -------------------> A4
VIN -------------------> 5V
GND -------------------> GND
I installed the LSM6 library and both LSM6 and Wire libraries are in the example code shown below:
/*
The sensor outputs provided by the library are the raw
16-bit values obtained by concatenating the 8-bit high and
low accelerometer and gyro data registers. They can be
converted to units of g and dps (degrees per second) using
the conversion factors specified in the datasheet for your
particular device and full scale setting (gain).
Example: An LSM6DS33 gives an accelerometer Z axis reading
of 16276 with its default full scale setting of +/- 2 g. The
LA_So specification in the LSM6DS33 datasheet (page 11)
states a conversion factor of 0.061 mg/LSB (least
significant bit) at this FS setting, so the raw reading of
16276 corresponds to 16276 * 0.061 = 992.8 mg = 0.9928 g.
*/
#include <Wire.h>
#include <LSM6.h>
LSM6 imu;
char report[80];
void setup()
{
Serial.begin(9600);
Wire.begin();
if (!imu.init())
{
Serial.println("Failed to detect and initialize IMU!");
while (1);
}
imu.enableDefault();
}
void loop()
{
imu.read();
snprintf(report, sizeof(report), "A: %6d %6d %6d G: %6d %6d %6d",
imu.a.x, imu.a.y, imu.a.z,
imu.g.x, imu.g.y, imu.g.z);
Serial.println(report);
delay(100);
}
I am unfamiliar with the sensor and not sure on why I keep getting the “Failed to Initialize and Detect imu” message on the serial monitor. Is there any way to fix this issue? Could it be a problem with the sensor itself? Or is there another library that needs to be included?
Thank you for the help!
Namratha