Browse Source

HeltecV4: Use ADC_2_5db attenuation for battery reading

The resistor divider (390kΩ/100kΩ) keeps the ADC pin voltage in the
0.61-0.86V range across the full LiPoly range (3.0–4.2V). ADC_2_5db
(~1250mV full-scale) uses ~70% of the ADC range at full charge, giving
better resolution than the default ADC_11db (~20%) while maintaining
headroom over ADC_0db (~950mV) to handle chip-to-chip ADC variation
pull/2689/head
Thomas Roberts 1 week ago
parent
commit
1c30fb44e8
  1. 1
      variants/heltec_v4/HeltecV4Board.cpp

1
variants/heltec_v4/HeltecV4Board.cpp

@ -63,6 +63,7 @@ void HeltecV4Board::begin() {
uint16_t HeltecV4Board::getBattMilliVolts() {
analogReadResolution(12);
analogSetPinAttenuation(PIN_VBAT_READ, ADC_2_5db); // divider puts pin at 0.61-0.86V so this attenuation should cover it with some room to spare
digitalWrite(PIN_ADC_CTRL, HIGH);
delay(10);
uint32_t raw_mv = 0;

Loading…
Cancel
Save