0% found this document useful (0 votes)
5 views

IOT based ECG monitoring system using node MCU

Uploaded by

Suba Selvi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

IOT based ECG monitoring system using node MCU

Uploaded by

Suba Selvi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

IOT based ECG monitoring system using

node MCU
Description
In recent years, heart disease is becoming a major health concern issue.
As per studies of WHO (World Health Organization), many people die out of heart
disease. So, designing an health monitoring device which will enable doctors with
quicker, smarter and effective methods for diagnosis. Here, Our main aim is to
monitor the heart rate using AD8232 ECG sensor. This sensor helps in measuring
the electrical activity of the heart and the analog output of node MCU is sent to the
IOT cloud (Thing Speak) through ESP8266 (WiFi module) for further processing
of data in the cloud.

Hardware Required:

Node MCU ESP 12E


Cable for node MCU
ECG Module (AD8232)
ECG Electrodes
ECG Electrode Connector
Breadboard
Connecting wires

Software Required:

Arduino IDE

ThingSpeak – an open source IOT platform

Procedure:

1. Connect the 3.3v and GND pin of AD8232 ECG sensor to the node MCU 3v
and GND pin respectively and also power up your node MCU using the
cable.
2. Connect the output pin of AD8232 ECG sensor to Analog pin A0 of node
MCU.
3. Connect the L0- (Leads off detect-) and the L0+ (Leads off detect+) to the
digital pins D7 and D8.
4. Place the 3 electrodes of which one electrode on left hand, other is on right
hand and the final one in left leg.

5. Once the hardware is set up is over, our next aim is to upload the sensor data
to Thing speak channel by creating the channel ID and API key.

6. The next step is to create our ThingSpeak Channel. For that, Go


to https://thingspeak.com/ and create your ThingSpeak Account.

7. Create a Channel by clicking ’New Channel’.


8. Enter the channel details like name (related to your project), description
(optional) and save this setting.

9. Now you can see the channels. Click on the ‘API Keys’ tab. Here you will
get the Channel ID and API Keys. Note this down.
10.Next step is to Open Arduino IDE and Install the ThingSpeak Library. To do
this go to Sketch>Include Library>Manage Libraries. Search for
ThingSpeak and install the library.

11. Now we need to modify the code with your corresponding credentials. In the
below code you need to change your Network SSID, Password and your
ThingSpeak Channel and API Keys. Replace the following content in the code,

‘SSID ’ – Your Wi-Fi Name

‘Password’ – Your Wi-Fi Password

‘YYYYYY’ – Your ThingSpeak Channel Number (without Quotes)

‘XXXXXXXXXXX’ – Your Thing Speak API Key.

CODE:

#include <ESP8266WiFi.h>;

#include <WiFiClient.h>;

#include <ThingSpeak.h>;

const char* ssid = "Your SSID Here"; //Your Network SSID

const char* password = "Your Password Here"; //Your Network Password

int val;
int ECGpin = A0; //ECG Pin Connected at A0 Pin of node MCU

WiFiClient client;

unsigned long myChannelNumber = YYYYYY; //Your Channel Number (Without


Brackets)

const char * myWriteAPIKey = "XXXXXXXXXXXXXXX"; //Your Write API


Key

void setup()

Serial.begin(9600);

delay(10);

// Connect to WiFi network

WiFi.begin(ssid, password);

ThingSpeak.begin(client);

void loop()

val = analogRead(ECGpin); //Read Analog values and Store in val variable

Serial.print(val); //Print on Serial Monitor

delay(1000);

ThingSpeak.writeField(myChannelNumber, 1,val, myWriteAPIKey); //Update in


ThingSpeak
delay(100);
}

12.Upload the code. Once it is connected to Wi-Fi the sensor data from A0 pin
of node MCU will start uploading to the ThingSpeak Channel. You can now
open your Channel and see the data changes plotted on the ThingSpeak IOT
platform.

You might also like