Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By btidey
#75344 Yes. Higher resistor values are better to reduce the drain. The ADC input is pretty high impedance I think.

I normally use 1M 220K for a LIPO battery. I think the 47K 10K version was in an app using a on/off switch so background drain wasn't an issue
User avatar
By dynek
#75860
btidey wrote:
Code: Select allvoid checkBattery() {
   int adc;
   adc = analogRead(A0);
   battery_volts = (battery_volts * 15 + battery_mult * adc_cal * adc) / 16;
   }
}

Thank you!

Anyway the problem I'm having is that I'm unable to find a ratio. Here are a few values I get from ADC with a 5.1K/1.2K divider:

5.23V = 865
5.12V = 842
5.00V = 816
4.80V = 776
4.70V = 758

Thank you!
User avatar
By trackerj
#75907 I would suggest you to take a look at this related article where is explained in details how to add a Voltage Divider to the ESP8266 Internal ADC input to increase the ADC input range and how to calculate voltage divider ratio, etc:
ESP8266 Internal ADC – the easy way example
User avatar
By dynek
#75908
trackerj wrote:I would suggest you to take a look at this related article where is explained in details how to add a Voltage Divider to the ESP8266 Internal ADC input to increase the ADC input range and how to calculate voltage divider ratio, etc:
ESP8266 Internal ADC – the easy way example

Very interesting articles (also read adc-1), thank you!
However the problem here, once again is:
Code: Select allad= adcr*LSB

The value read on the ADC pin multiplied by some value (ratio) should give the voltage.
In my case there's no such ratio. I'm simply applying the rule of three and it just doesn't work.
Moreover I never get a value that seems to match 1V = 1024

Res Divider ratio: 0.19047619

5.23V (0.99619V on ADC) = 865
5.12V (0.97523V on ADC) = 842
5.00V (0.95238V on ADC) = 816
4.80V (0.91428V on ADC) = 776
4.70V (0.89523V on ADC) = 758

And final note :-) these are values from a few days ago, I just turned on the ESP with 5.23V -> ~1V on ADC and it values returned were between 770 and 787. I'm not looking for accuracy but it doesn't seem usable at all...