On a cheap muscle sensor, does the fanciest model or the simplest one win?

Carl Kho · a plain-language version of Pareto-Optimal Model Selection for Low-Cost, Single-Lead EMG Control in Embedded Systems

A cyclist who takes a hand off the handlebars to work a turn signal gives up some stability. One hands-free option is to read the electrical signal of a forearm muscle, called EMG, short for electromyography, so a deliberate squeeze of the grip triggers the signal. Medical-grade EMG systems cost thousands of dollars. Hobbyist sensors are cheap, but their signal is noisy.

I used an AD8232, a sensor board designed for heart monitoring that costs about $13, wired to an ESP32, a small microcontroller with 320 KB of memory. I recorded my own forearm in five sessions on one day, about 25 minutes in all, cut into roughly 1,300 one-second windows. There were three classes: relaxed, clenched, and noise, which meant shaking, tugging wires and vibrations meant to mimic a bike on the road. The noise class matters because an accidental trigger is the dangerous mistake.

Then I compared 18 models, from simple rules and classic methods like random forests to deep networks, image models that read pictures of the signal's frequencies, and a network I designed called MaxCRNN. On the chip, an answer also has to come back in under 100 milliseconds and fit in that memory.

MaxCRNN was the most accurate, at 83.21%, with 99% precision on clenches, meaning almost none of its clench calls were false triggers. But it needs a data-centre GPU and can't run on the ESP32. A random forest, which averages 100 small decision trees that each ask simple questions about how strong the signal is and how often it crosses zero, scored 74.25%, answered in 0.01 milliseconds and needs under 50 KB. The big image models were out: ResNet50 took over 100 milliseconds, and MobileNetV2 needed about 2 MB.

So I picked the random forest for the chip. It compiles to plain if-then statements and runs in microseconds, at about 9 points less accuracy than MaxCRNN. Deep networks trained from scratch struggled on so little data: a small one scored 49.63% until I added augmentation, meaning slightly jittered, scaled and shifted copies of the training data, which lifted it to 78.36%. The models also fail in different places. The random forest rejects big jolts, like hitting a pothole, because the signal doesn't cross zero often enough to be a muscle, while MobileNetV2 catches faint clenches too weak to trip the forest.

The lesson I'd draw is that on cheap hardware, the most accurate model on paper isn't the useful one if it can't run where it's needed, and fast control looks feasible on commodity parts. The limits are real, though: one person, me, seated, on one day with the electrodes never moved, and the accuracy figures are single estimates whose intervals may be 3 to 5 points either way. It hasn't been tried on a real bike yet.