In today’s blog post, we will discussing how to design and construct a cardiovascular disease detection and prevention project. This project work uses some inexpensive modules to device an non-invasive technique to take body temperature readings, Electrocardiograph (ECG), pulse rate reading, and blood glucose reading, Cholesterol level and blood pressure.
To design a non-invasive technique to detect and prevent these cardiovascular disease we needed to make sure we can read these health parameters effectively. As always said in science, we go from the known to the unknown.
Cardiovascular diseases (CVDs) remain a leading cause of death globally, emphasizing the need for effective detection and prevention methods. Traditional monitoring systems, often invasive, can be uncomfortable and impractical for continuous monitoring. The advent of IoT (Internet of Things) and advancements in non-invasive technology have opened new avenues for real-time cardiovascular health monitoring. This blog post explores an exciting project that combines Arduino with non-invasive techniques to detect and prevent cardiovascular diseases
In the digital age, health monitoring has evolved significantly, thanks to innovations in technology. Non-invasive monitoring techniques are at the forefront, offering a painless and convenient way to track vital signs. This blog post delves into an IoT-based project using Arduino, focusing on non-invasive detection of cardiovascular diseases. This system aims to provide real-time data on heart health, enabling early diagnosis and timely intervention.
Non-invasive monitoring refers to techniques that do not require penetration of the skin or body cavities. These methods are less painful, reduce the risk of infection, and are generally more comfortable for continuous monitoring.
Cardiovascular diseases encompass a range of conditions affecting the heart and blood vessels, including hypertension, heart attacks, and strokes. Early detection and continuous monitoring are crucial for effective management and prevention.
For this project, an Arduino Uno and a NodeMCU board. This choice was ideal due to its ease of use and extensive support community. Most of our sensors were DIY (Do-It-yourself) inexpensive sensor modules. Whereas, the ones we couldn’t get due to cost, we fabricated it using the techniques required for it.
ITEM DESCRIPTION | QUANTITY |
NodeMCU | 1 |
JUMPER WIRES | 2 SETS |
RESISTORS | 6 |
ARDUINO UNO | 1 |
CASING | 1 |
VERO BOARD | 1 |
ECG SENSOR MODULE | 1 |
SOLDER | 1 |
CUSTOM CHOLESTEROL MODULE | 1 |
2004 LCD MODULE | 1 |
LiPo BATTERY CHARGER | 1 |
LiPo BATTERY | 2 |
LED | 1 |
DS18B20 TEMPERATURE SENSOR | 1 |
GLUE GUN | 1 |
FEMALE HEADERPIN | 2 |
RED SWITCH | 1 |
MISCELLANEOUS |
The table above shows the rest of the components and modules needed for this project design. The bill of materials talked about a custom cholesterol level detection module. This was designed by applying the Beer-Lambert technique using optical method of Infrared radiation and light absorption technology. You can read more here Non-Invasive Glucose and ECG levels Monitoring Arduino.
The ECG sensor captures the electrical signals generated by the heart. It detects the PQRST waves, representing different phases of the cardiac cycle. These signals are crucial for diagnosing heart conditions.
This module made it very possible for us to read the electrocardiogram using the non-invasive approach for a very reduced cost implications. The sensor worked very well with the Arduino Uno board that was available for programming the sensor module itself.
The pulse sensor detects blood flow through the arteries, providing real-time heart rate data. It uses an LED and photodiode to measure the pulse by detecting changes in light intensity caused by blood flow.
This module uses an oximeter to measure the pulse of the person’s pulse rate. The sensor measures the rate of oxygenated blood that flows through the fingers where the infrared sensor is placed. This is because the blood flow casts a shadow each time, the hearts pumps blood through the body.
Temperature sensors help monitor body temperature, a critical parameter in diagnosing heart-related conditions like fever or infection-induced heart strain. We used the DS18B20 temperature sensor, the waterproof type to take the precise body temperature. The temperature sensor is a factor that we need that is related to the glucose measurement.
The Glucose level of the was measured using the technique adopted by schematic diagram shown above. The setup diagram was drawn on fritzing IDE, the breadboard version. Here we used the types of LED for the design and a photocell to represent the emitters of different spectrum of light needed and the sensor that would detect the reflected light through the human skin respectively. According to Beer-Lambert’s law.
According to the Beer-Lambert’s law, as infrared light passes through the material, the intensity of light exponentially decays because it is absorbed by molecules of material. Thus based on Beer-Lambert’s law, a single wavelength is selected for glucose concentration evaluation and by using absorption theory glucose level is predicted.
To measure the cholesterol level, the laser and the photocell was added to the circuit as shown in fig 4.15 above. Using the methodology stated above, We used the Arduino code snippet to determine the cholesterol level.
To design the blood pressure for the person using a non-invasive method, We adopted the approach presented in this paper that shows the relationship between Electrocardiographic changes and blood pressure. According to the publication, Elevated blood pressure induces electrocardiographic changes and is associated with an increase in cardiovascular disease later in life compared to normal blood pressure levels.
A library DFRobot_ECG was created that made life easier. It allowed us to use the temperature readings and call some function that would produce the BP based on the calculations and formula shown in chapter 3. We converted the read ECG valued to BP by calling these functions and also summing the SBP and DBP together and dividing by 3 as shown in code line 43.
#include <EEPROM.h>
#include <SoftwareSerial.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#include <LiquidCrystal.h>
SoftwareSerial mySerial(2, 3); // RX, TX
int sensor[] = {};
//4 pin of uno
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature.
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
#define greenLED 13
#define redLED A4
#define blueLED A5
long randNumber;
float temp, bp, chloe1, chloe2, totalChlr;
int ecg1, ecg, pulseRate, glocoseSensor; //chekRandNumber;
int changeTemp;
void generate(){
randNumber = random(5, 10);
Serial.println(randNumber);
EEPROM.write(0, randNumber);
}
void setup(void){
Serial.begin(115200);
while (!Serial) { ; }
// set the data rate for the SoftwareSerial port
mySerial.begin(115200);
//mySerial.println("Hello, world?");
sensors.begin();
lcd.begin(20,4);
//define the pins for ECG sensor
pinMode(6, INPUT); // Setup for leads off detection LO +
pinMode(5, INPUT); // Setup for leads off detection LO -
//the LEDs
pinMode(greenLED, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(blueLED, OUTPUT);
//print a welcome message
lcd.setCursor(0, 0);
lcd.print(" WELCOME ");
lcd.setCursor(0, 1);
lcd.print(" Mr. Ameh Solomon");
for(int x=0; x<19; x++){
lcd.setCursor(x,2);
lcd.print("*");
delay(200);
}
for(int x=0; x<19; x++){
lcd.setCursor(x,3);
lcd.print("*");
delay(200);
}
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" IoT Based Vascular");
lcd.setCursor(0,1);
lcd.print(" Blood Disease");
lcd.setCursor(0,2);
lcd.print(" Prevention And");
lcd.setCursor(0, 3);
lcd.print(" Detection Project");
delay(4000);
lcd.setCursor(0,0);
lcd.print("Prepping Sensors");
for(int x=16; x<19; x++){
lcd.setCursor(x,0);
lcd.print("*");
delay(200);
}
for(int x=0; x<19; x++){
lcd.setCursor(x,1);
lcd.print("*");
delay(200);
}
for(int x=0; x<19; x++){
lcd.setCursor(x,2);
lcd.print("*");
delay(200);
}
for(int x=0; x<19; x++){
lcd.setCursor(x,3);
lcd.print("*");
delay(200);
}
lcd.clear();
randomSeed(analogRead(A3));
generate();
}
float bodyTemp(){
// Send the command to get temperatures
sensors.requestTemperatures();
Serial.println("Temperature is: ");
// Why "byIndex"? You can have more than one IC on the same bus. 0 refers to the first IC on the wire
temp = sensors.getTempCByIndex(0);
return temp;
}
int ecgSensor(){
ecg1 = analogRead(A0);
if((digitalRead(5) == 1)||(digitalRead(6) == 1)){
Serial.println('!');
}
else{
return ecg1;
}
//Wait for a bit to keep serial data from saturating
delay(100);
}
To get the rest of this code, let us know by sending us a message
#include "ThingSpeak.h"
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
SoftwareSerial nodeMCU(D1, D2);
char ssid[] = "AncII"; // your network SSID (name)
char pass[] = "eureka26"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
WiFiClient client;
unsigned long myChannelNumber = 1685425;
const char * myWriteAPIKey = "IWGFF3L5SEHT38RB";
String myStatus = "field1 equals field2";
const int ledPin = LED_BUILTIN;// the number of the LED pin
// Variables will change:
int ledState = LOW; // ledState used to set the LED
// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0; // will store last time LED was updated
// constants won't change:
const long interval = 1000;
char c;
String dataIn;
int8_t indexOfA, indexOfB,indexOfC,indexOfD,
indexOfE,indexOfF,indexOfG,indexOfH;
String data1, data2, data3, data4, data5, data6,
data7, data8;
void setup() {
Serial.begin(115200);
nodeMCU.begin(115200);
pinMode(ledPin, OUTPUT);
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client); // Initialize ThingSpeak
}
void blinkLed(){
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the LED with the ledState of the variable:
digitalWrite(ledPin, ledState);
}
}
void loop(){
while(nodeMCU.available() >0){
c = nodeMCU.read();
if( c == '\n'){
break;
}
else{
dataIn += c;
}
}
if(c == '\n'){
//Serial.println(c);
parse_data();
//thingspeak send
if(WiFi.status() != WL_CONNECTED){
Serial.print("Attempting to connect to SSID: ");
Serial.println(ssid);
while(WiFi.status() != WL_CONNECTED){
WiFi.begin(ssid, pass); // Connect to WPA/WPA2 network. Change this line if using open or WEP network
Serial.print(".");
delay(5000);
}
Serial.println("\nConnected.");
}
else{
blinkLed();
}
// set the fields with the values
ThingSpeak.setField(1, data1);
ThingSpeak.setField(2, data2);
ThingSpeak.setField(3, data3);
ThingSpeak.setField(4, data4);
ThingSpeak.setField(5, data5);
ThingSpeak.setField(6, data6);
ThingSpeak.setField(7, data7);
ThingSpeak.setField(8, data8);
// figure out the status message
// if(data1 > data2){
// myStatus = String("field1 is greater than field2");
// }
// else if(data1 < data2){
// myStatus = String("field1 is less than field2");
// }
// else{
// myStatus = String("field1 equals field2");
// }
//
// set the status
ThingSpeak.setStatus(myStatus);
// write to the ThingSpeak channel
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if(x == 200){
Serial.println("Channel update successful.");
}
else{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
// change the values
// data1++;
// if(data1 > 999){
// data1 = 0;
// }
Serial.println("data 1= " + data1);
Serial.println("data 2= " + data2);
Serial.println("data 3= " + data3);
Serial.println("data 4= " + data4);
Serial.println("data 5= " + data5);
Serial.println("data 6= " + data6);
Serial.println("data 7= " + data7);
Serial.println("data 8= " + data8);
Serial.println("............................");
delay(20000); // Wait 20 seconds to update the channel again
c = 0;
dataIn = "";
}
}
void parse_data(){
indexOfA = dataIn.indexOf("A");
indexOfB = dataIn.indexOf("B");
indexOfC = dataIn.indexOf("C");
indexOfD = dataIn.indexOf("D");
indexOfE = dataIn.indexOf("E");
indexOfF = dataIn.indexOf("F");
indexOfG = dataIn.indexOf("G");
indexOfH = dataIn.indexOf("H");
data1 = dataIn.substring(0, indexOfA);
data2 = dataIn.substring(indexOfA+1, indexOfB);
data3 = dataIn.substring(indexOfB+1, indexOfC);
data4 = dataIn.substring(indexOfC+1, indexOfD);
data5 = dataIn.substring(indexOfD+1, indexOfE);
data6 = dataIn.substring(indexOfE+1, indexOfF);
data7 = dataIn.substring(indexOfF+1, indexOfG);
data8 = dataIn.substring(indexOfG+1, indexOfH);
}
This code connects an ESP8266 WiFi module (NodeMCU) to the internet and sends data to a website called ThingSpeak.
Here’s a breakdown of the functionality in 3 parts:
parse_data
function to extract eight data values separated by specific characters (likely letters A to H).indexOf
function to find the positions of these characters.substring
function. These eight substrings are assigned to variables data1
to data8
.We used the NodeMCU board to use its Wi-Fi capability to send data to a cloud server of thingspeak. This would allow us to view and monitor the reading remotely using HTTP protocol.
We ensured the sensor is properly placed on the skin to get accurate readings. and we place the pulse sensor and glucose sensor on a fingertip for best results. Using the temperature sensor DS18B20, we didn’t need to much, its result was very closer to known clinical thermometer reading we had earlier.
The IoT-based cardiovascular disease detection and prevention project using Arduino and non-invasive techniques is a groundbreaking approach to heart health monitoring. By leveraging modern technology, this system promises to enhance the early detection and prevention of cardiovascular diseases, making health monitoring more accessible and efficient. As technology continues to evolve, the integration of IoT and non-invasive techniques will undoubtedly play a pivotal role in transforming healthcare.
embracing imperfections Let’s talk about something that touches each of our lives in one way…
The Cold War: A Tense Standoff Introduction The Cold War was not just a period…
The Birth of Bitcoin Introduction In a world where traditional finance often feels cumbersome and…
The Broken Mute’s Revenge In "The Broken Mute's Revenge," the story revolves around a young…
Introduction Imagine a classroom where students take the reins of their own education, setting their…
Introduction Imagine stepping into a classroom where every lesson is meticulously crafted, not just with…
This website uses cookies.