• I am using a Pixl.js for a bike (velomobile) computer project.
    It should monitor the onboard LiPo battery with 11.1 V and is also driven by it.

    In case off immediate power loss (battery is dying or just disconnected) there should be a triggered routine to save some current data to flash.

    I was considering this:
    Battery power is monitored by an INA226.
    So one way is to regularly poll and detect an undervoltage.
    But this is slow and could only work for a slowly dying battery - no sudden disconnect.

    So another idea is this:
    Put a capacitor parallel to the Vin Pins to gain some time after power loss.
    Put a diode in front so the capacitor only feeds the Pixl, nothing outside.
    Wire the feeding current (before the doide) with a resistor (~10k) to a digital input.
    Put another small diode between 3,3 V and the input so the voltage will not rise above 3,3 V. (Maybe a Z-diode of about 3,3 V between GND and the input would be better?)
    As soon as the outside voltage drops, the pin will change to low and trigger a watch set on that pin.

    Will that work?
    Anyone tried something similar or has a better idea?

    Some ASCII Art sketch for clarification:

    Din  O---+--[R]----+
             |         |
             V diode   |
             -         |
             |         |
    3v3  O---+         |
                diode  |
    Vin  O---+---|<----+-------------O 
            +|                       + LiPo
            === capacitor
             |                       - LiPo
    GND  O---+-----------------------O
  • If you don't have other load just the Pixl and an INA226, it can run several seconds on a relatively small supercap. Bought a 5.5V / 0.something Farad one ages ago, and that can store enough energy to run the Pixl with LCD backlight on for seconds.

    Or modify your Pixl.js to use CR2032 battery as backup:
    CR2032 battery backup - the CR2032 can be used as a backup when Vin/USB power is not present. Cut the trace in the solder jumper below the CR2032 holder, and add a surface mount diode to the two pads to the right of it.
    So it could even run autonomously on the CR2032 after power loss. Altho 2.7V is the lower limit of the INA226, so that might not work reliably if your battery is low...

    I think on your schematic the Din would stay floating around 3.3V, if +LiPo was disconnected.
    If the INA226 doesn't work reliably on battery, I think a simple voltage divider + comparator in the Pixl would be enough. Check then NRF52LL on how to use the comparator.


Avatar for AkosLukacs @AkosLukacs started