Measuring battery voltage in power sensitive application - Page 1
Forum section: electronics / projects

author: justlv
author_rank: Newbie
timestamp: June 18, 2014, 02:08:53 pm
content: I'd like to accurately measure the voltage of a battery. My ADC Ref is at 3.3V and my battery is ~5V. I'm looking at not having any quiescent current greater than a few uA's so a voltage divider of 100k is too much of a drain, so I'd like to disable it when not reading it.I'd like to just use one MOSFET. Would I be able to just use one N-channel MOSFET with a GPIO tied directly to the gate, sitting below a voltage divider, or would I need to have a setup where I use an N-channel to turn on a P-channel by pulling it's gate to ground, as shown in attached image?Alternatively, are there any concerns with using much larger resistors (800k or so) for this voltage bridge, if I want to leave off the gating?Thanks!

author: sunnyhighway
author_rank: Frequent Contributor
timestamp: June 18, 2014, 02:55:13 pm
content: I would settle for a simple voltage decider using only a 10M and 22M resistorThis would only draw a measely 156.25 pA.In addition, you might want to consider shutting down the ADC itself while not measuring.

author: max_torque
author_rank: Super Contributor
timestamp: June 19, 2014, 02:26:34 pm
content: If you can make sure the battery voltage is mainly a DC quantity (and it should be) then you can use a very high resistance divider bridge, with a "coupling" capacitor to present a lower (transiently) source impedance to the microcontrollers ADC input.(ie the cap provides a suitable "rush" of current to furnish the ADC with a voltage very close to that of the divider, but only during the rare moments when the system is actually sampling the system)The issue with using a mosfet to break the lower side of the bridge to ground is that you will then apply the full Vbatt to the micro's ADC pin, although obviously the resistance of the upper bridge resistor will limit the current flow through the micro's internal pin protection diode to Vss.

author: mikerj
author_rank: Super Contributor
timestamp: June 19, 2014, 08:59:11 pm
content: The problem with a high impedance divider and a capacitor is that the ADC input is going to have some leakage current. e.g. many Microchip PICs have a maximum input leakage of 1uA, not a lot but if you have a divider with resistors in the Megohm range it's going to cause a pretty large error which no amount of capacitance will fix. Being a leakage current it will likely vary with temperature etc. so not something easily calibrated out. You could add a unity gain buffer to overcome this, but it will also need to be switched to save power.If the ADC is in a microcontroller, is it possible to arrange things so that you can switch the ADC Vref to Vdd and then measure the reference with one of the input channels? This could allow you to measure battery voltage with a little maths.

author: rr100
author_rank: Frequent Contributor
timestamp: June 20, 2014, 09:34:21 am
content: Just to mention I've had the same question:https://www.eevblog.com/forum/chat/resistive-divider-gt-adc-how-to-get-low-parasitic-drain/Still no magic bullet.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: June 20, 2014, 10:24:46 am
content: Capacitive level shifter :http://electricstuff.co.uk/picavrstuff.html#Measuring%20battery%20voltageYou need to keep the divider resistance fairly low to avoid errors due to leakage etc. but as you're only sampling occasionally it's not a problem.

author: tom66
author_rank: Super Contributor
timestamp: June 20, 2014, 10:59:47 am
content: Quote from: sunnyhighway on June 18, 2014, 02:55:13 pmThe problem with this solution is that the bias current of most ADCs is too significant to use this solution.However, one possible solution which I used myself is to stick a 10n~100n capacitor across the lower resistor. Make sure you turn the ADC input off when you don't want to use it so you're only subject to the bias current of a digital input. (Analog input is usually much greater.) Then when the ADC wants to sample it has a very low impedance source to sample from.Obviously you need to consider the risetime ~3RC too. For me 1Meg upper and lower resistors with 100n capacitor worked and the risetime is ~0.3s, fast enough for most battery detection applications.

author: rr100
author_rank: Frequent Contributor
timestamp: June 20, 2014, 11:25:46 am
content: Are you using something similar as the schematic from the earlier referenced thread (I'm including it here with credits to codeboy2k for easy reference)?The devil is in the details, also the micro and the states used would be interesting to know.

author: tom66
author_rank: Super Contributor
timestamp: June 20, 2014, 11:35:21 am
content: What kind of MCU can stand off 15V on an IO pin?

author: rob77
author_rank: Super Contributor
timestamp: June 20, 2014, 11:58:17 am
content: the schematic above - either you need a open collector/drain IO pin which can withstand the 15V or add a N-channel mosfet or NPN transistor to pull the P-channel mosfet's gate.the 74xx logic gates with open collector can withstand 15V (7406 does even 30V) , but i doubt the modern MCU can do this

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: June 20, 2014, 08:05:06 pm
content: Quote from: rob77 on June 20, 2014, 11:58:17 am<sigh> you just use a capacitor to do the level-shifting. Job done. Next problem please....

author: Jeroen3
author_rank: Super Contributor
timestamp: June 20, 2014, 09:07:22 pm
content: Quote from: tom66 on June 20, 2014, 11:35:21 amThose with 5V tolerant pads can. With little enough current not to blow the internal overvoltage diodes.Notice you will immediately kill it if the supply is taken out. So it's better to not have that situation.

author: mjkuwp
author_rank: Unknown
timestamp: June 21, 2014, 01:26:23 am
content: there is a really good series on jeelabs. Jean-Claude had some ideas and the readers popped in with some comments and it seemed like they had created some pretty clever circuits. this stuff is a bit over my head at this point but I always intended to go back and read it closer.http://jeelabs.org/2013/05/17/zero-powe-battery-measurement/There are entries before and after that one I linked above.

author: rob77
author_rank: Super Contributor
timestamp: June 21, 2014, 07:08:37 am
content: Quote from: mikeselectricstuff on June 20, 2014, 08:05:06 pmyou mean a capacitor between the IO pin and the gate (schematic in rely #10) ? wouldn't that open the P mosfet only for a short period till the capacitor is charged up to full rail voltage after the IO pin goes low ?

author: tautech
author_rank: Super Contributor
timestamp: June 21, 2014, 07:17:48 am
content: Is something like this any use?http://www.maximintegrated.com/en/products/power/supervisors-voltage-monitors-sequencers/ICL7665.html

author: max_torque
author_rank: Super Contributor
timestamp: June 21, 2014, 10:42:01 am
content: Quote from: rob77 on June 21, 2014, 07:08:37 amEr, exactly! And during that short time, you measure the divider output. The caps effectively block the DC component, so you don't waste power or overvolt your micro GPIO !

author: mikerj
author_rank: Super Contributor
timestamp: June 21, 2014, 11:11:02 am
content: Quote from: Jeroen3 on June 20, 2014, 09:07:22 pmYou should never deliberately bias protection diodes into conduction. The protection diodes specifications are almost always listed under "Absolute Maximum", so is a non-operating condition. I know from first hand experience that injecting current into protection diodes on a micro can cause reported ADC values to become screwy.The other issue is that with the protection diode biased into conduction, this scheme wouldn't work anyway as the transistor would always be turned on.

author: Andreas
author_rank: Super Contributor
timestamp: June 25, 2014, 07:34:25 pm
content: Hello,the question is already answered here:https://www.eevblog.com/forum/projects/microcontroller-running-3v3-sense-9v-battery-voltage-with-adc/msg397289/#msg397289with best regardsAndreas