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.
Predict the reading, then compare it with the measurement.
Wokwi ESP32
Third party ToolCompare baseline, int8-style, pruning, and noise behavior against a visible on-device acceptance gate.
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.
sketch.ino
- Use the launch button above to open the ESP32 editor in Wokwi.
- Select the editor’s diagram.json tab and replace all its text with the supplied diagram.json.
- Select the sketch.ino tab, replace all its text with the supplied sketch.ino, then click Start Simulation.
Steps
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 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) 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 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) 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 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) 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.](/practice/tinyml-gesture-gate/steps/step-04.webp)
Step 4 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) 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.
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) 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.](/practice/tinyml-gesture-gate/steps/step-06.webp)
Step 6 · Wokwi ESP32; numbered callout added to a real capture. Enlarge screenshot (new tab) 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.](/practice/tinyml-gesture-gate/steps/step-07.webp)
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.
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 checkA TinyML model has 80,000 INT8 weights. Where do the weights live, and what separately bounds SRAM use?
Return to the chapter’s knowledge checkA 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