fbpx

IoT Health Monitoring System

ECG is the process of producing an electrocardiogram (ECG or EKG), a recording – a graph of voltage versus time – of the electrical activity of the heart using electrodes placed on the skin.

It’s important to have a continues monitoring ecg of a subject during critical condition, Connecting ecg with esp8266 opens a gateway to have a continues monitoring of subject ecg from remote locations. 

Block Diagram

Flow Chart

Component Required

  1. Node MCU.
  2. Heart Rate Monitor
  3. Jumper wire
  4. BreadBoard

Software Required

  1. MIT App inventor – Android
  2. Firebase
  3. Arduino 

Circuit diagram

Firebase

Login To firebase

  • create new project
  • Create database for ECG monitoring device
  • Set firebase security rules to test mode to allow esp8266 to set and read database
  • Set Rules of fire base to read and write in real time database
  • Select Real-time Database 
  • Copy the URL- Required in code as fire base host-id to communicate with fire base
  • Click to add child to Create a field to hold data in firebase
  • Create ECG value field to hold ECG data in firebase.
  • ECG field in realtime database hold ECG data.
  • Get authentication id from firebase.

Android Application:

  • Create New project from mit app inventor for ECG monitoring
  • Select layout to place the userinterface component
  • Create a header from the Android application: 

                 drag and drop label in the screen for app header

  • Add firebase component to app

Logic for ECG

Android App

Code

 #include <ESP8266WiFi.h>
#include <FirebaseArduino.h>
#define FIREBASE_HOST " "
const char* ssid = "IMAKE"; // Your ssid
const char* password = "12345678"; // Your Password
#define Lo_PLUSE 10
#define Lo_MINUS 11
#define ECG A0
void setup()
{
pinMode(Lo_PLUSE, INPUT);
pinMode(Lo_MINUS, INPUT);
pinMode(ECG, INPUT);
Serial.begin(115200);
delay(100);
dht.begin();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi is connected");
Serial.println(WiFi.localIP());
delay(1000);
Firebase.begin(FIREBASE_HOST);
}

void loop()
{
int ECG_sensor_value = analogRead(ECG);
if ((digitalRead(Lo_PLUSE) == 1) || (digitalRead(Lo_MINUS) == 1)) {
Serial.println('x');
}
else {
// send the value of analog input 0:
Firebase.setString("ECG", ECG_sensor_value);
}
delay(1000);
} 

Leave a Reply

Your email address will not be published. Required fields are marked *