With this Arduino source code, a MAX30100 Pulse Oximeter module and an ESP32 WiFi module make a WiFi ECG Monitor with Network feature and nice responsive WebApp
Price:
Other projects from this group
This project is an ESP32 WiFi “ECG Monitor” and “Pulse Oximeter” firmware with Chain Network feature. The “Chain Network” is a local network which the devices one by one are connected to the each other.
This project is based on the “ESP32 WebApp Builder” project which is a base source code with the chain network feature.
There are the following files in this project:
The MAX30100 is an integrated pulse oximetry and heart-rate monitor sensor solution. It combines two LEDs, a photo-detector, optimized optics, and low-noise analog signal processing to detect pulse oximetry and heart-rate signals.
The MAX30100 communicates with ESP32 via two wire (I2C) interface.
In this project, GPIO4 works as the I2C SDA and the GPIO 5 works as the I2C SCL. Use the following schematic for the connections:
The schematic is simple, either you can place both of the ESP and MAX30100 module (e.g. including two 1.5V battery) in an enclosure or in two different enclosures and connect the MAX30100 to the ESP via a 4-wires cable.
The “Chain Network” is a local network which the devices one by one are connected to the each other (Series). In the chain network, the first device is the master of network. The starter (either the master or the last joined module) is directly connected to the WebApp. It sends the command to the next device, and the next device sends it to the next one till the last device. The last device response will be sent to the first device and finally the WebApp via the middle devices.
First of all place your top of your finger on the MAX30100 sensor’s eye and then open the root page.
The WiFi ECG project has a nice and responsive web application which is placed in the root page address (192.168.4.1 by default and can be set to 192.168.5.1 or you can use the router’s DHCP IP).
The graphs update in every 6 seconds. That means the graphs show the values which has been captured 6 seconds ago.
The green value (HR) is the average heart-rate value of the last 6 seconds in “Beats Per Minute” (BPM) unit.
The purple value (BP) is the blood pressure “Systolic” (SYS) and Diastolic (DIA) values in the mmHg unit.
The blue value (SPO2) is the percent of saturated oxygen in the blood.
The yellow value (Temp) is the temperature of sensor (which should be equal with the finger’s top temperature) in the Celsius unit.
There are 2 toggle buttons under the monitor screen:
And 2 push buttons:
This web application is also compatible with cell phone and mobile device browsers
The Web Application is divided to 3 menus. The menus can be selected by click on the menu button
“ECG” refers to the WiFi ECG monitor page, “HR-SPO2” refers to the Network Pulse Oximeter and heart-rate page and “Settings” refers to the settings page.
In the “HR-SPO2” page, there are 16 channel rows of the volt meters result. That means you can add up to 16 devices to the chain network and see the values at the same time.
In the above picture, only three devices (CH0, CH1 and CH2) are connected to the network.
The “HR-SPO2 Network Channel” can be set in the settings menu.
The web application’s settings menu has been divided to 5 parts:
For the programming, use the pre-defined functions in the files which start with “user”.
Add your start-up script to the “userInit()” function in user_init.ino file. No need to do wifi or server configuration. This configuration already have done in the firmware system files (e.g. systemInit() and setup()).
The “userLoop()” function (user_loop.ino) calls repeatedly (like arduino “loop()” function), If your program needs to execute a statement repeatedly (e.g. reading a sensor’s data), insert your script in this function.
The “webapp.h” file is the root page’s script. You can customize sWebApp variable in that file if you’re going to make changes in the Web UI.
Also you can customize the “userGetSettings()” function (user_settings.ino), for adding more settings to the firmware. The WebApp execute this function when you click on the Settings menu.
After you click on the SAVE button of the user-defined settings, the “userSetSettings()” functions will be called.
The settings will not be shared in the network and each device has its own settings.
The “userMainInit()” in the “user_main.ino” file, calls once and only just in the network starter when you click on the “ECG” menu (or initially after loading the root page). You can initiate the uiAppData (which is the offset values in this project) in this function.
The “userMain()” in the “user_main.ino” file, calls intervally.
The “userSubInit()” in the “user_sub.ino” file, calls once and only just in the network starter when you click on the “HR-SPO2” menu.
The “userSub()” in the “user_sub.ino” file, calls intervally. The WebApp will send the uiAppData to this function and then it can be transferred in the chain network.
The “userGlobal()” function in the “user_global.ino” file calls at the same time in all of the devices in the chain network after the “CMD delay” time.
In the AC.h file, if you remove “#define LOG_ENABLE”, the logs will not be shown and the log memory would be released.
In the user_global.h file, you can set the default I2C pins and speed by the following “define” variable:
#define SDA_PIN%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; 4
#define SCL_PIN%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; 5
#define I2C_SCL_FREQ%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp;%26nbsp; 100000
#define I2C_SLAVE_ADDR%26nbsp;%26nbsp; 0x57
If you “un-log” this parameter: #define MAX30100_TEST_MODE, the device will turn on in test mode, which shows IR and Red LED values only in the serial monitor. These two values should be close to each other (less than 3000 unit difference).
By changing the LED power in the following line, the values will change:
#define LED_CONFIG_VAL%26nbsp;%26nbsp;%26nbsp;%26nbsp; RED_LED_11_MA|IR_LED_11_MA
It’s pretty important that how the finger is placed on the MAX30100 Sensor’s eye to receive correct and accurate values.
1.1
- The Web Ui upgraded
- The heart-rate diagram upgraded
- blood pressure diagram and calculations added
- 4 Buttons and features added
- Network pulse oximeter added
1.0
- Calculating SPO2
- Calculating Heartbeat-Rate
-Designing the ECG page
-Printing the diagrams