XIAO BLE SENSE cannot communicate with IMU sensor

Hello community,

I have just received two XIAO BLE SENSE boards and try to run the IMU examples. However, I am not able to properly initialize the sensor and read actual values. I have followed the example from the wiki, programming via the latest Arduino IDE (after installing the board support package, confirming blink to work and installing the library for the IMU sensor) and have also tried the CircuitPython example on using the IMU as per the posing on this forum.

IMU.begin() fails with error code 1 - hardware error.

When running the i2c_scanner from the Arduino Playground, I do not detect the IMU device on the I2C bus, which may be due to the fact that the device is not properly powered. I have tried to include

#define PIN_LSM6DS3TR_C_POWER (15)
digitalWrite(PIN_LSM6DS3TR_C_POWER, HIGH);

but to no avail. When I add another I2C sensor, it is properly detected so the I2C bus seems to be working OK.

Since the board is so compact, I do not see how I can 1) easily confirm presence of the sensor and 2) confirm (measure) power to the sensor. There is a microphone soldered on the board, so I expect to have a BLE SENSE board.

Any help is appreciated!

I think that the XIAO BLE boards are terrific pieces of hardware, but the Seeed development software releases are VERRRRRY frustrating.

So, here’s a way to use the IMU on the XIAO BLE Sense. (You can try other board release package versions and different libraries, but this works for me. I won’t bore you with details of all of the stuff I tried that did not work. I tested the following today, August 15, 2022, but those Seeed guys might change something that screws the pooch. Wouldn’t be the first time. Sigh…)

First of all, if you have any libraries that have a file named LSM6DS3.h, move their directory away from your Sketchbook\Libraries directory. (I’m speaking specifically of the Arduino_LSM6DS3 library. Warning: Don’t just rename the library directory, move it to some place completely away from your Sketchbook and Sketchbook\Libraries).

Next, use the Arduino Libraries Manager to install the Seed Arduino LSM6DS3 library version 2.0.3

Now, if you have not installed the Seeed nrf52 mbed-enabled Boards package, version 2.7.2, use the Arduino Boards manager to install it.

For a new board installation, you may have to exit the Arduino IDE and re-invoke it to see the next results:

Select the Seeed XIAO BLE Sense - nrf52840 board from the board package you just installed.

Finally (well, almost finally):
There is a sketch named HighLevelExample in the Seeed Arduino LSM6DS3 library. It works for me with no modifications and no problems.

Not wanting to go through this every time I want to use (or tell someone how to use) the LSM6DS3 on the XIAO BLE Sense, I modified that file to print the board version and library version that I used to create the output, and I attached the zipped project below.

Finally (Yes, I promise: Finally!):
Here’s the output up to the end of the first time through loop():

XIAO BLE Sense test of LSM6DS3 compiled on Aug 15 2022 at 14:00:06
Seeed mbed-enabled nrf52 Boards-> Seeed XIAO BLE Sense - nrf52480
From board release verion 2.7.6
Using Seeed Arduino LSM6DS3 Library version 2.0.3

Device OK!

 X1 = -0.0039
 Y1 = -0.0590
 Z1 = 1.0287

 X1 = 0.4900
 Y1 = -2.3800
 Z1 = 0.2800

 Degrees C1 = 29.9375
 Degrees F1 = 85.8875



Seeed mbed-enabled nrf52 package.

Daves_HighLevelExample.zip (1.5 KB)

1 Like

Hello Dave,

Thank you so much! Following your outline, I have reinstalled board package (took the mbed-enabled version) and the Arduino provided library (as opposed to the externally provided ZIP) and the IMU chip is now connecting and the HighLevelExample works as expected, generating proper data. I figure it must be due to an incorrect definition of the IMU (6D) power pin?

Thanks again, I can now move on with my project!


I think one big difference is that the XIAO BLE uses the second I2C interface with internal CPU connections not brought out to external package pins. The Seeed library code uses Wire1 rather than Wire used in non-Seeed libraries you may come across.

This excellent hardware design means that you can connect any I2C device to the external SDA and SCL pins without havig to worry about I2C address conflicts with the on-board stuff.



That makes perfect sense. In hindsight, I could have picked this up from the schematic diagram…

Hi Dave, were you able to get it working with the Arduino/Adafruit based image (not the mbed OS one)

Didn’t try the Arduino_LSM6DS3 library with my XIAO BLE boards…

I consider it to be a major accomplishment for me to find and successfullly deploy Seeed-specific software such as the Seeed Arduino LSM6DS3 library with Seeed boards.



:smiling_face_with_three_hearts: Thank you for the Boost…
worked like a charm…

XIAO BLE Sense test of LSM6DS3 compiled on Sep 16 2022 at 00:02:39
Seeed mbed-enabled nrf52 Boards-> Seeed XIAO BLE Sense - nrf52480
From board release verion 2.7.6
Using Seeed Arduino LSM6DS3 Library version 2.0.3
Device OK!
X1 = 0.0000
Y1 = 0.0259
Z1 = 0.9560
X1 = 32.0600
Y1 = 4.5500
Z1 = 12.6700
Degrees C1 = 27.7188
Degrees F1 = 81.8938

I followed you post and When it got past the Lib error I began to smile.
too bad about the battery voltage issue. man!!, I want to send imu and battery data over the BLE link
to my phone app. I hope they get this tight little package correct soon.
thanks again.
Kings regards,

Hi everyone,
damn, why is the hardware of the Xiao-BLE Sense so good. I would love to throw it away because of the bad software(support). But it has everything I need in a super small format.
I run the board in the non-mbed version 1.0.0. these gives access to all Adafruit libraries which work great. Unfortunately I cannot access the IMU sensors LSM6DS3 or microphone. The Seeed Arduino LSM6DS3 Library seems to take the wrong wiring information from the incompatible board files.
Does it make sense to spend more time for a solution for the Adafriut-friendly 1.0.0 board or should I focus on board release version 2.7.6 for the Arduino33 way.
What is your opinion?