grounding a resistor divider circuit through the pin for extreme power savings

Hi there, I have a potentially dumb or creative question that i cant seem to get a good answer on.

I am running a device that is going to be conscious of uA level power consumption. It will be in deep sleep for most of its operating life.
I want to make a low accuracy battery monitoring circuit using a resistor divider network.
I see other designs using multiple transistors to enable and disable this simple circuit. the board is only 14x14mm so i dont have space for much of anything.

I had the idea of grounding the resistor circuit through a pin on the nrf52840 set as a low output. and then when i want to disable the network for no power draw i will set the sink and ADC pins to high impedance and then deep sleep the processor.

I don't see this being done anywhere which makes me nervous.

I would be careful to make the ADC high impedance first and then the sink pin to avoid exposing the ADC pin to the battery voltage and then when i wake up the processor i would make the sink pin low output and the ADC an input.  

My understanding is that the pins will be left floating and disconnected in this high impedance state, I have seen people suggest that voltage in to a pin before vdd is connected can backfeed and cause issues with power on, then during the case of populating the raw pcb, and providing power, my question would become, " for an unprogrammed stock NRF52840, what state are the pins defaulting to?" 

Other context. I am using a QKAA BGA, the VDDH and VDD is configured to external supply. a potential scenario is the battery is charging at 4.2v, processor is off,  vddh is connnected to 4.2v, nothing on vdd. since it may not be configured yet or disabled in sleep.  now i have 4.2v through a resistor into a high impedance ADC and nothing on vdd.  Is this an issue?

Parents
  • Nothing you can do will "disconnect" any SADC or port io pin and any voltage on the pin will phantom power the internal nRF52 VDD via the schottky protection diode connected to the pin if the external voltage is above that VDD+300mV. This is an approximation of the internal circuitry of the SAADC; D1 and D2 are connected to the pin regardless of whether the pin is SAADC input, port output, port input or port "disconnected":

    //         |                |    VDD                                         VDD                    |
    //         |                |   --#--                                       --#--                   |
    //         |                | D1__|__                    Auto-adjust:         |   160k              |
    //         |                |    / \                     Bias inputs at VDD/2 +-| Bias Hi/Lo/Both   |
    //         |                |   /-+-\                     VDD1_2                |<-                 |
    //         |                |     |   PIN_VOLTAGE_1                           +-|                   |
    //         |          P0.28 |     |   AIN4          |----'T'-Mux-P---|        |            P SAADC  |
    //         #--------#-------O-----#------#-------#--+ +----#-------+ +--#-----#------#------#-->    |
    //         |        |       |     |      |       |  | |    |       | |  |     |      |      |       |
    //         |        |       | D2__|__  -----     |  ----   +-|    ----- |     +-|   +++     |       |
    //         |        |       |    / \   -----     |   |       |<--+  |   |       |<- | |   -----     |
    //  Rref  +++ 100nF |       |   /-+-\    | 3pF   |   |     +-|   |  |   |     +-|   | |   -----     |
    //  2k0   | |     -----     |     |      |       |   +---- |--------#   |     |     +++     | 2.5pF |
    //  1%    | |     -----     |   =====  =====     |         |     |  |   |     |      |1M0   |       |
    // (0.1%) +++       |       |    ===    ===      |       =====   |  |   |   =====  =====  =====     |
    //         |        |       |     =      =       |        ===    |  |   |    ===    ===    ===      |
    //         |        |       |                    |         =    Select  |     =      =      =       |
    //         |        |       |                    |                      |                           |
    //         |        |       |                    |                      |                           |
    //         |        |       |                    |  |----'T'-Mux-N---|  |                           |
    //         |        |       |                    +--+ +----#-------+ +----+                         |
    

    As ketiljo suggests, 2 high value resistors and a capacitor is the minimum board area solution; however, a flying capacitor is a better solution with almost zero power drain but that takes a little more space.

    maximum-possible-saadc-differential-voltage Add a 2nd capacitor C to the SAADC input, such that Vbatt becomes Vbatt/2 when measured

  • thank you, I knew there was some reason why this is not done and that explains it. I will attempt the high value divider and cap and see how that works thank you all

Reply Children
  • Try this; the single break-before-make analogue switch is tiny; no resistors and just 2 capacitors say 10nF

    // Battery voltage measurement
    //
    // Connect C1 to Vbatt; discharge C2 by making port pin output low; change pin to SAADC; connect C1 to C2 measure Vbatt/2 with SAADC
    //
    //                            +-----------------------------------------------------------------------+
    //                            |                              nRF52832/nRF52840                        |
    //           +----------------0---< Switch o/p to sample                                              |
    //           |                |     Discharge C2 first then Vc2 = Vbatt/2                             |
    //           |                |    VDD                                         VDD                    |
    //           |                |   --#--                                       --#--                   |
    //           |                | D1__|__                                         |   160k              |
    //           |                |    / \                                          +-| Bias Hi/Lo/Both   |
    //           |                |   /-+-\                                           |<-                 |
    //           |                |     |                                           +-|                   |
    //           |                |     |                 |----'T'-Mux-P---|        |            P SAADC  |
    // Vbatt---0 | 0------#-------0-----#------#----------+ +----#-------+ +--------#------#------#-->    |
    //          \'        |       |     |      |          | |    |       | |        |      |      |       |
    //           \        |       | D2__|__  -----       -----   +-|    -----       +-|   +++     |       |
    //           0        |       |    / \   -----         |       |<--+  |           |<- | |   -----     |
    //           |        |       |   /-+-\    | 3pF       |     +-|   |  |         +-|   | |   -----     |
    //           |        |       |     |      |           +---- |--------#         |     +++     | 2.5pF |
    //         -----    -----     |   =====  =====               |     |  |         |      |1M0   |       |
    //         -----    -----     |    ===    ===              =====   |  |       =====  =====  =====     |
    //           | C1     | C2    |     =      =                ===    |  |        ===    ===    ===      |
    //           |        |       |                              =    Select        =      =      =       |
    //           |        |       |                                                                       |
    //           |        |       |                                                                       |
    //           |        |       |                                                                       |
    //           |        |       |                                                                       |
    //           |        |       |                                                                       |
    //           #--------#-------0-----+    <== Gnd or use 2nd SAADC Input                               |
    //           |                |     |                                                                 |
    //         =====              |   =====                                                               |
    //          ===               |    ===                                                                |
    //           =                |     =                                                                 |
    //                            +-----------------------------------------------------------------------+
    

    Something like this fsa3051-d.pdf or this sn74lvc2g53.pdf

  • This Is a good solution also, thank you!
    I may not have any more room for  switch.  The board is entirely bgas and 0201s, smaller than a penny.

    I was having a hard time deciding on the values for the divider circuit + cap, I couldn't figure out why 4M was chosen as R1.  I technically need to handle 4.2v in, but the adc pin maximum needs to be 1.8v. Then i became lost on sizing the capacitor.

    I would like R1 to be 8Mohm and R2 to be 6Mohm. but i dont know if R1 cannot be that high for some reason

  • The SAADC input impedance is something over 1MOhm, so when configured as an ADC input that will be in parallel with R2 at 6MOhm; the source impedance also affects the minimum SAADC sample time. However, if the filter capacitor is large enough and the SAADC is only configured as an ADC input pin just before taking a reading and then disconnected you will get away with a simple (or no) calibration factor. How large is large enough for the capacitor? At (say) 20uSec SAADC sample / acquisition time the capacitor should discharge into (say) 1MOhm by less than the error you can tolerate. Maybe try 100nF which should give less than 1% error provided (enabling SAADC+sample time+reading SAADC) < 100uSec.

Related