FlexNIRS - Cerebral Monitoring App for Harvard Medical


Pain Point
FlexNIRS is a low-cost wearable cerebral oximeter developed at Massachusetts General Hospital. The device monitors brain oxygen levels via near-infrared spectroscopy (NIRS), but needed a mobile app for data collection. The research team needed both a detailed interface for experienced researchers and a simplified mode for assistants running routine studies.
Solution
We built a Flutter app for iOS and Android that connects to FlexNIRS via Bluetooth Low Energy. The app has two modes: Expert mode with full signal visualization, raw data access, and advanced configuration; Non-Expert mode with guided setup and simplified controls for research assistants. Real-time charts show cerebral oxygenation (SO2) data at 100 Hz. The app handles device pairing, data logging, and provides immediate feedback on signal quality.
Keeping the connection alive
Streaming SO2 data at 100 Hz over BLE is not a matter of reading a characteristic in a loop. At that rate the connection interval, the MTU and the packet structure all have to be negotiated deliberately, or the phone starts dropping samples in ways that look like noise in the signal rather than a transport problem.
The harder problem is what happens outside the lab. A research assistant locks the phone, walks to another room, comes back. iOS suspends the app, the connection drops, and unless the app is built to expect this it comes back with a gap in the recording and no indication that anything went wrong. We handled it with background modes declared for the specific use case, state restoration so the system can relaunch the app and hand the connection back, and reconnection logic that backs off instead of retrying aggressively and getting throttled.
For a research device this matters more than usual. A gap in a dataset is not a bug the user notices immediately. It is a bug they discover weeks later, when the study is already done.
Two users, one app
The research team had two very different users. An experienced researcher needs raw signal access, full configuration, and the ability to see when data quality is degrading. An assistant running a routine study needs to attach the device, confirm it is working, and press record.
Building one interface for both would have failed both. We built two modes with a shared data layer underneath: same acquisition pipeline, same logging, different amount of the machine exposed. Expert mode shows raw channels and configuration. Non-expert mode gives a guided setup and a single signal quality indicator that tells you whether the placement is good enough to start.
This is a pattern that comes up in almost every medical device app we have worked on. The person operating the device and the person interpreting the data are rarely the same person.
Results
Highlights
- Bluetooth Low Energy connection to FlexNIRS wearable
- Expert mode: full signal visualization and raw data access
- Non-Expert mode: guided setup for research assistants
- Real-time cerebral oxygenation (SO2) charts at 100 Hz
- Signal quality feedback and data logging
Category
Client
Harvard Medical School
Sector
Healthcare
Technology
Flutter
Tech Stack
Status
In use at Mass General
About the Project Lead

Pierluigi Raffone
15+ years of experience
Engineer and entrepreneur with 15+ years in electronics, firmware, and IoT. Bridges hardware and software to create connected experiences.




