Recent research shows that it is necessary to monitor the blood Oxygen saturation (SpO2) of people COVID-19 patients. For people with no or mild symptoms, the oxygen level in blood can drop to dangerous levels without any signs. This is an alarm for immediate medical assistance. Finger based pulse oximeters are in high demand for the same reason. However data-logging and remote monitoring is difficult with them.
This is a inexpensive DIY tool to monitor HRM and SpO2 with NodeMCU - ESP8266 and MAX30100 - a board from Maxim instruments. The readings are sent to Cayenne platform which can be seen online through browser by others. Data is also stored in the flash memory of NodeMCU, so data logging in absence of WiFi connection is possible. Enabling monitoring while doing outdoor activities.
A detailed description about the code is at GitHub: https://github.com/VU2MEV/MAX30100_NodeMCU_SPIFFS_IOT
When powered with mobile using a OTG cable, the project is completely mobile, hence the blood oxygen saturation and heart rate can be monitored while moving around or while doing any sporting activity like running, cycling, etc.
What’s Connected- NodeMCU ESP8266
- MAX30100
- WiFi.
Install ESP8266 core in Arduino IDE. Ensure that the NodeMCU is communicating well with the PC.
Initialise SPIFFS and install sketch uploader in Ardino IDE as described here. Install the needed libraries for MAX30100 (master) and Cayenne MQTT.
Create a Cayenne login and create a project as shown in the video below and note the MQTT credentials. We need to insert these credentials in the code.
Put your wifi network credentials here. Followed by the MQTT credentials you got for your device in mydevices.com/cayenne
// WiFi network info.
char ssid[] = "wifi_ssid";
char wifiPassword[] = "wifi_password";
// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "MQTT-NAME";
char password[] = "MQTT-PASSWORD";
char clientID[] = "MQTT-CLIENTID";
To get reliable readings try different current settings for IR LED. Since different people have different skin thickness, color, blood density, it is better to adjust the value to where you get stable heart rate reading.
pox.setIRLedCurrent(MAX30100_LED_CURR_24MA);
Set File name for the file that you will store in the flash memory of NodeMCU. The mode is "a" for append, so that you retain the data after replugging the device.
File file = SPIFFS.open("/HR_test.txt", "a");
Data is sent to channel 0 and channel 1 in Cayenne.
Cayenne.virtualWrite(0, BPM, "counter","null" );
Cayenne.virtualWrite(1, SpO2, "O2", "p");
Data is stored in Cayenne project which can be visualised as graph or values. The data in flash memory can be printed on the serial monitor by uploading the SPIFFS read file code from Example tab in IDE. Remember to replace the filename with what you have given.
Additionally in the main code, one can attach a I2C display and read the values on it locally.
Triggers & AlertsAlerts can be set in Cayenne dashboard as required.
Footnote:
If your MAX30100 doesn't turn on even with the basic MAX30100_Minimal example sketch, please check online the hack to pull SDA and SCL pins to 3.3V via the on board 4.7Kohms resistors. There's no need to remove the smd resistors, only disconnect the regulator o/p and connect 3.3V there.
Dashboard ScreenshotsCayenne Dashboard:
Comments
Please log in or sign up to comment.