Skip to content

Test a TinyML gesture acceptance gate

Compare baseline, int8-style, pruning, and noise behavior against a visible on-device acceptance gate.

Edge Eddie: I want you to keep the memory, latency, sensor-match, and confidence gates visible before approving a real-device trial., your practice guide

Edge Eddie: I want you to keep the memory, latency, sensor-match, and confidence gates visible before approving a real-device trial.
Predict the reading, then compare it with the measurement.

Wokwi ESP32

Third party Tool

Compare baseline, int8-style, pruning, and noise behavior against a visible on-device acceptance gate.

Tier 1 · Web · No account

Version tested: Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09. Date: 2026-09-09.

Open the ESP32 editor, paste diagram.json, then paste sketch.ino.

Open Wokwi to paste in the files (new tab)

Get the files

Use both prepared files. This is a paste-in setup; saving a project requires a Wokwi account.

diagram.json

2,015 bytes · Circuit connections

Download

sketch.ino

12,305 bytes · ESP32 program

Download

  1. Use the launch button above to open the ESP32 editor in Wokwi.
  2. Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
  3. Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.

Steps

Screens captured against Wokwi ESP32 Compiled and booted by the Wokwi gate (ESP32 Arduino core 3.3.11); captured in the Wokwi web editor on 2026-09-09 on 2026-09-09; the tool may have moved on — the text steps are the contract.

  1. 1 Step 1

    Do
    Paste diagram.json and sketch.ino into a new Wokwi ESP32 project, then inspect the four LED paths, mode button, and noise control.
    You will see
    Red, yellow, green, and blue LEDs use GPIO12 through GPIO15; the button uses GPIO4 and the potentiometer signal uses GPIO34.
    Why it matters
    The host chapter requires the complete input, inference, decision, and action path to fit the device.
    Step 1: Four class LEDs, a mode button, and a noise potentiometer connect to the ESP32. The ring marks the classifier controls and outputs.
    Step 1 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  2. 2 Step 2

    Do
    Inspect the model constants, input profiles, and float and int8 weight arrays before starting.
    You will see
    The sketch declares 12 inputs, 8 hidden activations, 4 classes, and separate float and int8-style weight storage.
    Why it matters
    Making each budget visible prevents a model-file size from being mistaken for total runtime fit.
    Step 2: The sketch declares 12 inputs, 8 hidden units, 4 classes, and float and int8-style storage. The ring marks the visible model budgets.
    Step 2 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  3. 3 Step 3

    Do
    Start the simulation at the potentiometer's low-noise setting and wait for Mode 0.
    You will see
    Gesture recognition prints a target, prediction, confidence, latency in microseconds, and Accepted: yes or no.
    Why it matters
    A repeatable baseline connects sensor-window behavior to a measurable acceptance threshold.
    Step 3: Prediction: SHAKE | Confidence: 73.1% | Latency: 415 us Accepted: yes The ring marks the baseline prediction, confidence, latency, and acceptance result.
    Step 3 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  4. 4 Step 4

    Do
    Press the mode button once, or send 1 in Serial Monitor, and wait for Mode 1.
    You will see
    Float bytes and Int8-style bytes appear with both predictions, confidences, and measured latencies; the gate says predictions should match.
    Why it matters
    Quantization is useful only when the smaller representation still preserves the class decision on representative input.
    Step 4: [MODE 1] Float vs int8-style comparison Float bytes: 560 | Int8-style bytes: 184 Float: SHAKE | 74.1% | 416 us Int8-style: SHAKE | 74.1% | 173 us Gate: predictions should match before int8 deployment. The ring marks the float/int8 storage comparison and class-agreement gate.
    Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  5. 5 Step 5

    Do
    Press the mode button again, or send 2 in Serial Monitor, and wait for Mode 2.
    You will see
    The pruning sweep reports 0%, 30%, 60%, and 85% pruning with a class, confidence, and latency for each level.
    Why it matters
    The host chapter warns that fitting memory is not enough when confidence or class behavior changes.
    Step 5: Prune 60% - width= TAP 35.1% | 589 us Prune 85% -> TILT 26.0% | 434 us Gate: heavy pruning fails if confidence or class changes. The ring marks the two heaviest pruning results and failure rule." loading="lazy">
    Step 5 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  6. 6 Step 6

    Do
    Press the mode button a third time, or send 3 in Serial Monitor, and wait for Mode 3 at low noise.
    You will see
    The threshold test reports Noise, a 70% threshold, Passes out of 12, and the instruction to repeat across noise settings.
    Why it matters
    A held acceptance gate turns a simulation result into evidence for or against a real-sensor trial.
    Step 6: [MODE 3] Threshold and noise test Noise: 58% | Threshold: 70% Passes: 3/12 Gate: repeat at low, medium, and high noise settings. The ring marks the low-noise threshold result.
    Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)
  7. 7 Step 7

    Do
    Turn the potentiometer to its high end, or send H in Serial Monitor, and wait for the next Mode 3 result.
    You will see
    The reported noise rises above 70% and a new Passes out of 12 result appears at the same 70% threshold.
    Why it matters
    Changing only the noise control exposes distribution sensitivity without silently changing the decision rule.
    Step 7: [MODE 3] Threshold and noise test Noise: 100% | Threshold: 70% Passes: 3/12 The ring marks the high-noise result under the unchanged threshold.
    Step 7 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab)

Chapter checks

These questions refer to the chapter’s examples. Use the return links to review their answers.

  1. A team has a quantized model that fits in flash, but the tensor arena plus audio feature buffer leaves almost no SRAM for stack, logs, and firmware state. What should the team do before approving the TinyML deployment?

    Return to the chapter’s knowledge check
  2. A TinyML model has 80,000 INT8 weights. Where do the weights live, and what separately bounds SRAM use?

    Return to the chapter’s knowledge check
  3. A vibration anomaly model performs well in the notebook, but field firmware samples the accelerometer at a different rate and uses a different FFT window. What is the most likely problem?

    Return to the chapter’s knowledge check

Caution

This readable dense network uses synthetic gesture profiles and int8-style storage; it is not a trained or production TensorFlow Lite Micro model. Simulator latency is not hardware certification. Retest with representative physical sensor windows, the actual sample rate and preprocessing, full SRAM headroom, power, operators, and update path before deployment.

Return to TinyML on Microcontrollers · Browse Labs