Author Topic: Measuring battery voltage in power sensitive application  (Read 6405 times)

0 Members and 1 Guest are viewing this topic.

Offline justlvTopic starter

  • Newbie
  • Posts: 4
Measuring battery voltage in power sensitive application
« on: June 18, 2014, 02:08:53 pm »
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!
 

Offline sunnyhighway

  • Frequent Contributor
  • **
  • Posts: 276
  • Country: nl
Re: Measuring battery voltage in power sensitive application
« Reply #1 on: June 18, 2014, 02:55:13 pm »
I would settle for a simple voltage decider using only a 10M and 22M resistor
This would only draw a measely 156.25 pA.

In addition, you might want to consider shutting down the ADC itself while not measuring.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1322
  • Country: gb
    • bitdynamics
Re: Measuring battery voltage in power sensitive application
« Reply #2 on: June 19, 2014, 02:26:34 pm »
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.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3306
  • Country: gb
Re: Measuring battery voltage in power sensitive application
« Reply #3 on: June 19, 2014, 08:59:11 pm »
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.
 

Offline rr100

  • Frequent Contributor
  • **
  • Posts: 339
Re: Measuring battery voltage in power sensitive application
« Reply #4 on: June 20, 2014, 09:34:21 am »
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.
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13917
  • Country: gb
    • Mike's Electric Stuff
Re: Measuring battery voltage in power sensitive application
« Reply #5 on: June 20, 2014, 10:24:46 am »
Capacitive level shifter :
http://electricstuff.co.uk/picavrstuff.html#Measuring%20battery%20voltage

You 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.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline tom66

  • Super Contributor
  • ***
  • Posts: 6895
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Measuring battery voltage in power sensitive application
« Reply #6 on: June 20, 2014, 10:59:47 am »
I would settle for a simple voltage decider using only a 10M and 22M resistor
This would only draw a measely 156.25 pA.

The 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.
 

Offline rr100

  • Frequent Contributor
  • **
  • Posts: 339
Re: Measuring battery voltage in power sensitive application
« Reply #7 on: June 20, 2014, 11:25:46 am »
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.

 

Offline tom66

  • Super Contributor
  • ***
  • Posts: 6895
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Measuring battery voltage in power sensitive application
« Reply #8 on: June 20, 2014, 11:35:21 am »
What kind of MCU can stand off 15V on an IO pin?
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Measuring battery voltage in power sensitive application
« Reply #9 on: June 20, 2014, 11:58:17 am »
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 ;)
 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13917
  • Country: gb
    • Mike's Electric Stuff
Re: Measuring battery voltage in power sensitive application
« Reply #10 on: June 20, 2014, 08:05:06 pm »
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 ;)
<sigh> you just use a capacitor to do the level-shifting. Job done. Next problem please....
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4126
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Measuring battery voltage in power sensitive application
« Reply #11 on: June 20, 2014, 09:07:22 pm »
What kind of MCU can stand off 15V on an IO pin?
Those 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.
« Last Edit: June 20, 2014, 09:09:58 pm by Jeroen3 »
 

Offline mjkuwp

  • Supporter
  • ****
  • Posts: 260
  • Country: us
  • mechanical engineering defector
    • The Mz Lab
Re: Measuring battery voltage in power sensitive application
« Reply #12 on: June 21, 2014, 01:26:23 am »
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.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Measuring battery voltage in power sensitive application
« Reply #13 on: June 21, 2014, 07:08:37 am »
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 ;)
<sigh> you just use a capacitor to do the level-shifting. Job done. Next problem please....

you 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 ?
 

Offline tautech

  • Super Contributor
  • ***
  • Posts: 29189
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Offline max_torque

  • Super Contributor
  • ***
  • Posts: 1322
  • Country: gb
    • bitdynamics
Re: Measuring battery voltage in power sensitive application
« Reply #15 on: June 21, 2014, 10:42:01 am »
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 ;)
<sigh> you just use a capacitor to do the level-shifting. Job done. Next problem please....

you 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 ?


Er, 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 !
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3306
  • Country: gb
Re: Measuring battery voltage in power sensitive application
« Reply #16 on: June 21, 2014, 11:11:02 am »
What kind of MCU can stand off 15V on an IO pin?
Those 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.

You 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.
 

Online Andreas

  • Super Contributor
  • ***
  • Posts: 3286
  • Country: de
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf