Case 018 · Medtech

Fatigue detection on the band.

A three lead EEG headband that tells when the wearer is getting tired. The client's detection algorithm existed as Python on a PC; we understood its signal processing and classifier and rebuilt both in C, so the FFT and the decision now run on the headband's own microcontroller.

Render of the EEG headband with three dry forehead electrodes and the electronics pod at the back
Sector
Medtech
Year
2020
Our role
Hardware, firmware and DSP
3Leads
On the MCUProcessing
Python to CAlgorithm
01 / The challenge

From a notebook to a microcontroller.

The client had a working fatigue model, but it was Python that needed a computer, floating point libraries and recordings sent off the head. A wearable has to decide on its own, in real time, on a small battery.

Porting it meant more than translating code. Every filter, window and feature had to give the same answer on a microcontroller with a fraction of the memory and processing, or the classifier would drift from what the client had validated.

02 / Our approach

Understand, port, verify.

  1. 01

    Three lead headband

    Dry forehead electrodes on a soft band, with a low noise analog front end and the electronics in a small pod at the back.

  2. 02

    Understanding the algorithm

    We worked through the client's Python line by line, the DSP chain from filtering and windowing to band power, and the classifier that turns those features into a fatigue score.

  3. 03

    Python to C

    We rewrote the chain in C for the MCU, with a fixed size FFT, memory planned up front and no dynamic allocation, so it runs within a fixed time per window.

  4. 04

    Matching the reference

    The same recordings ran through the Python and the C versions, and the band powers and fatigue scores were compared until they matched.

Two phone screens of the fatigue app: a rising fatigue index with the three EEG leads, and trends with band power
Fig 1 · Fatigue app, live and trends
03 / The outcome

The decision, on the head.

The headband computes the FFT, band powers and fatigue score itself and only sends results, which keeps the radio quiet and the battery small. The client's algorithm now runs where it is needed, without a computer in the loop.

EEGDSPFFTPython to CEmbedded ML

Your project could be next.