Getting Started with Flux


I started the circuit in your project and rendered the existing 3D enclosure. The complete circuit is not finished yet.
Current 3D model

DrainCheck enclosure with cover lifted

3D Model

Open the interactive 3D assembly
The enclosure retains four corner screws. The blue shapes represent estimated electronics sizes—not detailed circuit boards. Actual board mounting, wiring fit, and closure strength remain unverified; it is not print-ready.
Circuit work completed
  • Added the U1.
  • Added and wired two 10 kΩ echo-input pulldowns: R1 and R2.
  • Preserved the planned upstream D4/D5 and downstream D6/D7 interfaces.
  • Marked unfinished sensor connections HOLD.
Remaining: SEN0208 has no matching library part. Completing the drawing requires a source-backed sensor symbol—not a substitute. Manufacturer supply and interface guarantees are still needed before purchase or power-up.
Checks report three unfinished single-pin nets and one VIN power finding; the latter reflects the module symbol’s omission of built-in USB power. No custom PCB or physical testing was completed. I saved the checkpoint in the Project Specification.
Execution stopped because your ACUs ran out.

Waiting for input


Last modified 22d ago

Firmware Guide
Bench v1 · 2026-11-10 · electrical HOLD; software compiled/host-tested, not flashed or sensor-tested. UNO-alone preparation only if hardware already owned; no purchase authorized.
Downloads — source of truth
ZIP SHA256: 5837d1432b2afbf8e6a1b0376a2f66c32575a71330a9002f391ae8aa1bcb9896. No custom PCB/netlist exists; this software targets purchased modules listed in @prototype-materials-and-wiring.
Active-build safety status — 2026-11-10
No source, binaries, pins, calibration or algorithms were edited in this records-only continuation. The previously independently reproduced 4928-byte flash/293-byte static RAM, 15 assertions, sanitizer and helper results remain historical software evidence; no new build or physical test is claimed. Firmware audit against existing guide/commissioning/handoff is consistent: D4/D5 upstream, D6/D7 downstream, invalid datum/UTC, diagnosis always unknown. UNO-alone dry upload may proceed after board/cable inspection; sensors must remain disconnected, including signal leads, until the sourcing-resolvable supply/interface gate in @first-assembly-and-commissioning closes. Do not treat the common-5V contract below as supply-tolerance approval.
Hardware and firmware contract
Official Arduino UNO Rev3 A000066, PlatformIO board uno, ATmega328P, standard factory bootloader,16MHz Arduino board clock. No fuse/bootloader changes or custom flash offset. USB115200 baud. Board digital reference is5V. Use only two current DFRobot SEN0208 V2.0 in Mode0 as wired in the materials document. No UNO R4, ESP32, generic SR04T or3.3V substitution.
Upstream D4 trigger/D5 echo; downstream D6 trigger/D7 echo. Trigger idle LOW,20us HIGH then LOW. Echo capture pulseIn(HIGH,45000us); zero pulse result means timeout and distance NA. Pre-existing echo HIGH is stuck_high. Raw durations outside1725–28735us are out_of_range, including manufacturer's ~40ms no-echo behavior. Distance convention is0.174mm/us from the manufacturer's Mode0 timing, not a measured calibration. Working-range boundary rounding is conservative; validate actual probe behavior.
First U sample after ~10s settling/scheduling, D sample250ms later; then repeat pairs every10s. This spacing exceeds vendor>50ms cycle but does not prove acoustic independence. Each sample has its own session-ms timestamp. millis() subtraction is uint32 wrap-safe for the configured intervals; session values wrap after about49.7days and reset at boot. No catch-up burst after delay. Echo reading can block at most configured45ms per attempted acquisition; actual hardware timing still needs scope checks. Serial transport can stall or lose data if host unavailable: this is not autonomous recording.
Obtain source / tested build commands
Unzip the package and cd draincheck-bench-v1. Install PlatformIO Core6.1.17 (or reproduce using that version) and Python helpers. Commands below ran successfully in the project firmware computer; upload cannot be executed without physical hardware:

Bash


