0

What is the expected behavior after LiPo battery is depleted
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

What is the expected behavior after LiPo battery is depleted

by zKyd on Wed Mar 17, 2021 11:59 am

We're designing a character hydration tracker to hug a water bottle and flash a few NeoPixels written in CircuitPython on a Feather M0 Express with a small LiPo battery.

PXL_20210314_000304295.jpg
PXL_20210314_000304295.jpg (153.28 KiB) Viewed 125 times

PXL_20210314_013716631.jpg
PXL_20210314_013716631.jpg (165.06 KiB) Viewed 125 times


There's a USB access port at the bottom, which allows us to recharge the LiPo battery enclosed inside using the default Feather M0 Express charging through USB.
PXL_20210315_150146920.jpg
PXL_20210315_150146920.jpg (148.39 KiB) Viewed 125 times


However, I'm running into some challenges with that charging after the battery is depleted.

The first time we let the battery deplete itself then plugged it into USB, it entered into BOOT mode for some reason (flashing red lights), which required us to manually press the RESET button on the Feather M0 Express board to restore functionality. This seems like it could occasionally happen from this guide:
https://learn.adafruit.com/adafruit-fea ... shooting-2

The second time we let the battery deplete itself then plugged it into USB, the charging indicator was orange but it wasn't in BOOT mode and wasn't running our code.py either. The NeoPixel on the board was not doing anything. Unplugging the USB and reconnecting the cable had the same results, the orange light was on but code.py was not running. Manually pressing the RESET button allowed the code.py to execute while the battery continues to charge.

Specific to our design, we did not make an easy access port to the RESET button. Our thought was that when the battery becomes depleted we could simply connect it to USB to recharge and the code.py would begin to execute again.

I'm wondering if this is expected behavior, in that we must press the RESET button each time after the battery is depleted, such that it'll start executing code.py again?

zKyd
 
Posts: 4
Joined: Sat Aug 08, 2020 6:59 pm

Re: What is the expected behavior after LiPo battery is depl

by mikeysklar on Thu Mar 18, 2021 5:58 pm

This is a fun project. Cool design and idea. Good work.

When you plugin the device to charge could you do it from a dumb charger and not a computer connected USB source? If this is really a case of depleted battery requiring a reset you could add voltage monitor and shutdown the device before it gets so low to enter this reset state. It doesn't take much to measure the battery and you already have a bunch of lights to signal the user that it is time to recharge.

https://learn.adafruit.com/adafruit-fea ... -2298065-9

Code: Select all | TOGGLE FULL SIZE
import board
import analogio
 
vbat_voltage = analogio.AnalogIn(board.D9)
 
 
def get_voltage(pin):
    return (pin.value * 3.3) / 65536 * 2
 
 
battery_voltage = get_voltage(vbat_voltage)
print("VBat voltage: {:.2f}".format(battery_voltage))

mikeysklar
 
Posts: 4522
Joined: Mon Aug 01, 2016 8:10 pm

Re: What is the expected behavior after LiPo battery is depl

by zKyd on Fri Mar 19, 2021 10:03 am

Thanks, that makes sense, and simple enough to do!

Regarding the "shutdown when the battery is low", I'm assuming this is not something we could accomplish in software, and we'd need a physical switch to cut power to the board? Something like the JST ON/OFF switch here:
https://learn.adafruit.com/on-slash-off-switches

Or is there some software trick to gracefully powering off the device at a certain voltage level, and only resume execution once the voltage rises above a given threshold?

zKyd
 
Posts: 4
Joined: Sat Aug 08, 2020 6:59 pm

Re: What is the expected behavior after LiPo battery is depl

by mikeysklar on Fri Mar 19, 2021 1:59 pm

Shutdown would be an issue, but if the voltage drops below an acceptable level you could use time.sleep(10) and just flash a red led every 10 seconds as an indicator to charge the device up.

mikeysklar
 
Posts: 4522
Joined: Mon Aug 01, 2016 8:10 pm

Re: What is the expected behavior after LiPo battery is depl

by upnorthtek on Tue Apr 06, 2021 6:53 pm

When a device is plugged into a computer connected USB cable they react differently then when plugged into a USB charging adapter.
There is typically a resistor on the device being charged that will initiate a com-link with the pc and expect a responding handshake. (dev boards will expect a firmware download) USB chargers are just a power source and will not negotiate any handshakes when asked for the device. Thus allowing the device to boot into a normal operating mode.

upnorthtek
 
Posts: 3
Joined: Fri Mar 27, 2020 4:15 pm

Please be positive and constructive with your questions and comments.