In development. It changes without notice.
The Kleidos bench meter
An ESP32-S3-N16R8 on a DSX063-1 screw-terminal carrier, reading a TI INA228 current/
This repository holds everything the instrument is: its firmware (firmware/), its schematic and wiring (hardware/), its calibration procedure, records and registry (calibration/), its command set (docs/scpi.md) and a host client with a simulated instrument and a panel (host/). It left the Kleidos firmware repository on 2026-11-19, where it was the nested project qa/meter/ (docs/
To measure with it, follow the usage guide, from the command line or the panel (kleidos-meter serve); to build the rig, the wiring guide. The index lists every document, and the repository's rules holds the rules for changing this repository.
The panel, kleidos-meter serve, in a browser on the simulator: the status bar, the Live view's controls and a run's current drawn as the mean per pixel column over its faint minimum-to-maximum band
The panel's Live view on the simulated instrument; every view, in both themes and at a phone's width, is in the panel's page.
Quick start
The host client, against the simulated instrument. No hardware needed:
python3 -m venv host/.venvhost/.venv/bin/pip install -e ./host. host/.venv/bin/activate$ kleidos-meter --sim '*IDN?' 'SYST:ERR:ALL?'# the instrument rebooted (*ESR? power-on bit set)KLEIDOS,KLEIDOS-METER,KM-EE529C1B03,0.18.00,"No error"kleidos-meter serve --sim runs the panel against the same simulator and prints its address (the panel's guide).
Build (the toolchain is pinned in firmware/
platformio.ini: platformio/ espressif32 @ 8.0.0, ESP-IDF 6.1.1 as the registry's framework-espidf 4.60101.0, C++26, every warning an error; the first build installs both): source ~/.platformio/penv/bin/activatepio run --project-dir firmware -e meterThe firmware also builds and runs on the host against a simulated board, with no ESP-IDF toolchain (make -C firmware/
test/ native), and scripts/ run_ tests.sh runs every test of the repository and writes the report (docs/ testing.md). Flash, naming the CH343 port (Flash below), and check the line:
pio run --project-dir firmware -e meter -t upload # KLEIDOS_METER_PORT names the port$ kleidos-meter '*IDN?' 'SYST:ERR:ALL?' 'ROUT:STAT?'# the instrument rebooted (*ESR? power-on bit set)KLEIDOS,KLEIDOS-METER,KM-0000000000,0.17.00,"No error"k1=lead:closed k2=bypass:open k3=spare:unwired k4=spare:unwired path=shunt check=- pads=ok operate_settle_ms=20 release_settle_ms=50 hold_s=- hold_released=0 bypass_part=relay2click*IDN? names the instrument and the version, SYSTem:ERRor:ALL? answers 0,"No error" (or the bring-up's own refusal), and ROUTe:STATe? says path=shunt: every relay released, the DUT on the shunt.
Before the first number: the calibration registry. The calibration is the registry in calibration/, not the instrument's flash (the calibration guide). kleidos-meter calibration verify holds the instrument's working copy to it, and exits 0 only on applied:
$ kleidos-meter calibration verifyKM-0000000000: appliedcalibration 2026-11-20-02 (mjkdz-r100-relay2click), valid 2026-11-20 to 2027-11-20: range 0 100.116000 mΩ (u 424 ppm), range 1 100.116000 mΩ (u 424 ppm)After a full erase, or the first flash of 0.17.0 or later over an earlier image, it answers working_
copy_ lost, and kleidos-meter calibration restore writes the registry's copy back. An instrument the registry does not know yet is calibrated there: the null first, by the one procedure of the calibration guide, "The null, before every measurement session", then kleidos-meter calibrate, which walks the shunt's calibration against the 100 Ω reference and files it ("The shunt, two points"). Every session after that starts with a fresh null, the same procedure.
The wiring, with the board in your hand, is the wiring guide and the drawing hardware/
Flash
The upload must name the port. PlatformIO cannot find this board on its own: the esp32-s3-devkitc-1 JSON this project pins declares the hwid of the native USB port (0x303A/0x1001), the instrument is used on its CH343 port (1a86:55d3) with the native one unplugged, and every ESP32-S3 Kleidos board on the bench exposes that native hwid. Auto-detection would land on a Kleidos board and flash the meter's firmware onto it.
firmware/
macOS names the CH343 /dev/cu.usbmodem<serial>1, because it presents as CDC-ACM; the fleet's CH9102 boards (1a86:55d4) appear as usbserial-… instead, so the two are told apart in one listing (the carrier board's guide §7). Open the port releasing RTS before DTR, or the open itself reboots the board; the host client does (docs/scpi.md, "The line").
Upload runs at 460,800 baud and the carrier's two J3Y transistors put the chip into download mode from DTR/RTS, so BOOT + RST by hand is the fallback, not the routine. An app upload writes the bootloader, the partition table and the image and leaves the calib and pins partitions alone, so the working copy of the calibration survives it; a full erase does not, and kleidos-meter calibration restore writes it back (calibration/
The rig, as wired (rev D, since 2026-11-20)
The INA228 breakout's header lands on the carrier's left rail: VCC on terminal 1 (3.3 V, never 5 V), SDA GPIO4 on 4, SCL GPIO5 on 5, ALE GPIO6 on 6, GND on 22. The load goes through its screw terminals, VIN+ from the cell and VIN− towards the DUT, with VBUS on the source side of the shunt (CALibration:VBUSside SOURce once continuity says so). Every pin and wire, and the checks before power, are in the wiring guide.
| Part | Driven by | Left-rail terminal | Role | Released (boot, reset, a dead meter) |
|---|---|---|---|---|
| HW-316 K1, an SRD-05VDC-SL-C | IN1 ← GPIO7, active low | 7 (VCC on 21, GND on 22) | the lead: COM on VIN−, NC to the DUT's battery + | closed: the DUT is on the shunt |
| Relay 2 Click RL2, an LCA717 PhotoMOS | its control pin ← GPIO15, active high | 8 (3.3 V on 1, GND on 22) | the bypass, k2 on the wire: from VIN+ to K1 NC, around the shunt | open: no bypass |
| HW-316 K2, K3, K4 | IN2–IN4 not wired | GPIO16 and GPIO17 (9, 10) parked | spares, k3=spare:unwired k4=spare:unwired | never driven |
The HW-316 is kept for K1 alone, mechanical and closed at rest, so the DUT stays fed with the meter off and no PhotoMOS sits in series with it; its silver contacts could not close the bypass's dry circuit, which moved to the Click on 2026-11-20 (the Relay 2 Click guide, calibration/
The relays: a null without hands
The two contacts make four circuits, and every relay reply names the one in force as path=:
| path= | K1 | Bypass | The shunt carries | A capture there |
|---|---|---|---|---|
| shunt | closed | open | everything: the measuring circuit, and the boot state | measures |
| bypass | open | closed | nothing, with the DUT still running: the null | refused unless INITiate:FORCe, then q=invalid |
| both | closed | closed | a fraction | refused unless INITiate:FORCe, then q=invalid; CALibration:ZERO refused outright |
| none | open | open | nothing, and the DUT has no battery | measures the zero it draws |
- The null path. ROUTe:NULLpath ON closes the bypass first and opens K1 second, so the DUT is never without a supply, and reads the shunt before and after each step: the bypass must take current and K1 must leave the shunt dead, or the path is undone and the order refused (103, 104). check=ok needs the DUT drawing 2 mA or more; below that the order says check=unverified. ROUTe:NULLpath OFF recloses K1 before it opens the bypass. A null whose offset comes out beyond 50 µV with K1 commanded open is not stored (102). The procedure that uses it is the calibration guide, "The null, before every measurement session".
- The hold. Every path but shunt is held for at most 120 s and then put back by the instrument itself, make-before-break, with an error that says which (113 from bypass, 114 from none, 115 from both), even under a capture, where the moves are marked. A host should still run ROUTe:NULLpath OFF in a finally. A reset releases every coil at once, as every boot does, and the boot after one that keeps RTC memory says what it released (116).
- The interlocks. An order that would leave the DUT with no supply (path=none) needs FORCe; a move while a capture runs needs LIVE and is marked in it; one that would take that capture's shunt off the DUT's current needs FORCe as well; nothing moves under a running null window. ROUTe:LEAD:CYCLe <ms>,FORCe is the timed cold power cycle.
The settle waits are bounds: 20 ms after energizing K1 and 50 ms after releasing it, 10 ms each way for the Click. What the rig measured against them on 2026-11-21, every move well inside its wait, is the relay timings. Every command, reply and error detail is in the SCPI command set, "ROUTe: the relay module"; the design, the checks' thresholds and what the relays cannot do are in the firmware's architecture §6.
What the instrument measures
Current, voltage, power, energy, charge and the die's temperature, on four profiles chosen per run with SENSe:PROFile: STATE (1.152 ms a sample) and SLEEP (67.52 ms) stream for as long as you like; TRACE (280 µs) and BURST (100 µs) fill a 4 MiB ring that is read out afterwards. The usage guide says which to take, and the firmware's architecture §3.2 why they are these four and what each is worth.
Every report says with q= how far to trust it (the usage guide). At 0.100 Ω, 10 µA is 1 µV, exactly the INA228's maximum offset, so the null is the measurement and its residual, about ±0.5 µA, is the instrument's floor (the firmware's architecture §3.7).
Layout
tests/
Still open, for the bench
- Which LED pin it was: the image blanks both candidates, GPIO48 and GPIO38 (SYSTem:LED?, docs/
architecture.md §8). The real I²C address, from the boot scan.Settled on 2026-11-21: 0x40, alone, in 20 scans of 0.16.5's bench acceptance (“0.16.5 (2026-11-21)” in the changelog, 0.16.5).- The value of the three 01C resistors, and so whether 400 kHz is clean with longer wiring. On the short wiring of the rig, BURST at 1 MHz runs with read_err=0 (docs/
architecture.md §2.1). - Whether VBUS is tied internally to either side of the shunt (docs/
rig-wiring.md §1.3). - Whether CHARGE accumulates at 10 µA or truncates to zero: a known 10 µA load for 60 s should give ΔCHARGE ≈ 192 counts in range 0. No number the protocol reports depends on it, and every capture reports the accumulator at both its boundaries (docs/
architecture.md §11.1). The real shunt resistance and its tolerance.Settled on 2026-11-20: R = 100.116 mΩ ± 0.085 mΩ (k = 2), against the VPG 100 Ω reference on both ADC ranges, event 2026-11-20-02 of KM-0000000000 (the record of 2026-11-20, §4 to §7).Whether the ALE pin pulses per conversion or is level-held.Settled on 2026-11-20: it is held low from a conversion's end until DIAG_ALRT is read, in either ALATCH mode; from 0.9.0 STATE and SLEEP pace on it and report pace= (the firmware's architecture §3.3, the bench table).- Whether DIAG_ALRT bit 0 MEMSTAT latches what is written to it. The pacing word writes a 1 back; 200 rounds of DIAGnostic:ALERt? on 2026-11-21 read memstat=1, which does not tell a latch from a read-only bit. The answer belongs beside the register table in docs/
ina228-reference.md. - Whether every relay stays released through a meter power-up and a reset, before app_main() drives the pins: the ESP32-S3 datasheet (Table 2-2) gives GPIO7 a 60 µs low glitch at power-up, far shorter than a coil needs. The first-power check of docs/
rig-wiring.md §8.5 settles it. Whether the settle times hold.Settled on 2026-11-21 and 2026-11-20: with a 100 Ω load, K1 opened in 1.96 to 2.52 ms and reclosed in 11.20 ms, and the Click's RL2 turned on in 0.56 to 1.12 ms and off in 0.56 to 0.84 ms, every move inside its wait (the relay timings); and the hand null came out 0.057 µV from the relay null, inside the 0.1 µV criterion (the record of 2026-11-20, §2).- Whether terminal 21 holds 5 V under K1's coil, measured loaded (docs/
rig-wiring.md §8.5 step 1). Unloaded it read 4.9 V on 2026-10-30 with IN-OUT bridged (docs/ carrier-board.md §6), and K1 opened and reclosed on every measured move of the 2026-11-21 timing runs; the loaded reading is not on record. - Whether the INA228's input bias current matters at microamp levels. The two-point procedure that would have shown it (two loads three decades apart) was superseded on 2026-11-20 by the calibration on both ranges at one current, which cannot; a known 10 µA load read against the calibrated shunt would.