pio run -e uno
pio test -e native
clang++ -Iinclude -g -O1 -fsanitize=address,undefined -fno-omit-frame-pointer test/test_native/test_main.cpp -o /tmp/core-test
/tmp/core-test
python3 -m pip install pyserial pandas matplotlib
python3 -m py_compile tools/*.py
python3 tools/logger.py --help
python3 tools/plot.py --help
python3 tools/check_helpers.py
The helpers were tested with installed pyserial/pandas/matplotlib, not a locked Python dependency set. Native platform1.2.1 is the observed version. platformio.ini pins atmelavr5.1.0, boarduno and Arduino framework; resolved Arduino AVR framework5.2.0 and AVR GCC7.3.0. Build type is PlatformIO's standard optimized Arduino release. Flash4928/32256bytes (15.3% application capacity); static RAM293/2048bytes (14.3%), excluding runtime stack/heap. Bootloader occupies remaining512bytes of32KiB flash. These are build outputs, not stack-usage or runtime guarantees.
Durable JSON restoration (no expiring ZIP required)
Download the linked JSON as draincheck-bench-v1.json into an empty working directory. Run this Python block there; generated files go under draincheck-bench-v1:

Python


import json, base64, hashlib
from pathlib import Path
bundle=json.loads(Path('draincheck-bench-v1.json').read_text())
root=Path('draincheck-bench-v1')
for name,item in bundle['files'].items():
    relative=Path(name)
    assert not relative.is_absolute() and '..' not in relative.parts
    data=base64.b64decode(item['base64'])
    assert hashlib.sha256(data).hexdigest()==item['sha256']
    dest=root/relative
    dest.parent.mkdir(parents=True,exist_ok=True)
    dest.write_bytes(data)
print('restored',len(bundle['files']),'files')
Exact saved bundle restored20files with hashes checked; restored source then independently rebuilt foruno and passed the native assertions. Binary files are in binaries/; build outputs regenerate under .pio/build/uno/. Logs in logs/ include build.log, native.log, sanitizer.log, helpers.log and verification.md. logs/synthetic.csv/png are explicitly generated fake helper fixtures, not bench observations.
Upload and capture — user hardware step, NOT yet performed
During electrical HOLD these commands are for UNO-alone dry preparation ONLY, and only if the official UNO and suitable USB data cable are already owned and inspected. Disconnect ALL sensor power AND signal wires before connecting USB; keep the two 10k echo pulldowns to GND if fitted, so disconnected echo inputs are not floating. Expect missing distances (NA)/timeouts, invalid datum and unknown diagnosis—not evidence of sensing performance. If pulldowns are absent, floating inputs can give spurious readings; do not interpret them.
Do not connect heads until the supply/interface sourcing gate in @first-assembly-and-commissioning is closed and its applicable preconnection rail/current qualification tests pass. Then follow its gated one-head dry timing/fault tests, followed by two-head tests; only after those pass proceed to water. No DMM spot reading closes missing design ratings.
For the owned, inspected UNO alone, connect USB data cable and find actual port (pio device list). Replace example /dev/ttyACM0 with actual Linux/macOS device or Windows COM port.

Bash


pio run -e uno -t upload --upload-port /dev/ttyACM0
pio device monitor -b 115200 --port /dev/ttyACM0
# Close monitor before logger or another upload.
python3 tools/logger.py --port /dev/ttyACM0 --out trial-001.csv
# Ctrl-C closes/flushed file. Output path must NOT already exist.
python3 tools/plot.py trial-001.csv --out trial-001-raw.png
PlatformIO uses the board's normal Arduino/avrdude upload recipe. Firmware HEX is an application image, not a replacement for USB bridge firmware/bootloader. USB opening may reset UNO; wait for CSV header. Start a NEW logger file for every reset/reconnect/trial. Do not join sessions by cycle number alone. No physical upload, boot timing, USB compatibility or serial longevity test has occurred.
CSV semantics and honest unknowns
Header: cycle,up_ms,down_ms,utc_valid,up_us,down_us,up_mm,down_mm,up_quality,down_quality,datum_valid,cal_version,up_elevation_mm,down_elevation_mm,delta_mm,difference_resolved,diagnosis,firmware.
Logger prepends receipt_utc from laptop clock. Device utc_valid is always0; no UTC sync protocol exists. Receipt UTC is not sensor acquisition UTC. A raw_us0 is a timeout code; raw_mm is NA, not zero. Qualities: raw_ok (range gate only), timeout, out_of_range, stuck_high. Plausible in-range multipath can still be wrong. A changed CSV header/reset is not an unbroken session: split files manually. Cycles missing from capture remain gaps; logger does not reconstruct them.
DATUM_VALID=false, Z_UP_MM=NAN, Z_DOWN_MM=NAN, COMBINED_UNCERTAINTY_MM=NAN, CAL_VERSION=UNSURVEYED-v0 in include/calibration.h. Thus derived values are NA by default. After actual survey/reference trials only: enter both independently surveyed acoustic-face elevations, measured conservative combined uncertainty bound and new version, enable validity and rebuild/upload. datum_valid output means all required calibration/arithmetic inputs and both samples valid; it is NOT proof of a valid hydraulic model. Equation: elevation=surveyed_face_height−distance; delta=U−D. Difference_resolved=1 only when |delta| exceeds the supplied combined bound; not a diagnosis threshold.
Diagnosis is literally unknown for every row in this release, including calibrated rows. No hydraulic baseline has been established and no blockage thresholds are invented. Calibration does not authorize causal inference. No air-temperature input or empirical bias correction is implemented; reference tests must quantify suitability before enabling elevation reporting.
Independent continuation verification — 2026-11-10
Corrected log command tail -n 15 logs/*.log succeeded. Clean UNO rebuild, native15 assertions, ASan/UBSan, Python syntax/CLI and synthetic helpers independently reproduced successfully with identical4928 flash/293 static RAM and no compiler/linker warning lines. No source changes required; NAN calibration and literal unknown diagnosis retained. Reproduced evidence and binaries. See @first-assembly-and-commissioning for exact commands/results and the new conditional USB voltage-tolerance gate. Nominal5V rails and the manufacturer UNO tutorial suggest direct-interface compatibility but do not establish guaranteed VIH/VIL/VOH/VOL margins or USB supply upper-bound compatibility; the supply/interface sourcing gate remains open.
Fault handling and test results
Each head retried on next scheduled10s cycle after timeout/out-of-range/stuck-high. The other head still gets its slot. No endless echo wait; no automatic power-cycle hardware. Persistent faults: USB off, inspect dry wiring/probe, restart a new session. No unattended watchdog recovery, reset-cause history, persistent calibration storage or autonomous evidence retention claim.
Completed software checks:
  • UNO release build SUCCESS; final compiler warnings0, linker warnings0 as seen in retained build log. No whole-program static-analysis claim.
  • Native custom-runner suite PASSED with 15 C++ assertions, including missing/no-echo sentinel, out-of-range/invalid samples, invalid datum, invalid surveyed constant, unknown uncertainty, small difference inside combined uncertainty, valid arithmetic and uint32 scheduling wraparound. PlatformIO summary says0framework cases because these are plain C++ asserts, not Unity test cases.
  • Host sanitizer run stdout exactly: PASS: 15 assertions; invalid, datum, uncertainty, arithmetic, wraparound. No ASan/UBSan diagnostics emitted; no file/line defect to quote.
  • Helper smoke stdout: PASS: pseudo-terminal logger preserves missing sample + invalid UTC; synthetic plot generated. Logger/plot imports, syntax and --help succeeded. Pseudoterminal is not physical USB or sensor data.
  • ZIP integrity and20file restoration/hashes verified; restored source built and native checks passed.
Initial host harness failures were corrected: suite directory renamed native→test_native for discovery; custom runner corrected from unavailable platformio_build_dir attribute to actual .pio/build/native/program. Final rebuilt tests passed. These were host harness problems, not proven hardware defects.
Unattempted/blocked by absent physical hardware: actual sensor timing/echo interpretation, crosstalk, power peaks/USB allowance, survey constants, water accuracy and temperature dependence, mounting, cable fit, upload and24h logger reliability. Host tests cannot validate these. Continue using the commissioning checklist before any inference or fit-dependent enclosure commitment; provisional dry-bench CAD is already authorized.
  • Downloads — source of truth

  • Active-build safety status — 2026-11-10

  • Hardware and firmware contract

  • Obtain source / tested build commands

  • Durable JSON restoration (no expiring ZIP required)

  • Upload and capture — user hardware step, NOT yet performed

  • CSV semantics and honest unknowns

  • Independent continuation verification — 2026-11-10

  • Fault handling and test results