Calibrate battery ADC and document LiPo curve
- Add BATTERY_CAL config and debug logging for raw ADC samples - Use LiPo voltage curve (4.2V full, 2.9V empty) for % mapping - Document battery calibration, curve, and debug output in README
This commit is contained in:
12
README.md
12
README.md
@@ -251,17 +251,20 @@ inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = { 0xF19C };
|
||||
|
||||
## OLED Behavior
|
||||
- Sender: OLED stays on for `OLED_AUTO_OFF_MS` after boot or last activity.
|
||||
- Activity is detected while `PIN_OLED_CTRL` is held high, or on the high→low edge when the control is released.
|
||||
- Activity is detected while `PIN_OLED_CTRL` is held high, or on the high->low edge when the control is released.
|
||||
- Receiver: OLED is always on (no auto-off).
|
||||
- Pages rotate every 4s.
|
||||
|
||||
## Power & Battery
|
||||
- Sender disables WiFi/BLE, reads VBAT via ADC, uses linear SoC map:
|
||||
- 3.0 V = 0%
|
||||
- Sender disables WiFi/BLE, reads VBAT via ADC, and converts voltage to % using a LiPo curve:
|
||||
- 4.2 V = 100%
|
||||
- 2.9 V = 0%
|
||||
- linear interpolation between curve points
|
||||
- Uses deep sleep between cycles (`SENDER_WAKE_INTERVAL_SEC`).
|
||||
- Sender CPU is throttled to 80 MHz and LoRa RX is only enabled in short windows (ACK wait or time-sync).
|
||||
- Battery sampling averages 5 ADC reads and updates at most once per `BATTERY_SAMPLE_INTERVAL_MS` (default 60s).
|
||||
- `BATTERY_CAL` applies a scale factor to match measured VBAT.
|
||||
- When `SERIAL_DEBUG_MODE` is enabled, each ADC read logs the 5 raw samples, average, and computed voltage.
|
||||
|
||||
## Web UI
|
||||
- AP SSID: `DD3-Bridge-<short_id>` (prefix configurable)
|
||||
@@ -316,6 +319,7 @@ Key timing settings in `include/config.h`:
|
||||
- `METER_SAMPLE_INTERVAL_MS`
|
||||
- `METER_SEND_INTERVAL_MS`
|
||||
- `BATTERY_SAMPLE_INTERVAL_MS`
|
||||
- `BATTERY_CAL`
|
||||
- `BATCH_ACK_TIMEOUT_MS`
|
||||
- `BATCH_MAX_RETRIES`
|
||||
- `BATCH_QUEUE_DEPTH`
|
||||
@@ -333,7 +337,7 @@ Key timing settings in `include/config.h`:
|
||||
- **Compression**: MeterData uses lightweight RLE (good for JSON but not optimal).
|
||||
- **OBIS parsing**: supports IEC 62056-21 ASCII (Mode D); may need tuning for some meters.
|
||||
- **Payload size**: single JSON frames < 256 bytes (ArduinoJson static doc); binary batch frames are chunked and reassembled (typically 1 chunk).
|
||||
- **Battery ADC**: uses simple linear calibration constant in `power_manager.cpp`.
|
||||
- **Battery ADC**: uses a divider (R44/R45 = 100K/100K) with a configurable `BATTERY_CAL` scale and LiPo % curve.
|
||||
- **OLED**: no hardware reset line is used (matches working reference).
|
||||
- **Batch ACKs**: sender waits for ACK after a batch and retries up to `BATCH_MAX_RETRIES` with `BATCH_ACK_TIMEOUT_MS` between attempts.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user