AltIMU-10 v4 "Failed to detect and initialize IMU!"

Arduino Uno and

SCL — A5 pin
SDA — A4 pin
GND — GND pin
Vin — 5v pin

Downloaded and installed libraries listed at (L3G Arduino library, LSM303 Arduino library and LPS Arduino library)

Using the following example code and I got “Failed to detect and initialize IMU!” from serial monitor.

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()

  if (!imu.init())
    Serial.println("Failed to detect and initialize IMU!");
    while (1);

void loop()

  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);


Using I2C-Scanner from, the serial monitor shows:
I2C Scanner
I2C device found at address 0x1D !
I2C device found at address 0x5D !
I2C device found at address 0x6B !

Any help would be appreciated.


I am sorry you are having trouble. The AltIMU-10 v4 uses the LSM303, so you should use the LSM303 library. The code you posted uses the LSM6 library, which is for our boards that use the LSM6DS33 (namely, the AltIMU-10 v5 and the LSM6DS33 carrier with voltage regulator. You can find GitHub links to the Arduino libraries for the sensors on the AltIMU-10 v4 under the “Resources” tab of its product page.


Thanks for the reply. It’s my mistake. It’s working now.