A stunt double for your UART peripheral. A Green Shoe Garage Field Instrument.
Capture the conversation while the real accessory is on your bench. Turn selected requests and replies into explicit byte rules, rehearse those rules, then export an independent Arduino UNO R4 Minima sketch. Your controller talks to the board's hardware UART after the browser is closed and the board's programming USB is disconnected.
This release contains the complete static browser application, editable source, portable example data and saved test suites, five generated firmware variants, actual target outputs, wiring diagrams, physical host runners, and validation evidence. Rendered-browser acceptance and physical bench testing remain unperformed here. See VALIDATION.md for separate executed evidence and target-build results.
Understudy-v1.6.0-GitHub.zip contains this complete repository and a ready-to-upload web-server/ directory. Put the contents of the extracted Understudy/ folder at your Git repository root. The existing GitHub Actions workflow, pinned development dependencies, source, tests, five complete firmware variants and validation evidence are included.
To host the instrument, upload the contents of web-server/ into your site's chosen directory. The separate Understudy-v1.6.0-Web.zip contains the same files inside a folder named understudy/, ready to place on a server. No server-side runtime, dependency installation, build command, database, base-path edit or routing rewrite is required. Runtime source and examples are unchanged from the v1.6.0 release.
See DEPLOYMENT.md for root/subdirectory hosting, local preview, data backups and rebuilding both packages. The web-server/ directory is generated from the editable source; run python3 tools/package-release.py after changing that source. .gitattributes preserves exact file bytes across Git checkouts.
| Requested milestone | Implemented workflow |
|---|---|
| 1.4.1 | Clear action scopes; selected sample to host input; errors navigate the affected rule/reading/field; invalid text remains attached to its rule; trace paging and source navigation; visible reset and suite-binding explanations. |
| 1.5 | Recording/profile and accessory/stand-in comparisons; exact byte and timing differences; explicit reset context; unresolved ambiguity and incomplete coverage; operational changes before suite rebinding; persistent expectation origin. |
| 1.6 | Portable bench sessions and asset ZIPs; setup metadata and content identities; imported Python/virtual/browser report review; run-to-run comparison; direct saved-suite execution through a compatible browser and separate UART adapter; Python --session execution. |
This is one cumulative 1.6.0 release, including the three approved increments. The Minima remains the target. Real browser and physical acceptance are separate open gates, even though the software and target-compilation tests have run.
Open Compare for read-only profile replay or accessory-versus-stand-in analysis. Declare a known reset/state context, choose a timing tolerance, and confirm an observation end when claiming silence. Each request shows modeled rule/reading/state, exact observed/model bytes, first differing offset, missing/extra bytes and the elapsed delay. Wrong transaction echoes and CRCs remain visible. Browser-arrival timestamps, ambiguous pairing, different controller byte pacing and unequal observation windows cannot create a wire-compatibility pass.
Import comparison.project.json to try the authored fictional regression: its first response is 140 ms late, and its second reading changes byte 3 from 36 to 39 (21.6 to 21.9). The known collection end is 1800 ms in both recordings. COMPARISON.md gives the complete walkthrough and interpretation limits.
In Bench, prepare a session from the current valid profile and bound saved suite. Record the board, UART adapter, firmware/build identity, power, reset method and timing source. Export the exact session JSON or its ZIP containing profile, suite, standalone sketch, pinned build config, wiring notes and hashes. Export an archive to include imported result history. A session is a snapshot; importing one does not replace the active project.
With a compatible browser, the session can run through a separate USB-to-UART adapter. Each case requires an operator-confirmed cold reset; reading remains active across sends, fragment gaps and steps, preserving late responses. Python remains available using tools/run_suite.py --session .... Import either runner's report into Bench for byte/deadline reinspection and comparison. A metadata or content hash is not proof of the firmware physically flashed, and a reset confirmation is not sensed power removal. BENCH-SESSIONS.md explains the artifacts, execution and evidence boundaries.
- Masked request matching: retain a concrete sample packet, compare selected bits, and set an explicit allowed request-length range. Conflicting masks are rejected in overlapping states.
- Named integer fields and reply templates: decode 1/2/4-byte fields with declared byte order and signedness. Copy their exact bytes into a reply or encode literal integer readings. Generated replies remain tied to the request that was accepted.
- Checksums: validate requests and generate replies using XOR8, sum8, configurable CRC8 or CRC16. Covered ranges, storage locations, polynomial, initial value, reflection and final XOR are explicit. Checksum failure stays silent without consuming state or a reading. Controlled faults apply after checksum generation.
- Length-prefix framing and packet inspection: assemble variable-size packets across reads, diagnose invalid lengths and resynchronization, and inspect fields, checksum and generated reply without advancing the model.
- Separate binary thermometer example: Project → Load binary thermometer example opens a fictional protocol with transaction IDs, signed temperatures, variable payloads, initialization/sleep/wake and seven saved cases / 26 steps. BINARY-PROTOCOL.md walks through it.
- Compatible migration: profile/project versions 1–3 import as version 4. The four previous example behavior fingerprints remain unchanged, so their existing saved suites stay bound. Original observations and capture bytes remain separate from edits. See UPGRADING.md.
Capture-assisted teaching, deterministic controlled failures, named states and native-USB board inspection remain available. Every new binary behavior runs in both the browser model and generated autonomous UNO R4 Minima firmware.
Extract the ZIP and open index.html in a modern browser. The app has no runtime dependencies, accounts, CDN assets, telemetry, or network requests. File import, rule editing, simulation, and export run locally. Keep index.html and the app/ directory together.
For hardware serial, use a compatible desktop browser such as Chrome or Edge and serve the directory on localhost:
cd Understudy
python3 -m http.server 8765 --bind 127.0.0.1Open http://localhost:8765/. HTTPS hosting also supports secure contexts. Web Serial availability is detected in the app; unsupported browsers retain the complete software workflow. File-origin local storage and serial permissions vary by browser, so localhost is the recommended bench entry point. The Web Serial specification requires a secure context; Chrome's serial guide documents the port chooser and byte streams.
To self-host, upload the contents of web-server/ while retaining their relative paths, or use the identical understudy/ folder from the Web ZIP. The generated directory includes the app and the support files linked from its guides. No backend or build step is required on the server. Full development tests, compiler outputs and the complete evidence archive remain in the GitHub package. See DEPLOYMENT.md.
- On a fresh launch, the explicitly labeled fictional thermometer recording is open. The selected request is
READ\r\n(52 45 41 44 0D 0A). Both traffic lanes show escaped text and hex for the same bytes. - Click Run selected. A fresh simulated stand-in returns
21.5\r\nafter 10 ms. The full six-byte reply is complete 16.25 ms after the request ends, within the 100 ms host timeout. - Change only Reading 01 → Delay from
10to150, then click Run selected again. The host times out at 100 ms; the reply starts at 150 ms and completes at 156.25 ms after the request ends. The late reply remains visible. - Expand Original observation: its original bytes and 10 ms interval are unchanged.
Run selected always starts in the profile's initial state with reading positions reset. An inactive selected rule stays inactive; it does not silently enter that rule's state. The Rehearse tab keeps current state and reading positions between runs until Reset stand-in, or until the profile is edited.
Load example, Import capture, and Start empty stay visible. Start empty has zero captures and zero rules. Project replacement and rule/reading removal have a one-step undo in the Project menu. Day, Night, and High contrast are available beside the application title.
Expand Review captured exchanges below the traffic lanes to review the three READ pairings, choose the ending policy, and replace the rule's readings with the selected sequence. In Rehearse → Saved bench tests, the bundled five-case suite is ready to run. Choose Protocol states → Load initialization example to explore initialization/sleep/wake and its separate suite without changing the first-minute example.
Choose the physical setup before connecting:
- Browser as host: disconnect the original controller, use a voltage-compatible USB-to-UART adapter to send exact bytes, and record raw incoming chunks. Browser times identify queued writes and reader arrival; they include UART/USB/OS behavior.
- Existing controller as host: keep its real accessory connected, observe each direction with a suitable high-impedance analyzer input, and import the decoded two-direction CSV. This does not connect a second transmitter to either wire.
The wiring guide and diagram cover both capture setups and the final stand-in. The capture format guide specifies units, origin, row boundaries, and a complete minimal CSV. No line ending is silently appended or removed. Failed writes and read errors stay in capture metadata and survive export; a failed write cannot become teaching evidence.
Select one or more host chunks in the left lane and their reply chunks in the right lane, then choose Make a rule. A rule retains a copy of the original observation. Edit its request, response bytes, and delays using synchronized escaped-text/hex fields. Add ordered readings inside the rule. Multiple overlapping exact or masked requests require distinct explicit state conditions; an Any-state rule cannot overlap another eligible pattern. Exact matching remains the starting point. Binary fields and checksum controls are collapsed beside the rule editor.
Choose explicit request framing: terminator bytes, including CR/LF, fixed length, or a sync marker and length field. The default is CRLF framing at 9600 baud, 8N1. Every request must be exactly one complete frame. After the last reading, choose repeat final, loop, or stay silent. Reset and cold boot restore the initial state and reading 1. Unknown complete frames and known commands in the wrong state stay silent, with separate diagnostics. State transitions preserve each rule's reading position until reset.
For repeated exchanges, use Review captured exchanges. Suggestions are derived from the immutable trace, including exact byte offsets when a row contains more than one frame. Every association requires review; flagged ambiguity has its own acknowledgment. Missing replies, failed writes and truncated evidence cannot be promoted to confident observations. Each selected reply keeps its own original evidence alongside editable readings. TEACHING.md describes conservative pairing and coverage limits.
The deterministic virtual UART accepts a complete chunk, user-sized fragments with a gap, or consecutive copies of the request. It shows matched rule/reading, reply bytes, request end, reply start/end, and host deadline. A complete reply must arrive by the deadline to pass. TX contention postpones later replies and is shown; bytes never interleave.
Run all bench cases runs the bundled fixture in isolation: 10 ms success, 150 ms timeout with late reply, fragmented request, back-to-back requests, unknown silence, and sequence/reset. It does not edit your current profile and does not perform a hardware test.
Saved bench tests operates on your profile and explicit expectations. Add a test from the host input above, edit its chunks and expected stream, then choose Save step. Fill expectation from the model for review is an explicit optional action; it does not manufacture observed evidence. Multiple steps continue without flushing the UART. Results identify first byte differences, missing/extra bytes, silence, wrong sequence values and deadline failures. Export the suite and result evidence separately. A changed profile shows an operational diff against the saved baseline before reviewed rebinding; expected bytes and timing remain unchanged. Each expectation retains authored, captured, model-derived or unknown origin across save/export/reload. SAVED-TESTS.md includes the physical runner and exact stream-window semantics.
In a rule's Controlled failures, choose accepted-response triggers and ordered actions. These changes also run in the exported firmware. Import the controlled-failures profile and matching suite to try all five actions and a late reply crossing into the next transaction. See FAULTS.md.
Export the portable profile JSON and the complete Arduino sketch separately. Put the downloaded Understudy.ino inside a folder named Understudy. The board stores its role in flash; it does not read the JSON file at runtime. Regenerate and upload to change its behavior.
The normal example is generated at firmware/Understudy/Understudy.ino; the delay-only variant at firmware/slow/Understudy/Understudy.ino; controlled failures at firmware/faults/Understudy/Understudy.ino; the initialization/sleep/wake variant at firmware/stateful/Understudy/Understudy.ino; and the binary variant at firmware/binary/Understudy/Understudy.ino. Each source header records its exact behavior fingerprint. After upload, Inspect stand-in reads the firmware-reported identity from the separate native USB port. It is an optional snapshot, not a live connection or cryptographic attestation; standalone operation requires no USB diagnostic connection.
The declared target is Arduino UNO R4 Minima, Arduino C++, FQBN arduino:renesas_uno:minima. The pinned, actually compiled board package is Arduino UNO R4 Boards 1.6.0. No additional Arduino libraries are required.
With Arduino CLI installed, run from this repository root:
arduino-cli core update-index
arduino-cli core install arduino:[email protected]
arduino-cli compile --fqbn arduino:renesas_uno:minima --warnings all --output-dir firmware/Understudy/build firmware/Understudy
arduino-cli board list
arduino-cli upload --fqbn arduino:renesas_uno:minima --port /dev/cu.usbmodemYOUR_BOARD --input-dir firmware/Understudy/build firmware/UnderstudyReplace the example port with the UNO's programming USB port, not the USB-UART adapter. The firmware guide includes Arduino IDE 2 instructions, CLI generation, optional USB diagnostics, binary identity, and the slow variant.
Actual per-profile flash/global-RAM totals and maximum-bound compilation are recorded in VALIDATION.md and the firmware guide. Genuine .elf, .hex, .bin, and map files are included under each shipped firmware build/ directory. These compiler outputs are separate from runtime stack measurements and physical upload; no board was flashed in this environment.
| Controller or adapter | UNO R4 Minima |
|---|---|
| TX output | D0 / RX (Serial1) |
| RX input | D1 / TX (Serial1) |
| Ground | GND |
The Minima uses 5 V logic; check the actual other device's thresholds/tolerance and use appropriate level translation for a 3.3 V interface. TTL UART is not RS-232. Use one transmitter per wire and common ground. The native USB connection is for programming/optional diagnostics, separate from the emulated UART. The official Arduino pinout and board documentation establish these board facts.
The full wiring guide includes a concrete FTDI TTL-232R-5V cable mapping, independent power, and the USB-disconnected cold-start procedure. Leave adapter VCC unconnected in that setup.
After uploading the 10 ms sketch and wiring a separate USB-UART adapter:
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install -r tools/requirements-host.txt
python3 tools/host_test.py --port /dev/cu.usbserialYOUR_ADAPTER --profile examples/thermometer.profile.json --manual-cold-restart --json validation/my-physical-10ms.jsonUse your adapter's actual port. On Windows, use the documented PowerShell activation and COM port in BENCH.md. Flash the slow sketch and rerun with examples/thermometer-150ms.profile.json for the expected timeout case.
The host tester compares raw bytes and records practical OS-visible timing. The ±2 ms on-wire target is unmeasured: verify it with a two-channel analyzer, from the last request stop-bit end to first reply start edge. BENCH.md gives the exact remaining steps, 30-transaction measurement plan, restart prompts, and expected observations.
For a saved suite, after uploading its matching profile, run:
python3 tools/run_suite.py --port /dev/cu.usbserialYOUR_ADAPTER --profile examples/thermometer.profile.json --suite examples/thermometer.suite.json --json validation/my-saved-tests-physical.jsonThe runner checks file binding before opening the port and prompts for a true cold reset before each case. It listens during sends/gaps and preserves late bytes between steps. Use the matching stateful-thermometer files for five stateful cases, or binary-thermometer files for seven binary cases. The original baseline runner intentionally refuses active fault, stateful or binary-template profiles; use the saved-suite runner for those.
To inspect the firmware-reported profile independently, connect the UNO native USB and choose Inspect stand-in, or run:
python3 tools/inspect_board.py --port /dev/cu.usbmodemYOUR_BOARD --profile examples/stateful-thermometer.profile.json --json validation/my-board-identity.jsonThis port is the UNO's USB connection, not the host adapter. The inspector checks its runtime USB identifiers before sending a query, compares the full hash and configuration, then closes its connection. A mismatch, invalid response or timeout never becomes a match. A snapshot does not replace the autonomous UART/cold-power acceptance. See BOARD-IDENTITY.md.
The browser saves one atomic local envelope containing the last valid project and any unfinished editor draft. Preferences are stored separately. Reload restores both. Invalid drafts cannot be run/exported as if valid; malformed imports preserve the open project. A quota failure leaves the previous complete snapshot intact and prompts you to export a backup. Corrupt saved bytes are retained and can be downloaded through the Project menu before deliberate replacement.
Local autosave does not write back to imported files. Export a project JSON for a durable backup. The project includes captures, source/timestamp metadata, selected trace rows, rules, all original observations, faults, and a saved suite. Bench sessions and result history are separate: export the Bench archive as well when backing up those records. Profile and suite JSON are smaller separate artifacts. Test-step edits are locally autosaved drafts until Save step commits them; unfinished edits block project/suite export rather than being silently omitted. Recorded data never becomes part of application source. The bundled example is explicitly fictional; its source files remain in examples/. npm run build:examples regenerates its explicit suites and file-origin-compatible JavaScript wrapper.
| Path | Purpose |
|---|---|
web-server/, DEPLOYMENT.md |
Generated upload-ready directory and GitHub/static-host deployment instructions |
index.html, app/ |
Runnable static application and editable source |
examples/ |
Fictional captures, minimal analyzer CSV, four projects, five profiles, five bound suites, comparison captures and a sample portable bench session |
firmware/ |
Generated Minima sketches, pinned configs, real linked outputs |
docs/WIRING.md, docs/wiring.svg, wiring.csv |
Three physical setups, voltage domains and pin mapping |
docs/CAPTURE-FORMAT.md, docs/PROFILE-FORMAT.md |
Portable data contracts and timing semantics |
docs/FIRMWARE.md, docs/BENCH.md |
Accurate build/upload and physical acceptance procedure |
docs/TEACHING.md, docs/FAULTS.md, docs/SAVED-TESTS.md, docs/STATES.md |
Capture review, deterministic failures, state semantics and portable regression tests |
docs/UPGRADING.md |
Compatible migration, additive suite provenance, recovery and remaining acceptance gates |
docs/COMPARISON.md, docs/BENCH-SESSIONS.md, docs/RELEASE-NOTES-v1.6.0.md |
Comparison semantics, portable bench artifacts and cumulative release changes |
tools/host_test.py, tools/run_suite.py, tools/inspect_board.py |
Baseline/saved-suite physical host runners and native-USB identity reader |
docs/BINARY-PROTOCOL.md, docs/BINARY-PROTOCOL-SOURCES.md |
Binary authoring, fictional protocol, CRC parameters and independent vectors |
docs/BOARD-IDENTITY.md |
Read-only query format, validation, USB selection and physical procedure |
tests/, .github/workflows/ |
Software/native regressions and reproducible browser checks |
VALIDATION.md, validation/, firmware.json |
Recorded evidence, limitations, exact target/toolchain and hashes |
This version learns explicit observed behaviors. It does not discover unknown commands or infer an entire device protocol. It supports 8N1, standard baud choices from 1200 to 115200, up to 16 named states, 32 rules, 16 readings and eight fault actions per rule, 128-byte request/reply frames, eight named fields/rule, eight patches/reading (1,024 total), and eight pending replies. State conditions are authored choices, not facts automatically inferred from a trace. Capture analysis is bounded at 4,096 complete candidates; comparison replay also caps host bytes at 262,144 and clearly labels incomplete coverage. Recordings up to 20,000 rows retain all raw bytes, with paginated trace access. Saved suites allow 50 cases, 100 steps/case and 128 chunks/step, with byte/time bounds in the format guide. Use the analyzer import for an existing controller. The firmware is specifically verified for the Minima and pinned core, including a board-specific nonblocking UART transmission implementation.
Multi-file source is intentional: the byte engine, UI, generator, and fictional data stay separately editable and testable. Operation is static and offline. No deployment or GitHub repository publication has been performed.
npm ci
npm test
python3 -m unittest discover -s tests -p '*_test.py' -v
g++ -std=c++17 -Wall -Wextra -Werror -I tests/native tests/native/firmware_test.cpp -o /tmp/understudy-firmware-test
/tmp/understudy-firmware-test
npm run test:nativeOnly development tests need npm dependencies. The static app and sketch generator do not. See VALIDATION.md and browser acceptance for reproducible real-browser checks and honest not-run status.