Arduino Projects

DIY Non-Invasive Blood Pressure and Cholesterol Level Monitoring

In today’s tutorial we look at designing a non-invasive method for detecting and measuring blood pressure and cholesterol in the body. Monitoring your health is more important than ever, and with advancements in technology, it’s now possible to build your own non-invasive blood pressure and cholesterol monitoring system at home. In this blog post, we will guide you through a step-by-step process on how to create this project using Arduino, making health monitoring accessible and affordable. Let’s dive in!

Non-invasive blood pressure and cholesterol monitoring

The Need for DIY Health Monitoring

You can read about how this project is among other non-invasive detection techniques here too. Non-invasive monitoring techniques are crucial because they eliminate the discomfort and risks associated with invasive procedures. Traditional methods for checking blood pressure and cholesterol often involve needles and laboratory tests. Non-invasive techniques, however, use sensors and algorithms to provide accurate readings without penetrating the skin, making the process much more user-friendly and less daunting.

Benefits of DIY Health Projects

DIY health projects offer several advantages. They are cost-effective, as they often use affordable components and open-source software. Additionally, they provide educational value, enhancing your understanding of how health monitoring devices work. DIY projects also offer customization, allowing you to tailor the system to your specific needs and preferences.

Components Needed for the Project

Arduino: The Heart of Your Monitoring System

Non-invasive blood pressure and cholesterol monitoring: The Arduino and NodeMCU board.

Arduino is a versatile microcontroller platform that serves as the brain of your DIY monitoring system. Its ease of use, wide range of compatible sensors, and extensive online community support make it an ideal choice for this project.

Choosing the Right Sensors

For this project, we will use:

  • Pulse Sensor: This sensor measures your heart rate by detecting blood volume changes in the microvascular bed of tissue. We used a pulse sensor from DFrobots for this measurement.
  • Pressure Sensor: This sensor helps in estimating blood pressure by capturing the pulse wave transit time (PWTT). We built a custom sensor for this.
  • Cholesterol Sensor: While direct non-invasive cholesterol measurement is challenging, we can use a custom built glucometer sensor as a proxy to estimate cholesterol levels based on blood glucose levels, with necessary adjustments and algorithms.

Additional Components

  • ESP8266-12E NodeMCU development: For wireless connectivity and data transmission to the cloud of thingspeak.
  • LCD Screen: For real-time data display.
  • Veroboard and Jumper Wires: For prototyping connections, soldered connection and permanent connection that would hold the modules and components together.
  • Power Supply: To power the Arduino and sensors.

Building the Monitoring System: The Circuit Diagram

Monitoring cholesterol level

Setting Up Arduino and Sensors

Arduino Setup: Begin by setting up your Arduino Uno on a stable surface. Ensure that you have installed the necessary Arduino IDE on your computer.

Connecting the Pulse Sensor:

  • Connect the VCC of the pulse sensor to the 5V pin on the Arduino.
  • Connect the GND of the pulse sensor to the GND pin on the Arduino.
  • Connect the Signal output of the pulse sensor to the A0 analog input on the Arduino.

Connecting the Pressure Sensor:

The pressure sensor was custom built and we had to also made it have a pinout that we can easily connect the sensor module to the Arduino Uno board.

  • Connect the VCC of the pressure sensor to the 5V pin on the Arduino.
  • Connect the GND of the pressure sensor to the GND pin on the Arduino.
  • Connect the Signal output of the pressure sensor to the A1 analog input on the Arduino.

Connecting the NodeMCU:

Monitoring blood pressure and cholesterol level
  • Connect the VCC of the NodeMCU to the 5V pin on the Arduino or 5V of the power supply if necessary.
  • Connect the GND of the NodeMCU to the GND pin on the Arduino.
  • Connect the TX of the NodeMCU to the RX pin on the Arduino (use a voltage divider if necessary).
  • Connect the RX of the NodeMCU to the TX pin on the Arduino.

Connecting the LCD Screen:

  • Connect the VCC of the LCD screen to the 5V pin on the Arduino.
  • Connect the GND of the LCD screen to the GND pin on the Arduino.
  • Connect the LCD data pins accordingly or connect the SDA and SCL pins of the LCD screen to the corresponding A4 (SDA) and A5 (SCL) pins on the Arduino if you are using I2C module.

Programming The Project Design

#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

Programming the NodeMCU

 #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);
  
}

Explanation of Source Code

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:

  1. Setup:
    • It first establishes serial communication for debugging messages and sets up the NodeMCU to communicate at a specific baud rate.
    • It configures a pin as an output to control an LED.
    • It connects the ESP8266 to your WiFi network using the provided credentials.
    • Finally, it initializes the ThingSpeak library to communicate with the ThingSpeak website.
  2. Main Loop:
    • This loop runs continuously.
    • It constantly checks for incoming data on the serial port from the NodeMCU.
    • If data is available, it reads it character by character until it encounters a newline character (“\n”).
    • Once a complete line is received, it calls the parse_data function to extract eight data values separated by specific characters (likely letters A to H).
    • It then checks the WiFi connection status. If not connected, it attempts to connect using the provided credentials. If connected, it blinks an LED and sends the extracted data to ThingSpeak using the ThingSpeak library functions.
    • After sending the data, it prints the received data values to the serial monitor for debugging purposes.
    • Finally, it delays for 20 seconds before repeating the loop.
  3. Data Parsing:
    • This function takes the received data string as input and searches for specific characters (A-H) within the string.
    • It uses the indexOf function to find the positions of these characters.
    • Based on these positions, it extracts eight substrings from the original data string using the substring function. These eight substrings are assigned to variables data1 to data8.

