Wednesday, January 15, 2014

Reducing Voltage Divider Load to Extend Battery Life

FET Switched Voltage Dividers

A few months back there was a discussion about battery monitoring at a TriEmbed meeting. Someone suggested using a n-type MOSFET between the bottom resistor of a voltage divider and ground to save power. The concept is that the microcontroller would use a digital IO line to drive the n-FET on for a measurement and then disconnect the voltage divider from the system/battery ground, reducing the divider current to zero. However modern microcontrollers include protection diodes from input pins to Vcc and GND to protect the pins from electrostatic discharge. So the ESD diodes will clamp the voltage on the resistor to Vcc + diode drop and conduct current from the battery positive, through the divider upper resistor into the ESD diode and to ground.

However, a user comment on the Jee Labs blog illustrates a novel approach to use a p-FET to disconnect the voltage divider to reduce the power loss in the divider to zero (see links). You can access my reference sites and documents using the links provided at the end of the text.

The image below, from the Atmel app-note listed in the References, illustrates the internal protection diodes present in an ATmega168 microcontroller. The Atmel document lists 5.5 volts as the clamped voltage for an AVR input pin. The PIC series from Microchip use the same ESD approach and can do mains monitoring in the same fashion.


Examples
To keep the math simple we will use 1k resistors to illustrate the change in battery life for a very simple circuit. You can use larger divider resistors to reduce the divider current but you will still see a similar change in sleep current due to the voltage divider switching between an N-FET and P-FET.

Note that the calculations assume that the N-FET and P-FET have negligible resistance compared to the voltage divider. I have calculated the sleep and wake current to allow us to use a battery life calculator to estimate the impact of the three circuit options on projected operating time.

While a versatile development board, the Uno does not lend itself to low-power battery applications.The Uni has a voltage regulator with Iq of 6mA as well as USB interface and LED that are always on. The easiest way to avoid all of these is to use a smaller form factor board with a low standby current, no power LED's and no extra USB chip. An Arduino Pro Mini looks like a good candidate, link provided.

Example.  9V Alkaline battery, 565mAh, Voltage divider, divide by 2, R1=R2=1k ohm.

Fixed Divider
Typical fixed voltage divider that would allow a 5V microcontroller to monitor a 9V battery. The 5V regulator and microcontroller are not shown.

The voltage divider would typically be connected to input power leg of the voltage regulator and receive power the entire time the project is switched on. The microcontroller would, among other tasks, periodically check the battery voltage and indicate to the user when the battery voltage had dropped enough that the battery should be replaced.

Voltage divider enabled current.  9V/2k = 4.5mA
Voltage divider disabled current =  doesn't apply, it is always on


N-FET
Voltage divider with ground leg switched by an N-FET.

The N-FET disconnects the bottom leg of the voltage divider from battery negative when DIO is driven low and would appear to prevent current from flowing from the battery but this is not actually the case. The Atmel app-note above indicates that the protection diodes will clamp the input terminal at Vcc + 0.5V. So even when the FET is disconnected, the input terminal clamps at 5.5 volts, producing the current below.

Voltage drop across R1 with n-FET off = Vin - Vclamp = 9V - 5.5V = 3.5V
Current through R1 with n-FET off  3.5V/1k = 3.5mA

Voltage divider enabled current.  9V/2k = 4.5mA
Voltage divider disabled current =  3.5mA

So the n-FET did reduce the sleep state load of the voltage divider but only from 4.5mA to 3.5mA!

P-FET
User comments on the Jee Labs blog points to using a voltage divider with the top leg switched by P-FET using a capacitor pulsed gate.


The P-FET responds to a pulse from the DIO line and turns on for approximately 2 milliseconds for the 10k and 0.1uF values provided. This means the microcontroller has 2ms to take the measurement and this 2ms is the only time the voltage divider loads the battery.

Current through R1 with p-FET off  = 0mA (open circuit)
Voltage divider enabled current.  9V/2k = 4.5mA
Voltage divider disabled current =  0 mA

The p-FET reduced the sleep state load of the voltage divider to effectively 0mA.

Battery Life Calculations
We focus only on the impact of the divider current and assume the other currents are zero. Looking at only the divider current and wake once a minute for 2ms to record the battery voltage, with a 9V battery with 565mA/hr capacity the Battery Life Calculator (link provided below) yields the following numbers for expected operating life:

