Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

LSM6DS33 - Failed to Initialize and Detect IMU on Arduino Uno

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

Hello.

I am sorry you are having trouble communicating with your MinIMU-9 v5. To interface with the LSM6DS33, you should not need to use any other Arduino libraries besides LSM6 and Wire. Can you post pictures that clearly show your soldered joints and connections?

-Jon

Hi Jon,

Thank you for the response. It seems that it was a connection issue, once I soldered the pins, the arduino was able to detect the sensor!

Best,
Namratha

1 Like

Hi Jon,
I soldered all the points but still can’t detect the imu. I am using the same code and IMU.

Hello, Domicx.

The soldering on your IMU does not look good, and I am skeptical that the connections are good enough for it to function. It looks like several of your solder joints are not well wetted to the pads on the board. It also seems like you have a lot more solder than you need on most of your joints to the point that they are close to being shorting hazards with adjacent pins. I recommend using the Adafruit Guide to Excellent Soldering, as a reference for fixing those connections.

Could you try re-working those solder joints and seeing if that helps?

By the way, the board and issue in the thread ha91 started looks very similar to yours, so it seems like you might be working on the same project or something; is that the case? If so, let’s all keep the discussion in that thread since it is solely dedicated to your problem.

- Patrick