LSM6DS33 - Accelerometer/Gyroscope

Hello all,

We are new to using this device and we’ve been having some difficulty in just reading outputs. My group and I are working on a project that uses an Arduino Uno board that uses the accelerometer and gyroscope to measure the movement of a segway-like device based off of the angle of the platform. We are trying to figure out how to just read the outputs of the LSM6DS33 in the Arduino program. We have been using Kevin Pololu’s code as a basis for ours and this is what we have so far:

include  < Wire.h >  //we know there's supposed to be #, but it doesn't show up on this forum
include  < LSM6.h >

LSM6 imu;

char report[80];

void setup()


  if (!imu.init())
    Serial.println("Failed to detect and initialize IMU!");
    while (1);
  imu.writeReg(LSM6::CTRL9_XL, 0x38); // Acc X, Y, Z axes enabled
  imu.writeReg(LSM6::CTRL1_XL, 0x60); // Acc = 416Hz (High-Performance mode)
  imu.writeReg(LSM6::INT1_CTRL, 0x01); // Acc Data Ready interrupt on INT1
  imu.writeReg(LSM6::CTRL10_C, 0x38); // Gyro X, Y, Z axes enabled
  imu.writeReg(LSM6::CTRL2_G, 0x60);// Gyro = 416Hz (High-Performance mode)
  imu.writeReg(LSM6::INT2_CTRL, 0x02); // Gyro Data Ready interrupt on INT1

void loop()
  imu.writeReg(LSM6::STATUS_REG, 0x0B); //this hex number represents the status register;
  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);

We have been going off of this manual and basing our code around the Status Register on page 56:

We have been playing around with this code for a while, so if you see any extraneous or non sequitur code, please ignore. However, if there are any suggestions or comments about the read and write functions or any about how to fix the code to show some output data please let us know.



Hi, Alex.

It looks like you are trying to set up your IMU’s registers differently than the defaults used in the demo code. Have you tried using the demo code with no modification? When you say you are having difficulty getting outputs, what does that mean? Do you get any output at all? Do you get an output that does not make sense?


Hi Claire,

We tried that originally, but it didn’t get any outputs. No matter what we try, we can’t get any outputs for this device. The output window is completely blank even when we move it around.

Any advise or help would be lovely.

Thank you!

  • Alex

Have you been able to get serial output on the serial monitor from other programs using that Arduino? Could you post pictures of your setup that show all the connections to the IMU and Arduino, including any solder joints?