Xiao ble sense restart after battery low

Hi all,

my project is a battery powered sensor connected via bluetooth.

When not used it goes deep sleep and wakes up using the internal imu.

Everything is ok until the battery is charged, I can wake up when needed and recharge when I want, just applying a 5v to the vusb.

But if the battery goes low (it has the bms circuit) the xiao is switched off (no deep sleep, just low voltage cutoff) , and it seems that I cannot restart it by simply applying the 5v and recharging the battery.

I do have to manually press the reset button or disconnect the battery then recharge it externally.

Unfortunately these are not options for me, since the sensor is glued and only the charging pads are accessible.

Is this behaviour normal? Maybe I can use the internal voltage monitoring to shut down the system before the voltage cutoff happen.

Hi there,

And Welcome here…

SO when you say

were exactly are you applying the 5V? the Pin or the USB connector.
Have you looked at the schematic ? It’s on the resource page of the Wiki , there is a link to the PDF.
Can you post a picture of your DUT ,(may need a few more reply’s to get pic post credz) FYI..
My point is if you apply it on the USB-C it will reset it. :+1:

HTH
GL :santa_claus: PJ :v:

It’s not uncommon what you see there, it’s actually too much BMS , for the LVC threshold in the sequence. You can find posts about it here and Nordic’s as well as on epressif also users is experiencing a classic “latch-up” or “stuck state” scenario following a hard power loss caused by the BMS low-voltage cutoff (LVC).
When the BMS LVC trips, it physically disconnects the battery from the system’s power input line. The voltage drops instantly to zero, it’s not in an orderly shutdown.

When you reconnect the 5 Volts the internal charger starts supplying power back to the system power rail (VCC/Vbat line) and charges the battery. However, the microcontroller (MCU) gets stuck in an undefined or brownout state.
There’s a post on this here for the nrf52840 it can happen for any number of reasons here is what is known;

  • because:
    • The voltage rise might be slow or unstable while the battery is deeply depleted.
    • The internal power-on reset (POR) circuit of the XIAO might not properly engage unless the voltage ramps up very cleanly from absolute zero, or cycles completely off and then on again.
    • Some MCU internal states or surrounding circuitry get “stuck” due to the hard power cut.

I feel also that double reset feature so to and the values associated with the reset can be a factor.
The fact that pressing the physical reset button or fully disconnecting/reconnecting the battery solves the issue confirms that a proper power cycle or hardware reset is required to clear the MCU’s state.

Your idea to monitor the battery and do it cleanly of course is probably the best method, By monitoring the battery voltage in software, the XIAO can detect when the voltage drops to a safe minimum above the BMS LVC threshold. The code can then perform an orderly, controlled shutdown into deep sleep, leaving enough residual battery power for the power-on reset sequence to function correctly when 5V charging voltage is applied later.
This avoids the “hard cut” from the BMS LVC altogether, allowing the standard charging process to bring the chip back to life gracefully. :+1:

I have a Barrel Jack to USB for a project the 5 volts comes from a solar paneled power bank. I have a battery connected to the Battery Pads 1000mah as a fail over pad , backup… in 2 years no issue’s :crossed_fingers:

HTH
GL :santa_claus: PJ :v:

1 Like

also you may consider experimenting with a older unit like the XAIO SAMD and Grove Shield for Seeed Studio XIAO with embedded battery management chip - Seeed Studio

to see how these units recover

I know this older stuff was not so sensitive to power

Also try your code startup… try to add a little delay on the front in before init all the meat and potatos….. maybe add a capacitor somewhere…

1 Like

I like to use the voltage monitor to send the device to sleep if battery power gets too low.
I also find that sometimes when I don’t have the “luxury” of a voltage detection and reset circuit a watchdog can assist in ensuring a proper reset on power up.

2 Likes

Hi Pj, thank you for your reply, I stayed almost waken up this night thinking on the problem and I imagined exactly the scenario that you painted.

I am already monitoring the battery for other purposes, but stupidely I did not expected this happening.

Usually I recharge prior to this to happen, but this time I forgot, then It will be necessary to make a little surgery to extract the battery and wake up the unit.

In sequence I will update the firmware adding a controlled deep sleep for this situation.

Ah, the 5v is applied directly to the 5v terminal, just with a reverse protection diode.

1 Like

Good idea.

Will try to check it

I sure wish seeed would make a hardware voltage sensor a standard for XIAO…

1 Like

Good news. Somehow the xiao restarted after a day of rest. I could charge the battery and everything works normally. Of course I already prepared a new firmware with the deep sleep activated from the voltage monitor.

Now I have two different deep sleep, one for the charged battery, wake up from IMU or charger.

The other when the battery goes too low, wake up only with charger.

thanks to everyone

2 Likes

Hi there,

So Great JOB, staying focused and on task. Glad you got two very good solutions from asking a good question. I am certain it WILL help others. :+1: thanks for the contribution.

GL :santa_claus: PJ :v:

1 Like