I have been trying to figure out how to properly measure battery voltage for a few days. The more I read, the less I understand. I know there are many questions like this out in the internet and I have read most of them, but I haven't properly understood many of them. Also, many of them have no examples. Perhaps you can help me to understand some of the aspects.
What I'm trying to do:
I want to measure battery voltage which is 4.5V (3 x AA batteries) when full. I'm using an ATmega328P ADC to do that. My system runs on 3.3V. I have low power step down regulator to convert 4.5V to 3.3V.
My system takes max 50mA. I'm definitely concerned about battery life and accuracy. I would like to see about 50mV accuracy.
What I have read / what are my options (ideas):
Obviously the simplest solution is to use just voltage divider to feed the ATmega ADC. As I understand the ATmega, AREF is around 1.1V so I need to calibrate it 1/4 down. I was thinking about using 1 Mohm and 330 kohm resistors.
Then I read using P-MOSFET to switch it on and off when measuring, would be way to save power. Definitely it is. Problem is that I need additional N-channel to control P-MOSFET, and additional resistor/resistors. Not sure how good it is in terms of battery saving. Also many additional components.
I read about using an additional buffer between the ADC and divider. Now I started reading about impedances. In my case it probably won't matter, but just out of curiosity can anyone explain me simply enough when and how impedances matter when using ADC and how op-amps help?
I know a bit of theory behind them and understand that an op-amp input has high impedance and an op-amp output has low impedance. It would be really nice if I would get some examples. All links are welcome as well. I already tried to understand it, but I'm still confused. Examples would be great.
Also how accuracy/resolution depends on resistor values? Higher resistors seem to have the worst accuracy.
I ended up reading about differential amplifiers. Obviously it is overkill in my case.
I thought to use a specific μC for that.