Project tutorial
Prevention of heart attack

Prevention of heart attack

Heart attack is killing over 375,000 Americans every year. and this project wants to stop this.

  • 7,653 views
  • 5 comments
  • 18 respects

Components and supplies

Ardgen 101
Arduino 101 & Genuino 101
×1
12009 06
SparkFun Logic Level Converter - Bi-Directional
×1
Grove Starter Kit for Genuino / Arduino 101
×1
Max30100 heart rate sensor
×1

Apps and online services

About this project

Story

Every year many peoples die because of heart attack. only in United State 375,000 person die every year! there are many drug that calm down heart and prevent heart attack like nitroglycerin, ACE inhibitors, Beta blockers and ...! but they have to be injected to the body immediately. when an old lady sleeps at home and suddenly heart attack happens, she is really in a bad situation, because there is no doctor at home to help her and give her drug. and if she is hospitalized, it takes time for nurses to hear the alarm and go to patient's room, take her drug and inject that to the her body!

Solution

the first stage of heart attack is sudden change in heart beat rate. suddenly it goes too high or too low. at this stage we detect it and predict heart attack by help of a microcontroller and a heart rate sensor, then microcontroller will inject drug to body, by controlling vale or pump that are placed at the middle of drug hose! now controlling heart attack is faster easier and predictable.

How it works?

in this project MAX30100 heart rate sensor will be attached to patient's body and send heart rate and SpO2 to the microcontroller. now microcontroller checks the data and show it on the LCD, if the data is good and normal the LCD's backlight will be blue, else it will be red, and the buzzer start buzzing. and the step motor that control the drug flow will rotate and increases the drug flow. an emergency touch button is located near the LCD that run the buzzer, patient can use this button in emergency situations.

wiring

  • at first we have to connect MAX30100 heart rate sensor to the Arduino 101 with I2C protocol. MAX30100 logic level is 3.3V, Arduino 101 works with both 5V and 3.3V. but Grove LCD works with 5V I2C protocol. so we need to convert the logic level between Arduino 101 and MAX30100. as we are using I2C protocol, the SCL & SDA cables from the MAX30100 goes to TXI of logic level converter, and the cables from the Arduino 101 goes to TXO of logic level converter. the HV will be connected to 5V , LV to 3.3V and GND to GND fo Arduino. then solder MAX30100 and a long wire together, now connect the other end of long wire to the breadboard. now you can use your sensor far from the main board!
  • Step motor (28BYJ-48) will be connected to its driver (ULN2003) easily by thair sockets. the driver's VIN to 5V of Arduino, GND to GND, and IN 1,2,3,4 pins to digital pins 2,3,4,5 of Arduino.

  • Buzzer socket will be connected to D8 of the shield.
  • Touch button socket will be connected to D4 of the shield.
  • The Grove LCD will be connected to the I2C socket of the shield.

injection system

For controlling the amount of drug that will be injected to patient's body. we use an step motor that works like an dialysis pump! this kind of pump works by pushing the liquid that is inside a hose by pressing it!

injection system

coding

The code is commented and completely functional and i think it's easy to to be understood. but the highest and lowest heart are not constant for every one and you should change them to your specific heart rate.

#define LHB 30
#define HHB 100

installing the device

now that every thing is ready we move the whole boarde and injection system neare to the patient's bed.

testing the device :)

final test

Code

Prevention of heart attackArduino
#include <Wire.h>
#include <MAX30100_PulseOximeter.h>
#include <rgb_lcd.h>
#include <Stepper.h>

#define REPORTING_PERIOD_MS     1000
#define stepsPerRevolution  200
#define key 8                                          // key digital pin
#define buz 4                                          // buzzer digital pin
#define LHB 30                                         // critical lowest heart rate
#define HHB 100                                         // critical highest heart rate

Stepper myStepper(stepsPerRevolution, 2, 3, 4, 5);
rgb_lcd lcd;
PulseOximeter pox;
uint32_t tsLastReport = 0;

///////////////////////////////////////////////////////

void setup() {
  pinMode(key,INPUT);
  pinMode(buz,OUTPUT);
  myStepper.setSpeed(100);
  lcd.begin(16,2);
  pox.begin();
}

///////////////////////////////////////////////////////

void loop() {
  pox.update();                                                  // geting new data from heart rate sensor
  if (millis() - tsLastReport > REPORTING_PERIOD_MS)
  {
    LCDwrite();                                                    // showing data on LCD
    LCDcolor();                                                    // choosing LCD's backlight color
    inject();                                                      // inject drug if situation is dangerous
    tsLastReport = millis();
  }
  buzer();                                                         // sound the alarm if the button is pressed or situation is dangerous
}

///////////////////////////////////////////////////////

void LCDwrite(){
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("HEART:: ");
  lcd.print(pox.getHeartRate());
  lcd.setCursor(0,1);
  lcd.print("SPO2:: ");
  lcd.print(pox.getSpO2());
}

void LCDcolor(){
  if (LHB<pox.getHeartRate() and pox.getHeartRate()<HHB)        // dangerous situation
    {
      lcd.setRGB(0, 0, 255);                           // blue backlight
    }
    
  else
    {
      lcd.setRGB(255, 0, 0);                         // red backlight
    }
}

void buzer(){
  // dangerous situation or pressed button
  if ( digitalRead(key)==HIGH or pox.getHeartRate()<LHB or pox.getHeartRate()>HHB)
    {
      digitalWrite(buz,HIGH);
    }
  else
    {
      digitalWrite(buz,LOW);
    }
}

void inject(){
  if (pox.getHeartRate()>HHB)                          // dangerous high heart rate
    {
      myStepper.step(2075);                              // spin 1 round and inject drug
    }
}

Schematics

llc_MuOqHDsKGL.jpg
Llc muoqhdskgl

Comments

Similar projects you might like

Heart Attack with LED

Project tutorial by TheTNR

  • 773 views
  • 0 comments
  • 2 respects

Heart Rate Monitoring System

Project tutorial by Team HRMS

  • 17,481 views
  • 4 comments
  • 32 respects

Detecting Heart Rate with a Photoresistor

Project tutorial by 3 developers

  • 10,043 views
  • 4 comments
  • 30 respects

Heart Rate Monitor Using IoT

Project tutorial by Team Technopaths

  • 9,115 views
  • 3 comments
  • 26 respects

Suicide Prevention Gun Safe Locking System

Project showcase by 6 developers

  • 8,469 views
  • 10 comments
  • 17 respects
Add projectSign up / Login