XIAO BLE Sense - LSM6DS3 INT1 Single Tap Interrupt

How low did you go with current consumption in sleep? I managed 100uA but that is too high for me.

Lowest on the PPK2 recording was1.24 ma. in sleep? :face_with_symbols_over_mouth:
as is with code from above and the 2ms delay in shutdown.

Needs more adjustment for Low Power this was just a double tap demo, FYI…
DUT, configuration…pic

Do you know if the LM6DS3TR_C_INT2 pin is connected anywhere? It’s not defined in Seeed Xiao non-Mbed 1.0.0 firmware. It seems to be needed for the “Absolute Wrist Tilt” embedded low power feature to generate an interrupt.

I believe tilt detection and Absolute Wrist Tilt are the two low-power interrupt functions that can use the low-power ODRs of the accelerometer, while others like double tap might use up more power. The accelerometer in high performance mode uses 160 μA, while the low-power mode uses 9 μA.

Accelerometer current
in high-performance mode
ODR < 1.6 kHz
ODR ≥ 1.6 kHz
160 μA
LA_IddNM Accelerometer current
consumption in normal mode ODR = 208 Hz 85 μA
LA_IddLM Accelerometer current
consumption in low-power mode ODR = 12.5 Hz 9 μA

iNEMO inertial module: always-on 3D accelerometer and 3D gyroscope (st.com)

Do you notice that whenever you measure with PPK2, there is always a ripple superimposed on the current waveform? Could you measure with a resistor and see if it still exists?

It’s a issue with the over sampling with the PPK2 I always use the extra GND from the logic port to the GND of the chip(xiao), FWIW. Nordic forums has some topics about the PPK2, just lower the number of samples and go again.

Were you able to use a TILT interupt , if so how, did you write the registers directly? I guess too many Libs for the IMU, last count there’s at least 3. ?
Fun stuff… :smile:

GL :slight_smile:

From Seeed’s own SOM schematic link. Looks like they took the easiest way out. Must have been billed by the trace :laughing:
No sound engineering reason except it wouldn’t pass FCC or some such?
ONE INT is ALL you GET :face_with_open_eyes_and_hand_over_mouth:


I guess the absolute wrist tilt function won’t work then!

I wrote the registers using lines like myIMU.writeRegister(LSM6DS3_ACC_GYRO_CTRL10_C, B10001100); //enable wrist tilt algorithm, following the datasheet .

I replaced the IMU interrupt with a SignalQuest SQ-SEN-815B tilt sensor that is zero power when not activated and 50uA when activated. It can be soldered directly to two pins spaced 3 holes apart on the Xiao, one of which is ground, and wakes with your interrupt sense pin pulldown code.

Even with this the Xiao BLE Sense still seems to kill the 95mAh battery in a day while in deep sleep, so I ordered a Nordic PPK2 to check why. It might be because of a Neopixel that I am sinking through the device. I wonder if the IMU and microphone take up a lot of power when they aren’t even initiated in the code?

Hi there,
Yes the PPK2 is worth the hondo for sure, hepled me shave allot of power wasting in y code, I’m goona have a look at the IMU data sheett and see what else is possible. Amazingly short sighted on Seeed Engineering’s part to leave such capabilities on the floor.
GL :slight_smile:

What’s Your opinion ?

  • can I replace PPK2 with oscilloscope + small resistor ? how small ?
    Thanks for advice.
    PPK2 is pretty expensive :frowning:

Hi AdamM68,
Information about ppk2 can be found here. Schematics and manuals are included.
I got it and it is a very well designed and reliable unit.

Power Profiler Kit II - Downloads - nordicsemi.com

I may be wrong about the absolute wrist tilt function not being usable.

I found a register that reroutes INT2 interrupts to the INT1 pad.

CTRL4_C (13h)
INT2_on_INT1 All interrupt signals available on INT1 pad enable. Default value: 0
(0: interrupt signals divided between INT1 and INT2 pads;
1: all interrupt signals in logic or on INT1 pad)

Here is a schematic from another STM accelerometer that roughly shows how it works:

Hi AdamM68,

You may be able to use an O-scope and some trickery but for what it does, NO. Being able to Source the Supply and vary it as well as the Amp meter mode to test actual battery drain. IMO one of nordics best tools, better than there dev boards (kitchen Sink) Easy to use and setup , being able to screen capture and real time display. It’s a tool and as others have indicated built and works VERY well Best $99 dollars I have spent to date. I have a DSS O-scope and it even beats that IMO,
GL :slight_smile:

