1

We have a pcb with an Atmega (MCU) on it, that most of the time is in sleep mode, consuming 50-100 uA .

When it wakes up, and only then , we need to take a sample of the battery voltage to send to the server .

I was considering few options and wonder which is the "right" if we dont want to loose current .

Voltage will be 3.6-4.2V when its full via 3.6V regulator .

  1. connecting the battery with serial resistor(>50k ?? ) directly to the ADC.
  2. take 2 large resistors(100k?) and create voltage divider of the battery voltage , and connect the point between them to the ADC .
  3. connecting the battery directly to the ADC ?

--- should we measure after or before the regulator ??

A 100k resistor will leak about 50uA of current which is no that good ,because the Atmega itself should be the only and main consumer on sleep with 50-100uA .

Curnelious
  • 1
  • 2
  • 12
  • 29
  • According to the AVR datasheet you shouldn't drive ADC inputs with an impedance > 10k (top of mind) Checking the datasheet chapter on ADC is a good practice in this sort of applications. Did you check existing questions on this topic, because I am absolutely sure some good answers have been given on this very topic. I believe Olin once explained how to use a transistor to enable the voltage divider only during measurements. – jippie Oct 27 '15 at 17:18
  • thanks, yes i have checked, but our needs is a very low current.. – Curnelious Oct 27 '15 at 17:23
  • Try these answers: http://electronics.stackexchange.com/questions/97856/using-a-mosfet-to-control-current-through-a-resistive-network – Andy aka Oct 27 '15 at 17:37
  • thanks, read that, it is helpful, but we cant add another MOSFET now... why cant we just put 2 resistors of 100k ? why the mcu cant tolerate that ? – Curnelious Oct 27 '15 at 17:42
  • 1
    @Curnelious - Probably because the ADCs are generally a bit crappy inside MCUs and don't offer many frills compared to seperate ADCs - there is no buffer inside them possibly because they can't engineer rail-to-rail op-amp technology to run from a 1V8 supply (or whatever it can go down to) so they leave it to you to fix. – Andy aka Oct 27 '15 at 18:15
  • thanks a lot. but what it has to do with big resistors? why cant you put 100k resistors in the input to divided the voltage? or even connect it directly with one resistor ? – Curnelious Oct 27 '15 at 18:21
  • The input offset current may be significant and cause an error if your source impedance is too high due to voltage dropped in the resistor. It may not matter if you are not looking for exact accuracy and just a predictable relative reading is adequate. You cannot measure after the regulator as it would no longer be measuring the battery but the stabilised voltage. – KalleMP Oct 27 '15 at 18:33
  • @KalleMP oh thats great, yes i only need to know more or less whats the battery situation. I am not sure i get whats the problem with 100k resistors? The larger they are the less current flow into the mcu , so isnt it better? – Curnelious Oct 27 '15 at 18:36
  • 2
    Think of it this way: you can consider the input impedance of the ADC as another resistor in parallel with the lower resistor in the voltage divider. If you have two 100K resistors in your divider and the ADC is also 100K (a guess, I haven't read the datasheet), you effectively have a 100K and a 50K resistor instead. – DoxyLover Oct 27 '15 at 18:37
  • @DoxyLover, got it. But if you know that impedance you can compansate , also, you can calibrate for when battey is full, so you dont really care whats the final reslut only how it changes. Am i wrong? Can 100k resistors cause some other dangerous things we should consider in mass production? – Curnelious Oct 27 '15 at 18:51
  • Putting the series resistor in is safer in practice, putting in the grounded resistor in the divider will waste battery capacity and is not really needed. If you characterise the reading you get and compare then to a good DMM you can make up a 10% accurate lookup table good for battery health monitoring. – KalleMP Oct 27 '15 at 19:19
  • This question has been asked half dozen times on EE.SE. Just a few of that prior art: [this](http://electronics.stackexchange.com/q/92820/7036), [this](http://electronics.stackexchange.com/a/39429/7036), [this](http://electronics.stackexchange.com/questions/18411/microcontroller-low-battery-indicator). – Nick Alexeev Oct 27 '15 at 19:28

1 Answers1

2

I have done this before, I used a PFET to turn off the current through a 10k-10k voltage divider. The ADC on an Atmega should not have more then ~10k of impedance on the input or you need a capacitor or something to help buffer the amount of charge available to be read in by the ADC. Basically the PFET was always off, and only upon waking up was the voltage divider turned on for a short period of time.

MadHatter
  • 3,506
  • 1
  • 19
  • 45
  • Thanks a lot but i wrote FET is not possible. Anyway a delay between reading and setting the mux can solve this issue. A 1u delay for every 10k above then 10k. – Curnelious Oct 27 '15 at 19:30