IoT based Patient Telemetry Monitoring System using ESP8266, MAX30100 and Blynk Android Application



Abstract

Ever wanted to monitor the oxygen saturation level and heart rate of an individual without physically present there? want to see these parameters on your mobile phone anywhere any time? The most important point, in this era of the Covid-19 pandemic, want to decrease the risk of contact with a covid-19 patient? 
Then I have designed a Telemetry (IoT) system for this purpose. The setup consists of an ESP8266 microcontroller, MAX30100 SpO2 sensor, and Blynk android App. In this system, ESP8266 reads the Oxygen saturation level (SpO2) and heart rate from the MAX30100 sensor, then sends this data to Blynk cloud through Wi-Fi, from there the Blynk android app access this data and displays it. a wifi connection is needed for this project.

Data Flow



Requirements

  • Microcontroller ESP8266 nodemcu
  • Breadboard
  • Blynk android application
  • MAX30100 SpO2 Sensor
  • Jumper wires

Circuit Connections


Code

You can download the code from the GitHub page.

 /*************************************************************
 visit for this project 
 https://nhjamali.blogspot.com/2021/03/patient-telemetry-monitoring-system.html
 visit https://nhjamali.blogspot.com/ for more projects
 App project setup:
     Value Display widget attached to V7
     Value Display widget attached to V8
  *************************************************************/
 #include <ESP8266WiFi.h>
 #include <BlynkSimpleEsp8266.h>
 #include <Wire.h>
 #include <MAX30100_PulseOximeter.h> 
 
 // You should get Auth Token in the Blynk App. Go to the Project Settings (nut icon).

 char auth[] = "YourAuthToken";  
 char ssid[] = "YourNetworkName";   // Your WiFi credentials.
 char pass[] = "YourPassword";      // Set password to "" for open networks.

 PulseOximeter pox;
 BlynkTimer timer;

 // This function sends ESP8266's up time every second to Virtual Pin (7).
 // In the app, Widget's reading frequency should be set to PUSH. This means
 // that you define how often to send data to Blynk App.
 void sendSensor()
 {
   float BPM = pox.getHeartRate();
   float SpO2 = pox.getSpO2();
  
   if (!pox.begin())
     {
         Serial.println("FAILED to connect with Pulse-Oximeter MAX30100");
         for(;;);
    }
    else
    {
         Serial.println("Successfully connected to sensor");
    }
   // You can send any value at any time.
   // Please don't send more that 10 values per second.
   Blynk.virtualWrite(V7, BPM);
   Blynk.virtualWrite(V8, SpO2);
 }

 void setup()
 {
   // Debug console
   Serial.begin(9600);
   Blynk.begin(auth, ssid, pass);
   // Setup a function to be called every second
   timer.setInterval(1000L, sendSensor);
 }

 void loop()
 {
   Blynk.run();
   timer.run();
   pox.update();
 }

Libraries

You may also need some libraries for this code. ESP8266Wifi.h can be downloaded from this link. other libraries can be downloaded from the library manager of Arduino IDE. if you can not find them on IDE or online just comment below and I'll share a link with you to that library.
If you do not have esp8266 boards downloaded previously on Arduino IDE then also download them 
by going to => tools => board select => boards manager => type in search and download.


Blynk Android App

When you download and open the Blynk android app, it will look like this:


So select a new project, write the name of the project. then select the controller you have, in our case it is ESP8266. Then select the medium of communication (Wi-fi). now click create.



Now you'll receive an auth token on your email linked to your Blynk account. Copy and paste it to code.





After Pressing ok, you will see the newly built app screen which is empty. Click the + button in the heading and you will see a menu of different components to be used in app development.



Scroll down and select and drag two gauge meters to the app screen.


Click on gauge meter, in the detail section write the same PIN no. as in the code and write the minimum and maximum value, and select colors. Do this for the second gauge also. In the end Power up the ESP8266 and click the play icon in the Blynk app. If the device is successfully connected, then there be a labeled 'ONLINE' green tick in the app with the app name.


You can also build so many different IoT projects with the Blynk app and ESP8266 like Home automation. 

Comments