Use the IMU through I2C, SPI and another I2C sensor on the Seeedstudio xiao nRF52840 sense

Hello everyone,

just new to the SeeedStudio and Xiao dev community.
I want to access the IMU data on a xiao sense BLE while connected to another sensor via the I2C. That doesn’t seem to work. Has anyone done this before so I short out that this is not a hardware limitation and focus on how to make the code work?

Thank you!

Hi There, Welcome.
You absolutly can do That!, The IMU is internal,(under the hood with fixed address)

//Create a instance of class LSM6DS3
LSM6DS3 myIMU(I2C_MODE, 0x6A);  //I2C device address 0x6A  // IMU

the I2C “BUS” pins are available and you can pick from many to be the CS ,or a different Address, what is the Sensors address?
Take a look at this and You’ll see the light Basics of the I2C Communication Protocol
Understanding the I2C Bus
should help also the WIKI for the Xiao Line of MCU’s is their…

1x Reset button, Ix UART, 1x I2C, 1x SPI, 1x NFC, 1x SWD, 11x GPIO,
 6x ADC, 1x Three-in-one LED, 1x User LED

for example…
GL :slight_smile: PJ

I don’t see any code so these are truths. :relieved:

Thank you so much PJ for your prompt reply and willingness to help! :slight_smile:

I connected my external I2C device on the dedicated default pins (SDA, 4 ; SCL 5) and then I have an Interrupt pin at (pin 1) and a SD (pin 2). The address of the I2C sensor is 0x2B.

Here is the code I am using for I2C scanning and displaying the IMU data for my test bed.
Although IMU is sending data it does not appear at the list of found I2C devices (possibly because it is on its own internal address as you mentioned) but my main issue is that I cannot see my I2C external sensor connected at 0x2B :frowning:

#include <Wire.h>
#include “LSM6DS3.h”

LSM6DS3 myIMU(I2C_MODE, 0x6A); //I2C device address 0x6A

void setup()

while (!Serial); // Wait for serial monitor
Serial.println("---I2C Scanner---");
    //Call .begin() to configure the IMUs
if (myIMU.begin() != 0) { 
    Serial.println("Device error");
} else {
    Serial.println("Device OK!");


void loop()
byte error, address;
int nDevices;


nDevices = 0;
for(address = 1; address < 127; address++ )
    error = Wire.endTransmission();


if (error == 0 && Wire.endTransmission() != 0 ) // Special flag for SAMD Series
    Serial.print("I2C device found at address 0x");
    if (address<16)

else if (error==4) 
    Serial.print("Unknown error at address 0x");
    if (address<16) 
if (nDevices == 0)
    Serial.println("No I2C devices found\n");

Serial.print(" X1 = ");
Serial.println(myIMU.readFloatAccelX(), 4);
Serial.print(" Y1 = ");
Serial.println(myIMU.readFloatAccelY(), 4);
Serial.print(" Z1 = ");
Serial.println(myIMU.readFloatAccelZ(), 4);

Serial.print(" X1 = ");
Serial.println(myIMU.readFloatGyroX(), 4);
Serial.print(" Y1 = ");
Serial.println(myIMU.readFloatGyroY(), 4);
Serial.print(" Z1 = ");
Serial.println(myIMU.readFloatGyroZ(), 4);

Serial.print(" Degrees C1 = ");
Serial.println(myIMU.readTempC(), 4);
Serial.print(" Degrees F1 = ");
Serial.println(myIMU.readTempF(), 4);

delay(5000);           // wait 5 seconds for next scan


Alright :slight_smile: solved!

apparently the D2 pin that was connected to the SD of the sensor needed to be set LOW for the sensor device to power up its I2C. All working now.
Thanks again PJ for your message!

1 Like