In development. It changes without notice.
Calibration
The registry in this directory is the calibration. What the instrument keeps in its flash is a working copy of it. A full flash erase (esptool erase_flash) loses that copy, so nothing that must survive can live there alone: the measured shunt of each range, its uncertainty, the date and the history are kept here, versioned with the repository, and the Kleidos QA harness reads them from here at a pinned commit, never from the instrument (owner, 2026-11-20). The instrument answers two questions: which instrument it is (*IDN? field 3, its serial) and which working copy it holds (CALibration:DATA?).
What the instrument still keeps, in its flash: the shunt resistance of each range (SENSe:CURRent:SHUNt, SENSe:CURRent:SHUNt:RANGe<n>), the calibration tag and date (CALibration:TAG, CALibration:DATE), where VBUS is sensed (CALibration:VBUSside), and the offset null of each range (CALibration:ZERO). The first three are the working copy, written by kleidos-meter calibration restore from the registry; the null is session state and is never restored. From FW-16 (0.17.0) the copy is a record of the calibration record log in the calib partition at 0x9000 (docs/
The registry
Identity. An instrument is named by its serial, KM- and ten hex digits: the first five bytes of SHA-256("kleidos-meter-serial-v1" ‖ MAC) over the ESP32-S3's factory eFuse MAC (firmware/
The alias. The instrument still reports its own serial, so a host maps it to the one it is filed under, from what git ignores alone: KLEIDOS_
calibration verify and restore, the panel's calibration view and calibrate look the instrument up, print it and, for calibrate, file its event, record and raw log under the filed serial; the log's *IDN? answers are filed with the reported serial replaced by it. A verdict found through an alias says so on its second line (aliased in --json and in the panel's answer). An alias in a tracked file would publish the serial, since a digest of a MAC is undone by a search: a hash of it is no better, and the guard above fails the reported serial wherever it lands. The Kleidos QA harness reads the same variable from the environment or from its own files that git ignores (qa/
Configurations. A configuration (configurations/<id>.json) is the bill of what sets the measurement: the ADC and the INA228 ids it reports, the breakout, the shunt (its nominal, its stated tolerance or null, the window past which a reading is the wiring), the Kelvin wiring and the schematic revision, the relays and their pins, the controller, the firmware image, and what is expected of a calibration (the ADC gain error, the largest acceptable range split, the recalibration interval). The instrument cannot report its configuration (its flash is what an erase loses; the image knows only what it drives), so the instrument file says which configuration an instrument is in, and what the instrument does report (image=, bypass_part=, mfg=, die=) is checked against it. An image that was renamed keeps its rig: firmware.image_
Instruments and events. instruments/<serial>.json is an append-only list of events: nominal_
Which calibration holds on a date: the newest accepted one taken on or before it, after the last voiding hardware change, and not older than its configuration's recalibration_
The check (python3 scripts/
Someone with another INA228 board adds a configuration describing their breakout, shunt and relays, calibrates with kleidos-meter calibrate --configuration <their id> and their own reference, runs the check, and sends the files in one pull request. If their breakout and shunt ids match an existing sense core, the check compares their instrument with ours from then on. The firmware and the QA harness still assume a 0.100 Ω shunt (calmath.h kNominalShuntNanoOhm and its ±2 % window, SENSe:CURRent:SHUNt 0.05..0.2 Ω, the harness's BENCH_
The working copy
verify reads *IDN?, SYSTem:INFormation? and CALibration:DATA? and answers one status: applied (the working copy is the registry's), working_
What a verdict asks of you
kleidos-meter calibration verify exits 0 on applied and 3 on every other verdict, and its lines below the first say what differs (-) and what to see to (!, from 30 days before the calibration ends). The Kleidos QA harness judges the same instrument against the registry at the commit it pins (qa/
| Verdict | Means | Do |
|---|---|---|
| applied | the instrument holds the registry's working copy, and the calibration holds today | measure |
| working_ | the instrument is at its defaults (shunt_ | kleidos-meter calibration restore |
| working_ | a shunt, a tag, a date or the VBUS side is not the registry's: a value typed by hand, a session not filed | kleidos-meter calibration restore. A calibration that was taken and not filed is not a working copy: run kleidos-meter calibrate and file it |
| expired | the newest calibration ended (recalibration_ | calibrate again (below); restore refuses it |
| configuration_ | the image, the bypass part or the INA228 is not the configuration the registry files the instrument under | flash the image the configuration names, or, when the rig changed, file the hardware_ |
| unregistered | no serial (firmware before 0.4.0), or a serial the registry does not know. The Kleidos harness measures on the first, and nothing it measures is quotable; the second is its uncalibrated, and stops the row | for no serial, flash a current image; for an instrument the registry files under a placeholder, its alias (The registry, "The alias"); for a new instrument, its first calibration names its configuration (kleidos-meter calibrate --configuration <id>) |
| uncalibrated (the Kleidos harness) | a serial the registry does not know, or holds no calibration for on the day: kleidos-meter says unregistered for the first | calibrate it |
| registry_ | no meter checkout at KLEIDOS_ | clone or fetch this repository there. KLEIDOS_ |
On the simulator, whose serial no registry knows and no alias maps:
The null, before every measurement session
A null is taken with no current crossing the shunt and on the range it will serve; each range keeps its own. The null drifts within a session (2026-11-20: 1.9 → 4.6 µV over about two hours, thermal EMF in the sense loop), so a null belongs to its session: take one before every session, and the QA harness brackets every capture with its own.
- Through the relays (no hands): ROUTe:NULLpath ON (expect check=ok with the DUT drawing 2 mA or more), CALibration:ZERO 60, wait the 60 s, ABORt, CALibration:ZERO:RESult? (stored=1), ROUTe:NULLpath OFF. Validated against the hand null on 2026-11-20 (records/
2026-11-20.md §2). - Through the lead relay alone, while the bypass cannot close: cut the DUT's other supplies, ROUTe:LEAD OPEN,FORCe (path=none), CALibration:ZERO 60, wait, ABORt, ROUTe:LEAD CLOSe. The Kleidos QA harness does this itself (power_
campaign.py td08 --nulls lead). - By hand: open the DUT's battery lead, CALibration:ZERO 60, wait, ABORt, refit the lead.
ABORt ends the window early: wait out its seconds first. A null closed with K1 commanded open that reads beyond 50 µV is refused (error 102): the lead did not open, and storing it would subtract the DUT's own current from every later reading.
The shunt, two points
The R100 part is marked only with its value; until a calibration is filed, every figure carries its 1 % marking as the gain term. The reference is the VPG Y0785100R000T9L, 100 Ω ±0.01 % foil resistor (S102C: TCR ±2 ppm/°C, load life ±0.005 %, hardware/
R_shunt = V_shunt × R_ref / V_ref
and neither the cell's voltage nor its drift enters (firmware/
Run it guided: kleidos-meter calibrate --port "$KLEIDOS_
The bench, step by step (the lessons of 2026-11-20 are in it):
- Everything off. Unplug pigtail 3 from the DUT's battery socket and cut the DUT's hub port.
- Fit the reference between pigtail 3 (the DUT + node, after K1's NC) and the INA228's GND screw, its ground lead in that same screw: the 41 mA return then shares no wire with the sense ground. Its top lead goes to pigtail 3.
- Move the cell and VBUS. On this rig the cell's + feeds the VBUS screw, and a VBUS–VIN+ jumper carries it to VIN+. For the calibration, move the cell's + to VIN+ and the VBUS wire to the reference's top lead itself: on the resistor's own lead, not on VIN−, so that K1's contact and the pigtail (about 0.15 Ω) are not in the reading, and so that VBUS senses the reference and nothing else.
- Screw every joint. Both reference joints go into screw terminals: never twisted, never clipped. On 2026-11-20 twisted and clipped joints read 100.04 mΩ, then drifted to 100.21 mΩ within 40 minutes, a contact of about 0.17 Ω in the reference's VBUS path; screwed, 20 points over five minutes showed no trend.
- The opening nulls, hands-free: SENSe:PROFile SLEep, then on each range (SENSe:CURRent:RANGe:INDex 0, then 1) ROUTe:LEAD OPEN,FORCe, CALibration:ZERO 60, wait, ABORt, CALibration:ZERO:RESult? (stored=1), ROUTe:LEAD CLOSe. With K1 open no current crosses the reference or the shunt.
- The points, on the SLEEP profile (4120 µs conversions, 16 averages): CALibration:SHUNt:REFerence 100.0 (the value on the part's certificate if it has one), SAMPle:COUNt 600, then four points per block, CALibration:SHUNt and CALibration:SHUNt:RESult? → range= r_nohm= r_uohm= dev_ppm= i_na= vsh_nv= vref_uv= ref_uohm= n= die_mc= check=, in blocks in the order range 0, range 1, range 1, range 0. The mirrored order takes a steady drift out of the range split, which taking one range after the other does not (records/
2026-11-20.md §5). - The closing nulls, as in step 5.
- Judge (the gates below), then, if they hold: SENSe:CURRent:SHUNt <ohms> with the mean of the two range means rounded to the micro-ohm, CALibration:TAG "R100_<yyyymmdd>", CALibration:DATE <yyyy>,<m>,<d>.
- Restore the bench: the VBUS wire back to its screw, the cell's + back to the VBUS screw, the reference out, pigtail 3 back into the DUT; CALibration:VBUSside SOURce.
After it is filed: the QA harness pins it
A new calibration reaches the measurements only when the Kleidos QA harness pins the registry commit that holds it. The harness reads the index at that commit, never this checkout's working tree and never the instrument.
- Commit the event's files here (the instrument file, the record and its log, index.json), with python3 scripts/
check_ calibration_ registry.py passing, and have the commit merged into main and pushed: the pin takes origin/main and nothing else. In the Kleidos firmware repository, from qa/ with its virtual environment active, move the pin. It fetches the meter checkout it reads (KLEIDOS_
METER_ REPO, or the sibling ../meter), writes the Kleidos firmware repository's qa/ meter-registry.lock.json with the new commit and the index's SHA-256, and prints each calibration that came, went or changed: that list is the review of the new calibration. On 2026-11-24, with nothing new filed: $ python3 -m qa_lib.power meter-lockmeter-registry.lock.json: kleidos-dev/meter at 094d662ad3f3b95478d302b39ae1a6724198cdb5no calibration changed- Commit the moved lock file there (the Kleidos firmware repository's qa/
meter-registry.lock.json), with the lines it printed in the commit's body, by that repository's rules. - kleidos-meter calibration restore (or the harness's own preflight, which names the command) writes the new working copy to the instrument, and calibration verify answers applied.
Acceptance gates
| Gate | Value | Why |
|---|---|---|
| The instrument's own verdict on each point | check=ok | no_samples, reversed, reference_low (VBUS not on the reference: under 1 V), signal_low (under 1 mV across the shunt) or out_of_window are each a wiring fault, named. |
| Each point from nominal | inside the configuration's window: the shunt's stated tolerance, or ±2 % when it states none | anything further is the wiring, not the part. |
| First and last block of each range | within 200 ppm | the bench did not move. A joint drifting as the twisted ones did (about 40 ppm a minute) is 600 ppm apart by then; the old two-take repeat inside two minutes let it through. |
| Each range's closing null against its opening one | within 0.5 µV | the null still stands; the difference is the budget's null term. |
| The two ranges' means | within the configuration's range_ | the INA228's shunt and bus gain errors are ±0.05 % each at most (TI SBOSA20 §6.5), so one range's ratio can be 0.1 % from the truth; more than that between ranges is not one shunt. |
| Die temperature at each point against its range's opening null | within ±5 °C | the null's own staleness window (calibration.h kStaleDieMilliCelsius). |
The uncertainty budget
Each term is a limit and a distribution; its standard uncertainty is the limit over √3 for a rectangular limit and the figure itself for a normal or measured one (GUM 4.3.7), and u_c is their root sum of squares, U = 2 u_c:
| Term | Limit | Distribution |
|---|---|---|
| reference tolerance | the part's, ±100 ppm | rectangular |
| reference TCR | its TCR over a ±20 °C bound on its temperature (the bench plus 0.16 W of self-heating) | rectangular |
| INA228 bus gain | the configuration's adc_ | rectangular |
| range split | half the split between the range means | normal |
| null drift | the larger null closure over the signal across the shunt | rectangular |
| repeatability | the scatter between blocks of one range, with fresh nulls around them | measured |
One value is applied to both ranges, with half the split as a term of its own, until a calibration shows the split is a stable property of the instrument; then each range may apply its own mean (SENSe:CURRent:SHUNt:RANGe1), and the registry and the QA harness need no change. The calibration's u, not the marking's 1 %, becomes the gain term of every figure the QA harness files, entered as a standard uncertainty.
VBUS
After the continuity check of docs/
Records
records/ holds the record of each event: what CALibration:DATA? said before and after, how each number was taken, and the raw SCPI exchange beside it. A record is never edited after it is filed (its hash is in the instrument file), but for the placeholder above; a correction is a new record and a new event. The records before the registry (2026-11-19.md, 2026-11-20.md) are dated files; the guided calibration files under records/<serial>/<event>.md. Two records characterize the instrument rather than calibrate it, and are filed under no event: radio-ab-2026-11-21.md, the NW-00 radio A/B, which failed and made the meter serial-only, and radio-tx-sweep-2026-11-21.md, its addendum, the same worst case at five transmit powers.