Menu

Networks on microcontrollers

Fitting the sensing network on a microcontroller

Study · Neural networksNovember 18, 2026Senova Systems Research

Stored as 8-bit integers, the study 1 network takes 10.9 KB instead of 35.0 KB, and its accuracy changed by 12.6 %. By our estimate one position takes about 77.9 µs on a 170 MHz microcontroller.

Every result here comes from simulations of our own simplified models, run with fixed random seeds so they repeat exactly. Nothing has been measured on hardware yet. We report what came out, including where our approach did not win.

The question

A position estimate is no use if it cannot run inside the control loop, on the stage's own small processor. How much do memory and accuracy suffer when the network is squeezed into 8-bit integers?

What we did

We took the best network from study 1 (72 → 64 → 64 → 2, 8,962 parameters) and quantised it after training, without retraining, in two ways. The simplest: one scale per layer, one input scale, 256-entry tanh table. The refined version: one scale per neuron, one per input, 1,024-entry tanh table. In both, activations are 8-bit with scales from 1,000 calibration samples, and sums stay in 32-bit integers.

qw=round⁡ ⁣(wsw),sw=max⁡∣w∣127qx=round⁡ ⁣(xsx),sx=P99.9(∣x∣)127yj=sw,j∑isx,i  qx,i  qw,ij  +  bj\begin{aligned} q_w &= \operatorname{round}\!\left(\frac{w}{s_w}\right), & s_w &= \frac{\max \lvert w \rvert}{127} \\[4pt] q_x &= \operatorname{round}\!\left(\frac{x}{s_x}\right), & s_x &= \frac{P_{99.9}\big(\lvert x \rvert\big)}{127} \\[4pt] y_j &= s_{w,j} \sum_{i} s_{x,i}\; q_{x,i}\; q_{w,ij} \;+\; b_j \end{aligned}

Symbols

qw, qx∈{−127,…,127}q_w,\ q_x \in \{-127, \dots, 127\}
8-bit integer weights and activations
sws_w
weight scale: one per layer (simplest) or one per output neuron (refined)
sxs_x
input scale: one for all inputs (simplest) or one per input (refined)
P99.9P_{99.9}
99.9th percentile over 1,000 calibration samples, so rare outliers don't waste range
∑\textstyle\sum
summed exactly in 32-bit integers; tanh by lookup table (256 or 1,024 entries)

In plain words

Every weight and activation becomes a whole number from −127 to 127 times a scale. With one scale per layer, a single large weight sets the step size for all of them, so small weights lose precision. One scale per output neuron and per input keeps each set's full range. The sums stay exact in 32-bit integers, and a finer tanh table removes most of the rounding at each neuron.

What we found

Full precision against 8-bit integers (10,000 test positions)
Error, rms (mm)95th percentile (mm)Memory
64-bit float0.2440.44435.0 KB as 32-bit
8-bit, simplest0.6041.1369.4 KB
8-bit, refined0.2750.48310.9 KB

The simplest version made the error 147.8 % worse: one scale per layer wastes most of the 8 bits on the few largest weights, and a coarse tanh table adds a step error at every neuron. Giving each neuron and each input its own scale, and using a finer table, brought the change to 12.6 % for a few hundred extra bytes.

00.511.520406080Percentile of test positionsPosition error (mm)
Study 3: error at each percentile of the 10,000 test positions, full precision against the two 8-bit versions

Each estimate is 8,832 multiply-accumulates. At 170 MHz that is about 77.9 µs; At 480 MHz that is about 27.6 µs. These are estimates (one multiply-accumulate per clock plus 50 % overhead), not measurements. At 5,000 estimates a second, the loop has 200 µs per cycle.

What it means

The network fits comfortably in a microcontroller's memory and, by estimate, inside a fast control loop. Combined with the event-driven approach in study N2, most cycles would need only a small part of that work.

Limits: timing estimated, not measured; post-training quantisation only. Training with quantisation in mind could close any remaining gap.