federunco / BreathSense

A novel IoT Pulse Oximeter to cope with COVID-19 pandemic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BreathSense



Table of Contents

Introduction

This repo contains the Hardware (Mechanical, Electronics, and Firmware sources) of BreathSense, a novel IoT Pulse Oximeter to cope with the COVID-19 pandemic.

Italy was one of the first countries to enter lockdown due to COVID-19, in less than 15 days there were so many deaths that hospitals couldn't handle a whole lot of coffins, entrusting the army to take them out the hospitals.


Italian army carring COVID victims' coffins out - Credits Nexilia.it

The maker community worked hard from the very beginning to make open-source emergency ventilators, some of them making very complex designs, to help the most critical cases.

I also wanted to help out, but I'm not a physician, and the little knowledge in Medicine I have is biosignal processing, so why not build an Open Source Pulse Oximeter to read remotely vital parameters of the patients?

If we minimize exposure with infected people with remote examinations we could limit the contagion even better.

Technical description

BreathSense is an ESP32-based Pulse Oximeter that reads LED reflection values from a Maxim MAX30100 sensor. Based upon publicly available SpO2 (Oxygen Saturation) calculation algorithms and open source libraries, the sensor sends to an MQTT Broker (based on AWS IoT Core) the SpO2 and beats per minute (bpm)

To reduce Broker overload, BreathSense starts vital params transmission only when the Web Client has enabled PPG transmission on the device and the finger is placed properly on the sensor.

Patient privacy/security is a must in medical devices: for better security, MQTT is served over SSL and all devices are authenticated via an AWS IAM Policy to restrict access to their only topic, the Web Client has a strong authentication scheme to mitigate web attacks, no SpO2 nor BPM is stored on the BreathSense servers, but is elaborated on the Client via temporary access keys generated by the server during login.

The included BreathSense_MAX30100 library is largely based on https://github.com/xcoder123/MAX30100, even if some algorithms were tweaked a bit to enhance performances.

To configure BreathSense Firmware for your endpoint, edit the contents of "config.h" and "secrets.h" to match your configuration.

Protocol

The device communicates with the Web Client via 4 different topics:

breathsense/[device_id]/device breathsense/[device_id]/bpm breathsense/[device_id]/spo2
breathsense/[device_id]/ppg

Where [device_id] is the Pulse Oximeter PHY MAC Address, available via the serial debug interface @ 115200 baud

All data transmitted is encoded in JSON.

Device topic

The only topic where BreathSense device can subscribe, it manages device settings remotely. To start the communication with the Web Client, the following packet is sent from the Client:

{
  "command": "pingRequest"
}

The device will immediately send an acknowledgment and the finger status (if it is positioned properly), if the Web Client doesn't receive an ACK after 10 seconds it will timeout.

The PPG waveform is disabled by default to limit throughput, it can be enabled/disabled via the following packets:

{
  "command": "enablePPG"
}

{
  "command": "disablePPG"
}

BPM, SPO2, and PPG Topics

Here BreathSense writes its actual data. The content is JSON encoded and formatted as following

{
      "bpm": data<int>
}

{
      "spo2": spo2<float>
}

{
      "ppg": ppg<float>
}

Web client

BreathSense Web Client provides an easy-to-use web interface to monitor patients remotely, there are 2 levels of users, administrator and doctor: the admin can add users (doctors), remove them and reset their passwords, while every user can change their password, add a patient, start monitoring them and delete the patient after he has recovered.

The Web Client is made for a LAMP stack, an example database is provided on Web Client/db.sql (remove db.sql on production servers!!!)

To configure the Web Client, edit config.php properly to match your AWS configuration. Currently the BreathSense Client strings are written in Italian, I will translate them in English later on, sorry about that.

BOM

Currently, BreathSense is based on an ESP32 dev board and a MAX30100 breakout board, in the future (maybe if someone wants to contribute) I could design an all-in-one PCB in KiCad (even if I prefer Allegro).

Special thanks

A huge thank to all Doctors, Nurses, Healthcare Workers, or anyone who is risking their lives every day to save other lives. You are the true heroes.

License

Authors / Copyright

2020 (c) Federico Runco

Third-party component licenses

Tools

Name License
Arduino GNU GPL Version 2
arduino-esp32 MIT License
Bootstrap MIT License

Libraries

Name License
MAX30100 library MIT License
PubSubClient MIT License
ArduinoJson MIT License
JQuery MIT License
Popper-Core MIT License
Paho-MQTT Not defined

License details

BreathSense Firmware and Web Client are released in license under GNU GPL Version 3, whilst Schematics / Mechanics are released under CERN Open Hardware Licence v1.2, please see LICENSE file for further details.

About

A novel IoT Pulse Oximeter to cope with COVID-19 pandemic


Languages

Language:PHP 69.1%Language:C++ 25.5%Language:C 3.1%Language:TSQL 2.3%