1 Like

Hi Honvi,
Wow, Nice that would be great… NICE find. I’ll try to look into that , I’m using the Free-fall with Impact detection registers as well as motion detection along with double tap interrupts and it all works together well. I would really like to use the interrupts for all of it though. I’m currently at NAB 2023 so won’t know until I’m back this weekend.

GL :slight_smile:

Just for all the noobs (like me) who are trying this code (since the documentation is low on this case). Note that the constants for the LEDs are named differently now (at least in my case). If you get errors that LEDR etc. can’t be found, they have to be renamed to LED_RED etc.
This is the code that worked for me.

// IMU Interrupt Example for XIAO BLE Sense
// This example shows how to configure LMSD6S3TR-C on XIAO BLE SENSE to interrupt
// on INT1 after a "Double Tap" was recognized.
// Additionally, the device goes into System OFF state, after 5 interrupts were
// received. Another "Double Tap" will wake up the device again.
// by chuck

#include "LSM6DS3.h"
#include "Wire.h"

LSM6DS3 myIMU(I2C_MODE, 0x6A);
#define int1Pin PIN_LSM6DS3TR_C_INT1

uint8_t interruptCount = 0; // Amount of received interrupts
uint8_t prevInterruptCount = 0; // Interrupt Counter from last loop

void setup() {

    pinMode(LED_RED, OUTPUT);
    pinMode(LED_GREEN, OUTPUT);
    pinMode(LED_BLUE, OUTPUT);
    setLedRGB(false, false, true); // set blue led

    myIMU.settings.gyroEnabled = 0; // Gyro currently not used, disabled to save power 
    if (myIMU.begin() != 0) {
        Serial.println("IMU error");
    } else {
        Serial.println("IMU OK!");
    pinMode(int1Pin, INPUT);
    attachInterrupt(digitalPinToInterrupt(int1Pin), int1ISR, RISING);

void loop() {
    setLedRGB(false, false, true); // reset led to blue only

    Serial.print("\Iterrupt Counter: ");

    // if interrupt was received in this cycle
    if (interruptCount > prevInterruptCount) {
      Serial.println("\Interrupt received!");
      setLedRGB(false, true, false); // set green only
    prevInterruptCount = interruptCount;
    if (interruptCount >= 5) {
      // Trigger System OFF after 5 interrupts

// -------------------- System ------------------------- //

void goToPowerOff() {
  setLedRGB(false, false, false);
  Serial.println("Going to System OFF");
  setupDoubleTapInterrupt(); // not needed here, if already applied..
  delay(100); // delay seems important to apply settings, before going to System OFF
  //Ensure interrupt pin from IMU is set to wake up device
  nrf_gpio_cfg_sense_input(digitalPinToInterrupt(int1Pin), NRF_GPIO_PIN_PULLDOWN, NRF_GPIO_PIN_SENSE_HIGH);
  // Trigger System OFF

// -------------------- Interrupts ------------------------- //

void setupDoubleTapInterrupt() {
  uint8_t error = 0;
  uint8_t dataToWrite = 0;

  // Double Tap Config
  myIMU.writeRegister(LSM6DS3_ACC_GYRO_CTRL1_XL, 0x60);
  myIMU.writeRegister(LSM6DS3_ACC_GYRO_TAP_THS_6D, 0x8C);
  myIMU.writeRegister(LSM6DS3_ACC_GYRO_INT_DUR2, 0x7F);
  myIMU.writeRegister(LSM6DS3_ACC_GYRO_WAKE_UP_THS, 0x80);
  myIMU.writeRegister(LSM6DS3_ACC_GYRO_MD1_CFG, 0x08);

void int1ISR()

// -------------------- Utilities ------------------------- //

void setLedRGB(bool red, bool green, bool blue) {
  if (!blue) { digitalWrite(LED_BLUE, HIGH); } else { digitalWrite(LED_BLUE, LOW); }
  if (!green) { digitalWrite(LED_GREEN, HIGH); } else { digitalWrite(LED_GREEN, LOW); }
  if (!red) { digitalWrite(LED_RED, HIGH); } else { digitalWrite(LED_RED, LOW); }

In any case, thanks a lot for the code. I was looking for a free-fall detection and couldn’t find any working code. I hope yours will help me develop something I need.

Hi there, This One is working.


GL :slight_smile: