Edge & Fog Computing · Study deck
TinyML on Microcontrollers
Picture a small motor monitor that should spot an unusual sound before damage grows.
Edge Eddie is your guide for this deck.

After studying this chapter
Learning objectives
You will be able to:
- Build a TinyML deployment budget that separates flash, SRAM, latency, energy, and update headroom.
- Explain how TensorFlow Lite Micro, vendor runtimes, CMSIS-NN kernels, and Edge Impulse-style workflows fit into the deployment path.
- Decide whether an application is suitable for microcontroller inference or should move to a gateway, accelerator, or cloud tier.
- Identify common failures caused by unsupported operators, activation memory, sensor mismatch, and unmeasured power policy.
Major section
In 60 Seconds
A sampling rate is the number of measurements taken in a set time.
- An analog-to-digital converter is a part that turns a measured voltage into a number; it is often shortened to ADC.
- A microcontroller is a small computer built to control a device.
- Firmware is the code stored on that device.
Major section
In 60 Seconds (continued)
Latency means the delay from an event to a useful result.
- A safe design should expose low confidence or a late result rather than presenting every answer as timely and certain.
- One test set cannot represent every machine or season.
- The design problem is not simply shrinking a model.
Major section
Phoebe's Field Notes: Why The Audio Buffer Cannot Hold Raw Sound
An 8 kB buffer therefore holds only 4096 samples, or 256 ms, even though the 8 kHz Nyquist limit easily covers 4 kHz speech.
- Sampling, precision, and memory must fit together before inference begins.
Major section
Minimum Viable Understanding
TinyML is constrained inference.: Most microcontroller deployments run a pre-trained model; training and retraining normally happen off-device.
- Flash and RAM are separate budgets.: Weights usually live in flash, while activations, input buffers, stacks, and framework memory consume SRAM.
- The sensor pipeline is part of the model.: Sampling rate, ADC resolution, microphone front end, feature extraction, and windowing must match training data.
- Runtime support decides feasibility.: A model that converts successfully can still fail because an operator, tensor shape, or memory plan is unsupported on the target runtime.
Major section
TinyML Fit Gate
Task fit: The inference output is local, narrow, and stable enough for a compact model: wake word, gesture, anomaly score, simple classification, or thresholded event detection.
- Memory fit: Model weights, firmware, runtime code, tensor arena, feature buffers, stack, logs, and update staging all fit with deliberate headroom.
Major section
What Fits on a Microcontroller?
Microcontrollers vary by family and board configuration, so always check the exact datasheet and firmware build.
- The patterns below are useful starting points.
- Simple anomaly detection, gesture windows, and low-rate sensor classification often fit when the model, feature buffer, and tensor arena are intentionally small.
- Image tasks are possible on selected MCUs, but input resolution, color format, camera buffer, and activation memory usually dominate the budget.
Major section
Deep Dive: Runtime and Memory Fit
Under the hood, flash and SRAM are separate release gates.
- TinyML is machine-learning inference on microcontroller-class devices: kilobytes to a few megabytes of memory, milliwatt power budgets, often no operating system, and sometimes no floating-point unit.
- On an MCU, the model must be self-contained with its runtime, sensor buffers, tensor arena, firmware stack, and update path.
- Pruning or quantizing weights can reduce flash pressure while leaving the activation peak unchanged.
Major section
Deep Dive: Runtime and Memory Fit (continued)
That deployment is plausible; doubling the feature buffer requires a new fit check even though the model file did not change.
- On a board with 256 kB flash and 64 kB SRAM, a 60,000-weight INT8 model consumes about 60 kB of flash.
- If the runtime and required operators take 92 kB, the application and radio stack take 74 kB, and update metadata takes 12 kB, the flash total is 238 kB, leaving 18 kB of headroom.
- Peak live activations drive the tensor arena in SRAM; that peak is not the same as the weight count.
Major section
Deep Dive: Runtime and Memory Fit (continued)
SRAM is separate: an 18 kB tensor arena plus an 8 kB audio feature buffer and 12 kB for stack, logs, and radio state uses 38 kB, leaving 26 kB.
- Changing an input window, layer shape, or feature buffer can increase RAM even when the model file gets smaller.
- On Arm Cortex-M devices, CMSIS-NN kernels can accelerate supported INT8 operators by using the core's SIMD and multiply-accumulate instructions.
- An INT8 model with 80,000 weights needs roughly 80 kB of flash for those weights because each weight is one byte.
Major section
TinyML Development Loop
Firmware integrates the runtime before Measure exercises the target device; only then does Deploy use a signed update.
- The instruction to measure before every pilot or update is the loop's control point, keeping model, firmware, and observed device behaviour aligned.
Major section
Sensor Data Quality
A model trained on clean lab data can fail when deployed with a different microphone, ADC, accelerometer mounting, enclosure, vibration profile, or temperature range.
- If training uses one FFT window, mel filter bank, normalization rule, image crop, or sensor axis order, firmware must implement the same rule.
- Small models cannot repair inconsistent labeling.
- Confidence thresholds that work in a notebook may fail when quantized, duty-cycled, or exposed to field noise.
Deck summary
Key takeaways
A sampling rate is the number of measurements taken in a set time.
- Latency means the delay from an event to a useful result.
- An 8 kB buffer therefore holds only 4096 samples, or 256 ms, even though the 8 kHz Nyquist limit easily covers 4 kHz speech.
- TinyML is constrained inference.: Most microcontroller deployments run a pre-trained model; training and retraining normally happen off-device.
- Task fit: The inference output is local, narrow, and stable enough for a compact model: wake word, gesture, anomaly score, simple classification, or thresholded event detection.
Retrieval practice
Recall check 1 of 5

Edge Eddie says: answer from memory, then check your reasoning.
Q1A 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?
Show answer
Answer: B TinyML memory approval requires peak SRAM headroom, not only a model file that fits in flash.
Retrieval practice
Recall check 2 of 5

Edge Eddie says: answer from memory, then check your reasoning.
Q2A TinyML model has 80,000 INT8 weights. Where do the weights live, and what separately bounds SRAM use?
Show answer
Answer: A Flash stores the quantized weights, while SRAM is bounded by the tensor arena, sensor buffers, stack, heap, and runtime state.
Retrieval practice
Recall check 3 of 5

Edge Eddie says: answer from memory, then check your reasoning.
Q3A quantized model converts to TensorFlow Lite, but the microcontroller build fails because one operator is not registered in the TinyML runtime. What is the best response?
Show answer
Answer: C TinyML feasibility includes runtime operator support, not only model conversion.
Retrieval practice
Recall check 4 of 5

Edge Eddie says: answer from memory, then check your reasoning.
Q4Which workload is the best TinyML candidate?
Show answer
Answer: A The task is local, compact, stable, and benefits from avoiding continuous raw-data transmission.
Retrieval practice
Recall check 5 of 5

Edge Eddie says: answer from memory, then check your reasoning.
Q5Place each TinyML responsibility where it lives so you can budget the device path without forgetting action and model lifecycle work.
Show answer
Answer: A The sensor pipeline and MCU runtime consume the device budget, local action uses the inference result, and cloud training and updates maintain the model so you can assess the complete product rather than inference alone.
Q6Complete the simplified TensorFlow Lite Micro inference sequence:
Show answer
Answer: A A TinyML inference call copies preprocessed features into the input tensor, invokes the interpreter, checks the status, and reads the output tensor.
Print reference
Answers 1 of 2
Answer key.
- B · TinyML memory approval requires peak SRAM headroom, not only a model file that fits in flash.
- A · Flash stores the quantized weights, while SRAM is bounded by the tensor arena, sensor buffers, stack, heap, and runtime state.
- C · TinyML feasibility includes runtime operator support, not only model conversion.
- A · The task is local, compact, stable, and benefits from avoiding continuous raw-data transmission.
Print reference
Answers 2 of 2
Answer key.
- A · The sensor pipeline and MCU runtime consume the device budget, local action uses the inference result, and cloud training and updates maintain the model so you can assess the complete product rather than inference alone.
- A · A TinyML inference call copies preprocessed features into the input tensor, invokes the interpreter, checks the status, and reads the output tensor.