No switch on voltage diver (sleep=4.5mA, wake=4.5mA)  => battery life = 3.92 days
N-FET on Low Side switch (sleep=3.5mA, wake=4.5mA)  => battery life = 4.88 days
P-FET on High-Side of divider (sleep=0.0mA, wake=4.5mA)  => battery life = 33.34 days

As you can see, the trick of driving the P-FET gate through a capacitor allowed us to boost the expected battery life from just under 4 days to over 33 days (over a factor or 6)! Note that you can use higher value resistors without a FET switch but you would still see the divider burden current all the time. The burden of even high value value resistors can be important when you are trying to shave every uA from your project and squeeze operating time from a coin cell or energy harvester. But you can combine higher value dividers with a p-FET for even longer battery life

I hope this information is helpful.

-Shane


References
Atmel AVR app-note discussing input pin clamp diodes.
http://www.atmel.com/images/doc2508.pdf

Voltage regulator for Uno, click Specification tab to find Iq on table. (Iq=6mA)
http://www.onsemi.com/PowerSolutions/product.do?id=NCP1117DT50G

Sparkfun Arduino Pro Mini
https://www.sparkfun.com/products/11113

Voltage regulator for Arduino Pro Mini (quiescent current 5 uA)
http://www.micrel.com/_PDF/mic5205.pdf

Lightweight Low Power Arduino Library, power numbers, can get a 328p down to 1.7uA!
http://www.rocketscream.com/blog/2011/07/04/lightweight-low-power-arduino-library/

Article on generating +5V directly from incoming AC line without transformers.
http://ww1.microchip.com/downloads/en/appnotes/00954a.pdf

Article showing Microchip PIC being used directly on AC line for lamp dimmer.
http://ww1.microchip.com/downloads/en/appnotes/91094a.pdf

Excellent battery life calculator with capacities listed for common batteries.
http://oregonembedded.com/batterycalc.htm

Link discussing the use of a P-FET to disconnect voltage divider to save power.
http://jeelabs.org/2013/05/18/zero-power-measurement-part-2/

Funny things happen when you drop below minimum input voltage on some low power regulators
http://jeelabs.org/2011/06/21/mcp1702-current-draw/

4 comments:

  1. Good reporting of the N-FET and P-FET circuits.

    However, using a 1k divider doesn't make sense when 10k works fine and draws 1/10 the current (39 days).

    Furthermore, by simply adding a capacitor dividers of 10M may be used, reducing current by 1/10,000. In your example that would be 0.45 uA (3920 days, 10.7 years). More info - http://jeelabs.org/2013/05/16/measuring-the-battery-without-draining-it/

    ReplyDelete
    Replies
    1. KanyonKris,

      Thanks for the comment. The 1k dividers were selected to make the math simple and offer an example of what someone new to using voltage dividers might select from RadioShack. My goal was to share the switched p-FET approach from JeeLabs and illustrate that using a low-side n-FET, as suggested as suggested during a recent meeting, would not work.

      The high sampling rate of once per minute does not give a realistic picture of the improvement possible using the switched FET. A more typical application may check the battery only every two hours, extending the FET switched run time by a factor of 120. This would improve even the 1k divider performance to 4009.8 days or 10.99 years. But I would expect the microcontroller load or battery self-leakage to have depleted the 9V battery before then.

      Delete
  2. So maybe I'm losing my mind, I've been trying to figuree this out for what feels like days. I'm using an APM9435 P-FET and the ONLY way I can get meaningful measuremnts off the divider is by omitting the Gate-Source Resistor.

    Any ideas? My Vgsth is -3 to -1 so by pulling the gate Low it should turn on the FET, right? I've tried values from the 10k suggested to 3.3Meg, but nothing works. Omitting the gate-source resistor and just driving the gate cap Low works as expected.

    Am I missing something? And is there any reason the resistor is necessary? I'm driving the gate from code, so I'm driving it high after the AnalogRead so the pull-up isn't really required, I'm thinking. Any help would be greatly appreciated.

    ReplyDelete
  3. KW Daily,

    Can you share your schematic? I am having a hard time picturing what you are trying to do. And often you solve your own problem when you explain the issue to someone else. The gate resistor should only impact the FET switching time. I would check the voltage on all of the FET terminals when you are trying to turn the device ON and again when you are turning the device OFF. I bet you will find the problem. Let me know how it goes!

    ReplyDelete