diff --git a/README.md b/README.md index 61a61d232..e3e9e0b33 100644 --- a/README.md +++ b/README.md @@ -163,6 +163,11 @@ Repeater navíc: ### Napájení, hodiny, GPS +Každá úspora proti upstreamu s naměřeným proudem a vlivem na příjem je v jedné +tabulce: [docs/power.md](docs/power.md#summary-every-option-against-stock-firmware). +Změřeno proti upstreamu na stejné desce (XIAO, 3,3 V): náš repeater **6,87 mA**, upstream +v1.19.0, jak ho dostanete, **10,13 mA** (−32 %; [protokol](docs/measurements/2026-12-04-stock-vs-tth/protocol.md)). + * GPS duty cycle (`gps duty`), i na T1000-E, kde nebyl: přijímač běží jen kolem synchronizace hodin (jednou denně, po neúspěšném okně znovu za 6 h). Dotaz na polohu přijímač probudí pro příští dotaz. @@ -174,9 +179,10 @@ Repeater navíc: nepojme a příkaz na to upozorní). * Volitelný RX duty cycle (`set radio.rxps `, jemněji `set radio.rxps level ` 1–10; port PowerSaving z EasySkyMesh): SX1262 mezi krátkými okny - poslechu spí. Ve veřejných buildech je zabudovaný a **vypnutý**; `max` na - lavici ušetřil ~2,3 mA bez ztráty paketů ([docs/power.md](docs/power.md)), - na ostrém meshi ale jeden náš stožár ztratil 16 % příjmu – zapínat s rozmyslem. Jen + poslechu spí. Ve veřejných buildech je zabudovaný a **vypnutý**; ušetří ~2 mA, + ale **ztrácí slabé pakety**: při SNR pod nulou 13–28 % příjmu (lavice 4. 12. 2026, + [docs/power.md](docs/power.md)), náš stožár na ostrém meshi 16 %. Jen pro uzly se + silným signálem, na stožár ne. Jen SX1262, ne LR1110 (T1000-E). * Opravy RX duty cycle: `set radio.rxps off` přepne rádio zpět okamžitě i ve stavu, kdy se dřív zaseklo, a příjem po kalibraci šumu se znovu nastartuje – @@ -531,6 +537,11 @@ The repeater also has: ### Power, clock, GPS +Every saving against upstream, with the measured current and its effect on +reception, is in one table: [docs/power.md](docs/power.md#summary-every-option-against-stock-firmware). +Measured against upstream on the same board (XIAO, 3.3 V): our repeater **6.87 mA**, upstream +v1.19.0 as shipped **10.13 mA** (−32 %; [protocol](docs/measurements/2026-12-04-stock-vs-tth/protocol.md)). + * GPS duty cycle (`gps duty`), also on the T1000-E, which had none: the receiver runs only around a clock sync (once a day, after a window without a fix again in 6 h). A position request warms it for the next request. @@ -543,9 +554,10 @@ The repeater also has: * Optional RX duty cycle (`set radio.rxps `, finer `set radio.rxps level ` 1-10; ported from EasySkyMesh PowerSaving): the SX1262 sleeps between short listening windows. Built into the public releases and - **off**; `max` saved ~2.3 mA on the bench with no packet loss - ([docs/power.md](docs/power.md)), but on the live mesh one of our masts lost - 16 % of its reception -- switch it on with care. SX1262 only, not the LR1110 + **off**; it saves ~2 mA but **loses + weak packets**: 13-28 % of reception below 0 dB SNR (bench, 4. 12. 2026, + [docs/power.md](docs/power.md)), 16 % on one of our masts on the live mesh. + Only for nodes with a strong signal, not for a mast. SX1262 only, not the LR1110 (T1000-E). * RX duty cycle fixes: `set radio.rxps off` takes effect at once even in the state that used to stall, and reception is re-armed after the noise-floor diff --git a/docs/measurements/2026-12-04-stock-vs-tth/calibration.tsv.gz b/docs/measurements/2026-12-04-stock-vs-tth/calibration.tsv.gz new file mode 100644 index 000000000..81bef05e6 Binary files /dev/null and b/docs/measurements/2026-12-04-stock-vs-tth/calibration.tsv.gz differ diff --git a/docs/measurements/2026-12-04-stock-vs-tth/compute.py b/docs/measurements/2026-12-04-stock-vs-tth/compute.py new file mode 100644 index 000000000..986015345 --- /dev/null +++ b/docs/measurements/2026-12-04-stock-vs-tth/compute.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +"""Recompute the stock-vs-tth current measurement of 4. 12. 2026 from ina_fast.tsv.gz. + + python3 compute.py # prints the tables of protocol.md + +Every number in protocol.md comes out of this script; nothing is typed in by hand. +Model per meter: I = sum(isum_raw) * 2.5 uV / (sum(n) * R_shunt) - I0 + I0 = zero (DUT disconnected, same bus voltage ~3.27 V), mean of the two zero windows +Uncertainty (GUM): type A = SEM of 1-minute block means; repeatability = |A1 - A2| / sqrt(2) +(applied to every cell); type B = shunt tolerance 1 % and INA226 gain error 0.1 % +(rectangular, /sqrt(3), proportional to the current), residual offset = half the difference +of the two zeros (rectangular). Expanded U = 2 u_c (k = 2, ~95 %). +""" + +import gzip +import math +import statistics +from pathlib import Path + +LSB_UV = 2.5 +SHUNT_TOL = 0.01 # assumed: LaskaKit module, tolerance not stated -- 1 % is the usual part +GAIN_ERR = 0.001 # INA226 datasheet, gain error max 0.1 % +SETTLE = 120 # s dropped after power-on +CELL = 600 # s measured after that + +ZEROS = {"Z1": (1796389154 - 480, 1796389154 - 10), "Z2": (1796393425, 1796393633)} +CELLS = { # power-on (first window with current) of each cell + "A1": 1796389154, # tth public image, powersaving on + "S2": 1796390528, # stock v1.19.0, powersaving on + "S1": 1796391376, # stock v1.19.0, powersaving off (upstream default) + "A2": 1796392588, # tth again + "C": 1796397122, # MeshCore Czech v1.19.0.01, powersaving on, rxps off (same settings as A) + # MeshCore Czech with its fresh-install default rxps balanced, powersaving on: running since + # 16:29:41, the capture was restarted at 16:42:55 -> measured window starts there + "C2": 1796398975 - 120, +} +METERS = ("cb-fbfe18", "cb-4faa24") + +rows = [] +with gzip.open(Path(__file__).with_name("ina_fast.tsv.gz"), "rt") as f: + for ln in f: + if ln.startswith("#"): + continue + ts, meter, n, isum, sh, v = ln.split("\t") + rows.append((float(ts), meter, int(n), int(isum), int(sh), float(v))) + + +def window(meter, t0, t1): + return [r for r in rows if r[1] == meter and t0 <= r[0] <= t1] + + +def current(sel): + return sum(r[3] for r in sel) * LSB_UV / (sum(r[2] for r in sel) * sel[0][4]) # mA + + +def block_sem(sel): + blocks = {} + for r in sel: + blocks.setdefault(int(r[0] // 60), []).append(r) + means = [current(b) for b in blocks.values() if len(b) > 20] + return statistics.stdev(means) / math.sqrt(len(means)), len(means) + + +res = {} +for m in METERS: + z = {k: current(window(m, *t)) for k, t in ZEROS.items()} + i0 = (z["Z1"] + z["Z2"]) / 2 + u_off = abs(z["Z1"] - z["Z2"]) / 2 / math.sqrt(3) + cells = {} + for c, t in CELLS.items(): + sel = window(m, t + SETTLE, t + SETTLE + CELL) + sem, nb = block_sem(sel) + cells[c] = {"I": current(sel) - i0, "semA": sem, "blocks": nb, "V": statistics.mean(r[5] for r in sel), + "samples": sum(r[2] for r in sel)} + u_rep = abs(cells["A1"]["I"] - cells["A2"]["I"]) / math.sqrt(2) + for c in cells.values(): + u_b = c["I"] * math.hypot(SHUNT_TOL, GAIN_ERR) / math.sqrt(3) + c["u"] = math.sqrt(c["semA"] ** 2 + u_rep**2 + u_b**2 + u_off**2) + c["U"] = 2 * c["u"] + c["u_rel_dev"] = math.sqrt(c["semA"] ** 2 + u_rep**2) # what does not scale with the meter's gain + res[m] = {"z": z, "i0": i0, "u_off": u_off, "u_rep": u_rep, "cells": cells} + +print("## Zero (DUT disconnected)\n\n| meter | Z1 | Z2 | I0 used | residual offset u |\n|---|---|---|---|---|") +for m, r in res.items(): + print(f"| {m} | {r['z']['Z1']:+.4f} mA | {r['z']['Z2']:+.4f} mA | {r['i0']:+.4f} mA | {r['u_off']:.4f} mA |") + +print("\n## Cells\n\n| cell | meter | bus V | samples | 1-min blocks | I | u_A (SEM) | u_c | U (k=2) |\n|---|---|---|---|---|---|---|---|---|") +for c in CELLS: + for m in METERS: + x = res[m]["cells"][c] + print(f"| {c} | {m} | {x['V']:.3f} | {x['samples']} | {x['blocks']} | {x['I']:.3f} mA | {x['semA']:.4f} | {x['u']:.3f} | ±{x['U']:.3f} mA |") + +print("\n## Repeatability A1 vs A2\n") +for m in METERS: + print(f"- {m}: |A1 - A2| = {abs(res[m]['cells']['A1']['I'] - res[m]['cells']['A2']['I']) * 1000:.1f} uA, u_rep = {res[m]['u_rep'] * 1000:.1f} uA") + +print("\n## Agreement of the two meters (E_n = |I1 - I2| / sqrt(U1^2 + U2^2), <= 1 agrees)\n") +print("| cell | cb-fbfe18 | cb-4faa24 | difference | E_n |\n|---|---|---|---|---|") +for c in CELLS: + a, b = (res[m]["cells"][c] for m in METERS) + print(f"| {c} | {a['I']:.3f} | {b['I']:.3f} | {abs(a['I'] - b['I']):.3f} mA | {abs(a['I'] - b['I']) / math.hypot(a['U'], b['U']):.2f} |") + +print("\n## Result (mean of both meters; differences against A = mean of A1 and A2)\n") +print("| configuration | I | U (k=2) | vs tth | relative |\n|---|---|---|---|---|") +comb = {} +for c in CELLS: + xs = [res[m]["cells"][c] for m in METERS] + comb[c] = (statistics.mean(x["I"] for x in xs), max(x["U"] for x in xs), xs) +A = (comb["A1"][0] + comb["A2"][0]) / 2 +for c, label in (("A1", "tth release, powersaving on"), ("A2", "tth release, again"), + ("S2", "stock v1.19.0 + powersaving on"), ("S1", "stock v1.19.0 as shipped (powersaving off)"), + ("C", "MeshCore Czech v1.19.0.01, powersaving on, rxps off"), + ("C2", "MeshCore Czech, its default rxps balanced, powersaving on")): + i, U, xs = comb[c] + d = i - A + # a difference: offsets cancel, the gain errors act on |d| only; deviations from repeatability stay + u_d = math.sqrt(sum(x["u_rel_dev"] ** 2 for x in xs) / len(xs) * 2 + (abs(d) * math.hypot(SHUNT_TOL, GAIN_ERR) / math.sqrt(3)) ** 2) + rel = f"{100 * d / i:+.1f} % of this" if c[0] in "SC" else "" + print(f"| {label} | {i:.3f} mA | ±{U:.3f} | {d:+.3f} ± {2 * u_d:.3f} mA | {rel} |") diff --git a/docs/measurements/2026-12-04-stock-vs-tth/ina_fast.tsv.gz b/docs/measurements/2026-12-04-stock-vs-tth/ina_fast.tsv.gz new file mode 100644 index 000000000..1c254dcfb Binary files /dev/null and b/docs/measurements/2026-12-04-stock-vs-tth/ina_fast.tsv.gz differ diff --git a/docs/measurements/2026-12-04-stock-vs-tth/protocol.md b/docs/measurements/2026-12-04-stock-vs-tth/protocol.md new file mode 100644 index 000000000..cef4b453f --- /dev/null +++ b/docs/measurements/2026-12-04-stock-vs-tth/protocol.md @@ -0,0 +1,160 @@ +# Measurement protocol: supply current, stock MeshCore vs. this fork + +| | | +|---|---| +| date | 4. 12. 2026, 13:51–15:14 CET | +| object | XIAO nRF52840 + Wio-SX1262 (bench board x4), repeater firmware | +| question | how much current does this fork's public repeater image draw against upstream's, on the same board and settings | +| data | `ina_fast.tsv.gz` (every 1 s window of both meters), `compute.py` (all numbers below), `result.md` (its output) | + +## 1. Setup + +``` +budka 3V3 ─► INA226 #1 (cb-fbfe18) ─► INA226 #2 (cb-4faa24) ─► 3V3 pin of x4 + GND ── GND +``` + +- x4 is fed **only** on its 3V3 pin at ~3.26 V. No USB during a cell (USB keeps + HFCLK and USBD up and powers the board through VBUS), no battery, nothing on + its I2C bus (the BMP388 and x4's own INA226 were removed: a sensor driver that + configures them differently would show up as a "firmware difference"). +- Antenna on. 866.5 MHz / 62.5 kHz / SF7 / CR5 (bench frequency, CZ mesh + modulation), TX −9 dBm, `repeat off`, both advert intervals 0, `radio.rxgain on`. + No other bench traffic during the cells (x1 and x3 silent). + +## 2. Instruments + +| | | +|---|---| +| meter | 2× INA226 on LaskaKit modules, shunt 10 mΩ (tolerance not stated, **assumed ±1 %**), shunt LSB 2.5 µV = 0.25 mA | +| readout | chytra-budka firmware `v0.19.20-27-gc6f031c`, `cmd/ina_fast "3500,1000"`: no averaging, 140 µs conversions, ~800 samples/s; per 1 s window the integer sum of shunt LSBs (`isum_raw`) and the sample count `n` (chytra-budka #235) | +| the two meters | independent: each is read by its own board, so they cross-check each other's gain and offset | + +## 3. Images + +| | build | `firmware.bin` sha256 (prefix) | +|---|---|---| +| **tth** | this fork, `rfa/main` 387184de (= release v1.19.0+tth.20261204.2 content), env `Xiao_nrf52_repeater`, `.github/fw-flags.sh` PUB_FLAGS + `-D LORA_FREQ=866.5 -D LORA_TX_POWER=-9` | `3e7b3fa80eacaa75` | +| **MeshCore Czech** | release `v1.19.0.01` of mesh-cz/MeshCore-Czech (binary only), `Xiao_nrf52_repeater-meshcz-v1.19.0.01-85ed.zip` | `3c1fb0bc08b8cb1b` | +| **stock** | upstream tag `repeater-v1.19.0` (a2921870), env `Xiao_nrf52_repeater`, only `-D LORA_FREQ=866.5 -D LORA_BW=62.5 -D LORA_SF=7 -D LORA_CR=5 -D LORA_TX_POWER=-9` | `85cf850ccfd369dc` | + +The frequency flags only change the defaults of a node without prefs; x4 kept +its prefs across all flashes and both images reported the same radio settings +(`get radio`, `get tx`, `get repeat`, intervals, `rxgain`) before each cell. + +## 4. Procedure + +Each image change: 3V3 off, USB on, flash (`dfu serial` / 1200 Bd touch + +`adafruit-nrfutil dfu serial`) and set, USB off, 3V3 on. Plugging the 3V3 in +is a clean power-on without USB, so every cell starts from the same kind of +boot. A cell = 120 s dropped after power-on + 600 s measured. Order: + +| cell | image | `powersaving` | +|---|---|---| +| Z1 | -- (DUT disconnected, bus at 3.27 V) | | +| A1 | tth | on (our default) | +| S2 | stock | on | +| S1 | stock | **off** (upstream's default) | +| A2 | tth | on | +| C | MeshCore Czech | on (rxps off, the same settings as A) | +| C2 | MeshCore Czech | on, rxps `balanced` (its fresh-install default, per its CLI manual) | +| Z2 | -- (DUT disconnected) | | + +A1 and A2 bracket the stock cells, so a drift of the rig shows as A1 ≠ A2. + +## 5. Evaluation + +Per meter: I = Σ`isum_raw` · 2.5 µV / (Σn · 10 mΩ) − I₀, with I₀ the mean of +Z1 and Z2. The zero is taken **at the same bus voltage as the cells**: at 0 V +on the bus the same meters read within ±0.08 mA of zero instead of ∓0.116 mA, i.e. the +INA226 offset depends on the common-mode voltage. + +Uncertainty after GUM: + +| component | type | value | +|---|---|---| +| statistics within a cell | A | SEM of the 1-minute block means (blocks, not 1 s windows: those are correlated) | +| repeatability between cells | A | \|A1 − A2\| / √2, applied to every cell | +| shunt tolerance | B | 1 % / √3 of the reading (assumed rectangular) | +| INA226 gain error | B | 0.1 % / √3 of the reading (datasheet max) | +| residual offset | B | half of \|Z1 − Z2\| / √3 | + +u_c = √(Σu²), expanded U = 2·u_c (k = 2, ~95 %). For a **difference** of two +configurations the offset cancels and the gain errors act on the difference +only, so differences are known much better than absolute values. + +## 6. Results + +Measured values (offset-corrected, `compute.py` → `result.md`): + +| cell | cb-fbfe18 | cb-4faa24 | E_n of the two | +|---|---|---|---| +| A1 tth | 6.865 mA | 6.874 mA | 0.08 | +| S2 stock + powersaving | 7.273 mA | 7.259 mA | 0.11 | +| S1 stock as shipped | 10.121 mA | 10.131 mA | 0.06 | +| A2 tth | 6.867 mA | 6.878 mA | 0.09 | +| C MeshCore Czech | 7.353 mA | 7.349 mA | 0.04 | +| C2 MeshCore Czech, rxps balanced | 5.452 mA | 5.451 mA | 0.01 | + +- zero: −0.119 / −0.116 mA (#1), +0.114 / +0.117 mA (#2) at the start / end; + drift 3–4 µA over 80 min; +- SEM within a cell: 0.2–3 µA; +- repeatability A1 → A2 after two image swaps: **2.5 µA and 3.4 µA**; +- the two meters agree within 0.009–0.014 mA (0.1–0.2 %), E_n ≤ 0.11: far inside + the assumed 1 % shunt tolerance, which therefore dominates U and is + conservative. + +**Result** (mean of the two meters, U for k = 2): + +| configuration | current | against tth | +|---|---|---| +| **tth release** (`powersaving on`, as provisioned) | **(6.87 ± 0.08) mA** | -- | +| stock v1.19.0, `powersaving on` set by hand | (7.27 ± 0.09) mA | **+(0.40 ± 0.01) mA** | +| **stock v1.19.0 as shipped** (`powersaving off`) | **(10.13 ± 0.12) mA** | **+(3.26 ± 0.04) mA** | +| MeshCore Czech v1.19.0.01, `powersaving on`, rxps off | (7.35 ± 0.09) mA | +(0.48 ± 0.01) mA | +| MeshCore Czech with its default rxps `balanced` | (5.45 ± 0.17) mA | −(1.42 ± 0.23) mA | + +## 6a. Independent check of the meters' gain + +The agreement of the two INA226 says nothing about a gain error both share +(shunts from one batch). So x4 was replaced by a 680 Ohm resistor (15:34-15:56, +`calibration.tsv.gz`) and the shunt current compared with I = U / R: U from the +INA226 bus channel at the resistor (3.260 V, gain error <= 0.1 %, checked with +the multimeter: 3.26 V), R with a Mastech M-830B (3 1/2 digits; 2000 Ohm range ++-(0.8 % + 2 d), leads 0.4-0.9 Ohm). + +| | cb-fbfe18 | cb-4faa24 | +|---|---|---| +| shunt current, zero taken with the resistor unplugged | 4.868 mA | 4.884 mA | +| U / R with R = 688 Ohm (first reading) | 4.738 mA (+2.7 %) | (+3.1 %) | +| U / R with R = 676.5 Ohm (second reading, minus leads) | 4.819 mA (**+1.0 %**) | (**+1.3 %**) | + +The two readings of the same resistor differ by 1.6 %: the multimeter's +repeatability, not the meters', limits this check. With the second, careful +reading the INA226 agree with the reference within its uncertainty (~+-1.5 %), +so **no correction is applied** and the assumed +-1 % shunt tolerance stands, +now checked independently. A better absolute figure needs a 4 1/2-digit meter +or a 0.1 % resistor. Differences between configurations are not affected (a +gain error scales them by the same 1 %). + +## 7. Conclusion + +On the same board and settings the fork's repeater draws **32 % less** than +upstream's image as shipped: (6.87 ± 0.08) mA against (10.13 ± 0.12) mA. Most +of it is `powersaving` (upstream ships it off): 2.86 mA. The code changes of the +fork save the remaining (0.40 ± 0.01) mA against stock with `powersaving` on. + +The CC310 sleep insomnia (+3.3 mA, `docs/power.md`) does **not** show in the +stock image: stock with `powersaving on` sits at 7.27 mA, not ~10.5. That +insomnia was measured on our own builds with BLE; it is not an upstream +regression that the fork fixes for this board. + +MeshCore Czech with the same settings draws about what stock does (+0.08 mA); its +lower figure with its own defaults is the RX duty cycle, which on a weak link +loses 13-28 % of the packets (bench, same day, #46). C and C2 came an hour after +A2 and are not bracketed by an A cell; at a repeatability of 3 µA that does not +matter against the 0.5-1.4 mA differences. C2's capture was restarted mid-cell +(16:42:55), its window starts there, the image had run since 16:29:41. + +Not covered: other boards (absolute numbers are this XIAO's), BLE builds +(`*-observer`), GPS, the radio's TX share (no traffic in the cells). diff --git a/docs/measurements/2026-12-04-stock-vs-tth/result.md b/docs/measurements/2026-12-04-stock-vs-tth/result.md new file mode 100644 index 000000000..7fef05cf1 --- /dev/null +++ b/docs/measurements/2026-12-04-stock-vs-tth/result.md @@ -0,0 +1,50 @@ +## Zero (DUT disconnected) + +| meter | Z1 | Z2 | I0 used | residual offset u | +|---|---|---|---|---| +| cb-fbfe18 | -0.1190 mA | -0.1158 mA | -0.1174 mA | 0.0009 mA | +| cb-4faa24 | +0.1137 mA | +0.1174 mA | +0.1156 mA | 0.0011 mA | + +## Cells + +| cell | meter | bus V | samples | 1-min blocks | I | u_A (SEM) | u_c | U (k=2) | +|---|---|---|---|---|---|---|---|---| +| A1 | cb-fbfe18 | 3.261 | 476578 | 10 | 6.865 mA | 0.0004 | 0.040 | ±0.080 mA | +| A1 | cb-4faa24 | 3.256 | 448672 | 10 | 6.874 mA | 0.0003 | 0.040 | ±0.080 mA | +| S2 | cb-fbfe18 | 3.259 | 478962 | 10 | 7.273 mA | 0.0030 | 0.042 | ±0.085 mA | +| S2 | cb-4faa24 | 3.255 | 453442 | 10 | 7.259 mA | 0.0015 | 0.042 | ±0.084 mA | +| S1 | cb-fbfe18 | 3.250 | 477325 | 10 | 10.121 mA | 0.0003 | 0.059 | ±0.118 mA | +| S1 | cb-4faa24 | 3.244 | 452826 | 10 | 10.131 mA | 0.0004 | 0.059 | ±0.118 mA | +| A2 | cb-fbfe18 | 3.259 | 467584 | 11 | 6.867 mA | 0.0002 | 0.040 | ±0.080 mA | +| A2 | cb-4faa24 | 3.254 | 446689 | 11 | 6.878 mA | 0.0006 | 0.040 | ±0.080 mA | +| C | cb-fbfe18 | 3.258 | 475598 | 10 | 7.353 mA | 0.0007 | 0.043 | ±0.085 mA | +| C | cb-4faa24 | 3.252 | 453178 | 10 | 7.349 mA | 0.0008 | 0.043 | ±0.085 mA | +| C2 | cb-fbfe18 | 3.264 | 475480 | 10 | 5.452 mA | 0.0807 | 0.087 | ±0.173 mA | +| C2 | cb-4faa24 | 3.261 | 447372 | 10 | 5.451 mA | 0.0806 | 0.087 | ±0.173 mA | + +## Repeatability A1 vs A2 + +- cb-fbfe18: |A1 - A2| = 2.5 uA, u_rep = 1.8 uA +- cb-4faa24: |A1 - A2| = 3.4 uA, u_rep = 2.4 uA + +## Agreement of the two meters (E_n = |I1 - I2| / sqrt(U1^2 + U2^2), <= 1 agrees) + +| cell | cb-fbfe18 | cb-4faa24 | difference | E_n | +|---|---|---|---|---| +| A1 | 6.865 | 6.874 | 0.009 mA | 0.08 | +| S2 | 7.273 | 7.259 | 0.014 mA | 0.11 | +| S1 | 10.121 | 10.131 | 0.009 mA | 0.06 | +| A2 | 6.867 | 6.878 | 0.010 mA | 0.09 | +| C | 7.353 | 7.349 | 0.005 mA | 0.04 | +| C2 | 5.452 | 5.451 | 0.002 mA | 0.01 | + +## Result (mean of both meters; differences against A = mean of A1 and A2) + +| configuration | I | U (k=2) | vs tth | relative | +|---|---|---|---|---| +| tth release, powersaving on | 6.869 mA | ±0.080 | -0.001 ± 0.006 mA | | +| tth release, again | 6.872 mA | ±0.080 | +0.001 ± 0.006 mA | | +| stock v1.19.0 + powersaving on | 7.266 mA | ±0.085 | +0.395 ± 0.010 mA | +5.4 % of this | +| stock v1.19.0 as shipped (powersaving off) | 10.126 mA | ±0.118 | +3.255 ± 0.038 mA | +32.1 % of this | +| MeshCore Czech v1.19.0.01, powersaving on, rxps off | 7.351 mA | ±0.085 | +0.480 ± 0.008 mA | +6.5 % of this | +| MeshCore Czech, its default rxps balanced, powersaving on | 5.452 mA | ±0.173 | -1.419 ± 0.229 mA | -26.0 % of this | diff --git a/docs/power.md b/docs/power.md index 37f2218e3..1a5383957 100644 --- a/docs/power.md +++ b/docs/power.md @@ -1,25 +1,63 @@ # Power saving on a solar repeater — what it costs, measured -Everything here was measured on the deployment hardware (SenseCAP Solar Node -P1-Pro, nRF52840 + SX1262 + L76K) on 2026-08-05/06 with `tools/power_ab.py`, not -taken from a datasheet. Numbers are input current on the 5 V USB side; the delta -between two states is what the paired design measures, and that is what these -figures are. +Every number on this page was measured, none is from a datasheet unless it +says so. Two rigs: a **SenseCAP Solar P1-Pro** (nRF52840 + SX1262 + L76K GPS, +the mast board) on its 5 V USB side, August 2026; and a **XIAO nRF52840 + +Wio-SX1262** fed on its 3V3 pin at 3.25 V through an INA226, no USB -- the +closer match to a node on a cell -- in November and December 2026. Each figure +is a paired A/B delta (`tools/power_ab.py`); the absolute currents belong to the +rig, the deltas carry over to other nRF52840 + SX1262 boards. -## The order that matters +## Summary: every option against stock firmware -| lever | measured | verdict | -|---|---|---| -| **GPS running continuously** | **46.0 mA** (spread 43.7-47.5) | `gps duty` recovers 42-45 of it | -| BLE advertising + Bluefruit's blinking LED | see below | defaults changed, LED off, 1 s interval | -| `powersaving on` (MCU light sleep) | **~1 mA** with USB, **2.7 mA** without (XIAO, 11/2026) | keep it on | -| CC310 IRQ cleared before sleep (nRF52) | **2.6 mA** after every boot | fixed in firmware, see below | -| RX duty cycle (`set radio.rxps`, from EasySkyMesh) | **~2.3 mA** at `max` (XIAO, 12. 11. 2026) | **no** on a live node: -16 % received and a TX stall on mast-three, see below | -| `radio.rxgain off` | ~0.7 mA | **no** — 1-3 dB of sensitivity is what a mast node is for | -| FEM LNA control | n/a | SenseCap has no FEM, only an RXEN switch | +"Stock" is upstream MeshCore with its defaults; "here" is this fork's public +release. Current is the paired delta of switching the option on (negative = +saves). Reception is what another board counted on the bench, or the live mesh +where it says so. -A whole node in the shipping configuration, with the battery charged and GPS -duty-cycled, sits at **~24 mA**. Continuous GPS alone would nearly triple that. +| option | stock | here | current | reception / transmission | details | +|---|---|---|---|---|---| +| GPS `gps duty` (receiver powered only around a daily clock sync) | continuous (`gps on`) or `gps period` | `gps duty` on mast builds | **−42 to −45 mA** of 46 (P1-Pro) | no effect on the radio | [GPS](#gps-is-the-whole-game) | +| CC310 IRQ cleared before sleep | not needed: stock (no BLE) showed no insomnia, see the whole-node measurement | always (fix of our own BLE builds) | −3.3 mA at 3.3 V, −2.6 mA at 5 V, **against our earlier builds**, not against stock | none | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| `powersaving on` (MCU sleeps between events) | off | on (provisioning) | **−2.86 mA** on stock v1.19.0 (protocol below); −2.7 mA on ours; ~−1 mA with USB attached | no loss seen (5/6 witness, one pair); DIO1 wakes the core for every packet | [MCU sleep](#mcu-sleep) | +| RX duty cycle `set radio.rxps balanced` | not in upstream | built in, **off** | **−1.8 to −2.0 mA** | strong signal (SNR +11): 0 lost of 1200; **weak signal (SNR −2..−8): 13–28 % lost** against 0/450 without rxps, any sender preamble (4. 12. 2026, #46) | [rxps](#rx-duty-cycle-rxps) | +| RX duty cycle `set radio.rxps max` | not in upstream | built in, **off** | **−2.3 to −2.5 mA** | as `balanced` or worse; **live mast-three 14. 11.: −16 % received and a TX stall** (the stall is fixed, #46) | [rxps](#rx-duty-cycle-rxps) | +| tickless main loop (with `powersaving on`) | 1024 Hz tick | always | **−0.35 mA** | packets handled at once (DIO1 notifies the loop), 3/3 witness | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| SX1262 SPI on `NRF_SPIM2` (Errata 195) | `NRF_SPIM3` | always | **−0.47 mA** | none | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| `set radio.rxgain off` | on (boosted RX gain) | on | **−0.45 to −0.51 mA** | costs sensitivity (datasheet: ~1-3 dB); bench witness saw no gross loss, a strong bench signal cannot show the sensitivity | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| adaptive `set pwr.rxgain ` / `set pwr.rxps ` | not in upstream | built in, **off** | the two rows above, only while the battery is below the threshold | as the rows above, only then | [bootlock and cutoff](#a-mast-that-runs-flat-bootlock-and-cutoff) | +| BLE: LED off while connected/advertising, slow advertising 1 s | LED on, 152.5 ms | on mast builds | not measured separately | none (BLE only) | [BLE](#ble-two-defaults-that-were-quietly-expensive) | +| DC/DC regulator | on | on (re-enabled after SoftDevice, harmless) | switching it **off costs +0.6 mA** at 3.3 V | none | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| noise-floor calibration every 10 s instead of 2 s | 2 s | 2 s | ±0.08 mA (noise) | -- | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| idle I2C (`Wire.end()`), GPIOTE channel for DIO1 | -- | -- | ±0.00 mA | -- | [nRF52 fixes](#nrf52-sleep-and-peripheral-fixes) | +| `ble off` | on | on (a mast needs the way in) | ~1 mA of ~24 on the P1-Pro | -- | [BLE](#ble-two-defaults-that-were-quietly-expensive) | + +**Whole node, measured against stock** ([protocol](measurements/2026-12-04-stock-vs-tth/protocol.md), +4. 12. 2026, XIAO on its 3V3 pin, two independent INA226 meters, the same +board and settings for both images): + +| image | current (k = 2) | +|---|---| +| this fork's public repeater (`powersaving on`, as provisioned) | **(6.87 ± 0.08) mA** | +| upstream v1.19.0 with `powersaving on` set by hand | (7.27 ± 0.09) mA, +(0.40 ± 0.01) mA | +| **upstream v1.19.0 as shipped** (`powersaving off`) | **(10.13 ± 0.12) mA**, +(3.26 ± 0.04) mA | + +The fork draws 32 % less than stock as shipped; 2.86 mA of that is +`powersaving`, the code changes save the remaining 0.40 mA. The per-option +deltas of the other rows were measured against our own builds and do not add up +to this (the CC310 one does not apply to stock at all); a re-measurement of every +row against this protocol's rig is planned. A P1-Pro in the mast configuration +(GPS duty, BLE on, charged cell) sits at **~24 mA**; continuous GPS alone would +nearly triple that. + +**rxps costs reception.** On a strong signal the bench never lost a packet to +it, which is why it looked free (12. 11.: 0/240). On a weak one it does: with x4 +receiving without antenna (RSSI −120..−126, SNR −2..−8, everyday traffic for a +mast) `balanced` lost 13–28 % against 0 of 450 without rxps, with 16- and +32-symbol senders alike, plus `recv_errors` from packets caught too late (#46, +4. 12. 2026). It explains mast-three's −16 % of 14. 11. and its lost admin replies +on 4. 12.; mast-three runs rxps **off** again since then. Use it only on a node +whose packets arrive strong (a short hop, a desk), never on a mast. ## GPS is the whole game @@ -269,7 +307,7 @@ then shows `RESETREAS=0x00020000`, bit 17, wake from LPCOMP); with a cutoff set, lowering the supply below it must switch the node off within ~3 minutes and `get pwr` after the wake must say `last off: Low Voltage`. -## nRF52 sleep & peripheral fixes +## nRF52 sleep and peripheral fixes An audit of the nRF52840 firmware and the Adafruit core found several sources of idle draw that apply to all nRF52 boards, not only SenseCAP Solar. They were