Project showcase
Arduino Powered CPR Feedback Device

Arduino Powered CPR Feedback Device © GPL3+

Adding real-time feedback to a CPR manikin. Allows for depth, rate, time and chest recoil monitoring.

  • 4,659 views
  • 8 comments
  • 25 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)

Apps and online services

About this project

As most of us working in health care training know, we sometimes have to rely on creating or hacking trainers to better suit the needs of the program and the learners. One of the newest projects I have been working on includes upgrading a CPR manikin to include a CPR feedback device made with Arduino. There are plenty of CPR feedback devices available on the market, some use a cell-phone, a portable device, or a CPR manikin with these features included. This project was not meant to create something entirely new but to evaluate more cost-effective ways to build upon existing trainers.

The CPR feedback device consists of the following features:

  • Real Time Rate Measurement
  • Depth Indicator
  • Time
  • Chest Recoil Indicator
  • CPR Cycle Counter
  • 9v Battery Powered
  • Scalable-Ready for future updates via code and sensors

Code

CPR Feedback CodeArduino
/*
CPR feedback Test sketch
-Using LCD to display results in real time
 */

#include <LiquidCrystal.h>

int pressurePin = 0; //pressure reading pin
int pressureRead; //for reading pressure pin
const int buttonPin = 8;  // pin for CPR count
unsigned long time; //to display time for compressions
const int pressGood = 10;
const int pressBad =  9;

int BPM; //final output calculated beats per min
float bpmCount; // to calculate BPM
float cprCount = 0;   // counter for the number of button presses, changed from int, changed from float
int buttonState = 0;         // current state of the button
int lastButtonState = 0;     // previous state of the button
int cprTotal = 0; //total of the 5 stored values
int cprCycle = 0; //keeps track of CPR cycle

int  timeSec, timeCPR, BPM_1; //calculating cpr time
float totalTime;
unsigned long timeBegin, timeEnd;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //LCD pins

void setup() {
 
  pinMode(buttonPin, INPUT); //CPR button
  pinMode(pressGood, OUTPUT); //for good release, led on Green
  pinMode(pressBad, OUTPUT); // for bad release, led on Red
  Serial.begin(9600); // start serial communication / uncomment to debug
  Serial.println("Begin CPR");
  lcd.begin(16, 2); //start LCD
  lcd.home();
  lcd.print("Begin CPR");
}

void loop() {
pressureRead = analogRead(pressurePin);
  time = millis(); //start time
  buttonState = digitalRead(buttonPin);
  if (buttonState != lastButtonState) {
       
    if (buttonState == HIGH) { //depth of at least 2in per AHA guidelines
      lcd.clear();
      lcd.home();
      cprCount++; //add 1 to the running total
      Serial.println(cprCount);
      lcd.setCursor(0,0);
      lcd.print("Count: ");
      lcd.setCursor(7,0);
      lcd.print(cprCount);
      lcd.setCursor(10,0);
      lcd.print("R: ");     //rate BPM
      
      if(cprCount == 1){
         timeBegin = millis(); //beginning time
      }
      
      }
     
    }
    //pressureRead = analogRead(pressurePin);
    if (pressureRead < 500){
        digitalWrite(pressGood, HIGH);
        digitalWrite(pressBad, LOW);
    }
    else if (pressureRead > 501){
        digitalWrite(pressBad, HIGH);
        digitalWrite(pressGood, LOW);
    }



     if (cprCount == 30){ // 30:2 ratio for CPR, 30 total
            cprCount = 0; //restart count
            timeEnd = millis(); //capture end time for set
            //Serial.println(timeEnd);
            totalTime = (timeEnd - timeBegin) / 1000; //convert Ms to seconds
            Serial.print("Total Time: ");
            Serial.println(totalTime);
            bpmCount = ( 30.0 / totalTime); //bpmCount = float
            Serial.print("BPM Count: ");
            Serial.println(bpmCount);
            BPM = (bpmCount * 60.0);
            Serial.print("Total time in sec: ");
            Serial.println(totalTime);
            lcd.home();
            lcd.print("Rate (BPM): ");
            lcd.setCursor(12,0);
            lcd.print(BPM);
            Serial.print("BPM is: ");
            Serial.println(BPM);
            lcd.setCursor(0,1);
            lcd.print("Total Time: ");
            lcd.setCursor(12,1);
            lcd.print(totalTime);
            cprCycle++;
            Serial.print("CPR Cycle #: ");
            Serial.println(cprCycle);
            if (cprCycle == 5){
                cprCycle = 0;
            }
            
     }
     
     if (cprCount > 5 && cprCount <= 30) {
         float rateTime = (millis() - timeBegin) / 1000; //changed int rateTime to unsigned long
         //Serial.println(rateTime);
         int rate = (cprCount / rateTime) * 60; //changed int to unsigned int
         //Serial.print("BPM is: ");
         //Serial.println(rate);
         
         if (rate >= 100 && rate <= 120 ){ //AHA guidelines 100-120 CPM
             lcd.setCursor(12,0);
             lcd.print("Good");
         }
         else {
             lcd.setCursor(12,0);
             lcd.print("----");
         }
     }

     
    // Delay
    delay(25); //changed from 50
  lastButtonState = buttonState;
}

Custom parts and enclosures

LCD and LED Holder
STL file for LCD and LED holder

Schematics

CPR Feedback Hardware Wiring Guide
Cpr%20feedback bb

Comments

Similar projects you might like

Weather Station v.1.0

Project showcase by derapados

  • 12,527 views
  • 4 comments
  • 39 respects

Healthcare Skin Pressure Detector

Project tutorial by David Escobar

  • 5,087 views
  • 2 comments
  • 17 respects

Arduino Piano

Project in progress by Teo Zhi Yi

  • 2,570 views
  • 0 comments
  • 7 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 24,872 views
  • 17 comments
  • 75 respects

Simple Arduino Digital Clock Without RTC

Project in progress by Annlee Fores

  • 96,159 views
  • 23 comments
  • 80 respects

Smart Garden

Project showcase by patel Dipen

  • 23,406 views
  • 15 comments
  • 60 respects
Add projectSign up / Login