For LIPO measurement a 820K / 220K will work pretty well and not impose much extra drain on the battery.
const int battery = A0;
int input = 0;
void setup() {
Serial.begin(9600);
Serial.println ("Setup");
}
void loop() {
input = analogRead (battery);
Serial.println (input);
delay(1000);
}
R1 820K R2 220K input = 194-202 for 4.2V ( checked with multimeter )
Linear regulator = MCP1826S - Drop out 250mV typ so 3.55V min supply voltage?
200 = 4.2V
200/4.2 x 3.6 = 172
So I will need to change my battery at 172 which does not seem a very useful battery life.
I now have two second hand lipo battery packs with 4 cells and one pack has been running over a week so it is not to bad. I will check the voltage on the pack when the Nodemcu stops transmitting. Over the summer I will probably go back to the single battery with a solar panel which worked well. Due to charging problems with the lipo in the winter/cold I decided to go the full battery route.
no problem, just use a voltage divider between your battery and the external ADC.
Good idea schufti
Thank you all for the input and some very useful information I think.