- Removed mosfet for Si7021
- Reduced resistor values for the potential divider
- Added a 1K resistor between GPIO16 and RST
- Added a 0.01uF cap between ADC and GND
I also simplified voltage conversion:
// Ideal ADC and voltage divider behaviour
// is 4.2/1024.0
// For accurate battery voltage measurements
// use an accurate voltage input, measure ADC
// and replace values below (assumes linear response)
#define vbatt_calibration 4.2/1024.0
// switch on ADC circuit
digitalWrite(adcPowerPin, LOW); // inverted
// first adc reading is garbage, so take another
int adc = analogRead(A0);
adc = analogRead(A0);
// switch off ADC circuit
digitalWrite(adcPowerPin, HIGH); // inverted
float vbatt = vbatt_calibration * float(adc);
A single calibration per board is fairly linear as far as initial tests go.
I have PCBs arriving soon so will do more testing.