Medical IoT gateway
One hub. Several medical devices. No reading left behind.
- My role
- Owned it end to end: firmware architecture, device integration, signal processing, the cloud link, updates and production validation.
- Built with
- Zephyr RTOS · Bluetooth LE · Wi-Fi · MQTT
The problem
People monitored at home often use several devices: an oximeter, a blood-pressure cuff, a thermometer, a sleep sensor. Each one speaks its own Bluetooth dialect.
Care teams need all of those readings in one place, complete and on time. Nobody at home should ever have to fix anything. Home Wi-Fi drops, power cuts happen, and the gateway has to cope with both.
What I built
- Bluetooth LE links to several medical devices at the same time, each with its own protocol handler.
- A message bus (Zephyr zbus) between the Bluetooth, sensor and MQTT modules, so a slow network never holds up a measurement.
- Heart-rate variability worked out on the device from the optical pulse signal: filtering, adaptive peak detection, a physiological check on every beat interval, artifact rejection and sub-sample timing.
- A circular buffer in external flash that holds readings through network outages and replays them in order when the connection comes back.
- Secure over-the-air updates with MCUboot: HTTPS-only transfer, version checks, watchdog protection and update status reported over MQTT.
The hard parts
- Packets lost during waveform capture
- The default Bluetooth connection interval could not keep up with the pulse waveform. The gateway now tightens the interval only while waveform data is flowing, then relaxes it again to save power.
- Boot loops from the flash buffer
- A device that restarts forever is worse than one that is off. Root-caused it in the flash-buffer path and fixed it.
- Data lost during sector erases
- Flash erases whole sectors at a time, and readings that had not been sent yet were going with them. Found it, fixed it.
- Deadlocks on MQTT reconnect
- A reconnect at the wrong moment could freeze the network path. Root-caused and fixed.
- Malformed records breaking replay
- One bad record could hold up everything queued behind it. Root-caused and fixed, so replay stays reliable.
How it was checked
Signed firmware, board-specific CI builds, QA gates before every release, and JTAG flashing on the manufacturing line.
What changed
Readings arrive complete even when the home network misbehaves, and a fix reaches devices already in homes without anyone visiting.
Zephyr RTOSEmbedded CBluetooth LEzbusWi-FiMQTTTLS / HTTPSMCUbootExternal flashSignal processingCI/CD