Calibration and Testing

Calibration is crucial to ensure the accuracy of your readings. For the pulse sensor and pressure sensor, we used a known reference, such as a clinically validated blood pressure monitor, to calibrate our system. Comparing the readings from our DIY system with the reference device and adjust the calibration constants in our Arduino code accordingly.

For the cholesterol sensor, calibration is more complex due to the proxy method used. It involves taking multiple readings and comparing them with laboratory test results to create a calibration curve.

Understanding Blood Pressure and Cholesterol Levels

Interpreting Blood Pressure Readings

Blood pressure readings consist of two numbers: systolic and diastolic pressures. The systolic pressure is the highest pressure in your arteries when your heart beats, while the diastolic pressure is the lowest pressure when your heart rests between beats. Normal blood pressure is typically around 120/80 mmHg.

Analyzing Cholesterol Levels

Cholesterol levels are measured in milligrams per deciliter (mg/dL). Total cholesterol is the sum of low-density lipoprotein (LDL), high-density lipoprotein (HDL), and 20% of your triglyceride level. LDL is often referred to as “bad” cholesterol because high levels can lead to plaque buildup in arteries and result in heart disease. HDL is “good” cholesterol as it helps remove LDL from the bloodstream.

Monitoring and Data Visualization

The thingspeak IoT platform display

Real-Time Monitoring

With the sensors connected and calibrated, you can now use Arduino to monitor blood pressure and cholesterol levels in real-time. The LCD can show the current readings, and the NodeMCU board can send the data to a remote server for further analysis and storage.

Data Visualization Tools

Visualizing your health data helps in better understanding trends and anomalies. You can use various tools like ThingSpeak or Blynk to create real-time graphs and dashboards. These platforms allow you to monitor your health metrics on your smartphone or computer.

Practical Applications and Benefits

Personal Health Tracking

Having a personal health monitoring system allows you to keep track of your vital signs regularly. It empowers you to take proactive steps in managing your health and making informed decisions based on the data collected.

Early Detection of Health Issues

Regular monitoring can help in the early detection of potential health issues. By noticing deviations from your normal readings, you can seek medical advice promptly and take preventive measures to avoid serious health problems.

Challenges and Considerations

Accuracy and Reliability

DIY health monitoring systems may not always match the accuracy of clinically validated devices. It is essential to understand their limitations and use them as supplementary tools rather than complete replacements for professional medical equipment.

Maintenance and Upkeep

Maintaining your DIY system involves regular calibration, ensuring sensor accuracy, and updating the software as needed. Proper upkeep ensures that your monitoring system remains reliable and functional over time.

Conclusion

Creating this DIY non-invasive blood pressure and cholesterol level monitoring system using Arduino is an exciting and empowering project. It combines technology and health, allowing you to take control of your well-being. By understanding and utilizing this system, you can gain valuable insights into your health and make informed decisions to maintain a healthy lifestyle.

For those interested in exploring this project further, the journey of building and optimizing your DIY health monitoring system can be both educational and rewarding.

Unique FAQs

1. How accurate are DIY blood pressure monitors compared to traditional devices? DIY monitors can be accurate if properly calibrated and used correctly, but they may vary in precision compared to clinical-grade equipment. Regular calibration against a standard device can improve accuracy.

2. Can I use this monitoring system to replace regular visits to my doctor? While useful for personal health tracking, DIY monitors should not replace regular medical check-ups. They are best used as supplementary tools alongside professional healthcare advice.

3. Are there any safety concerns with DIY health monitoring devices? Ensuring proper calibration, understanding the device’s limitations, and not relying solely on DIY monitors for critical health decisions can mitigate safety concerns. Always consult a healthcare professional for accurate diagnosis and treatment.

4. What are some common pitfalls to avoid when building this monitoring system? Common pitfalls include improper sensor calibration, inadequate data interpretation, and insufficient understanding of sensor technology. Following detailed instructions and double-checking connections can help avoid these issues.

5. How can I expand this project to monitor additional health parameters? To expand the project, you can integrate additional sensors like glucose sensors, ECG monitors, or temperature sensors. Using Arduino’s versatile platform, you can program and connect multiple sensors to create a comprehensive health monitoring system.

smartechlabs

View Comments

Recent Posts

Embracing Imperfections: The Path to a Happier Life

embracing imperfections  Let’s talk about something that touches each of our lives in one way…

9 hours ago

History of The Cold War: A Tense Standoff

The Cold War: A Tense Standoff Introduction The Cold War was not just a period…

15 hours ago

The Birth of Bitcoin: A Digital Revolution

The Birth of Bitcoin Introduction In a world where traditional finance often feels cumbersome and…

16 hours ago

Read The Broken Mute’s Revenge Ebook Here

The Broken Mute’s Revenge In "The Broken Mute's Revenge," the story revolves around a young…

17 hours ago

Fostering Student Autonomy: Self-Directed Learning Strategies for Success

Introduction Imagine a classroom where students take the reins of their own education, setting their…

2 days ago

The Science of Learning: Applying Cognitive Psychology to Educational Design

Introduction Imagine stepping into a classroom where every lesson is meticulously crafted, not just with…

2 days ago

This website uses cookies.