author
1Instructables41,611Views7CommentsJoined May 30th, 2015

Tell us about yourself!

Complete Your Profile

Achievements

10K+ Views Earned a bronze medal
  • pureAmericanbrother commented on pureAmericanbrother's instructable Heart Rate Monitor2 years ago
    Heart Rate Monitor

    #include <FilterDerivative.h>#include <FilterOnePole.h>#include <Filters.h>#include <FilterTwoPole.h>#include <FloatDefine.h>#include <RunningStatistics.h>float amplifiedSignal; //amplified HR signalfloat filteredSignal; //filtered HR signalint threshold = 200; //FILL IN THIS LINE WITH THE THRESHOLD SIGNAL VALUE THAT YOU'RE GOING TO USEint heartbeatCount = 0; //variable keeps track of number of heartbeatsint beatsPerMinute; //HR in units of bpmint numOfHeartbeats = 5; //total number of heartbeats used to calculate heartratefloat startTime; //time in seconds when first heartbeat occursfloat stopTime; //time in seconds when the last heartbeat (numOfHeartbeats) occursbool possibleHeartbeat = false; //if the signal is above the threshold, we may have a p...

    see more »

    #include <FilterDerivative.h>#include <FilterOnePole.h>#include <Filters.h>#include <FilterTwoPole.h>#include <FloatDefine.h>#include <RunningStatistics.h>float amplifiedSignal; //amplified HR signalfloat filteredSignal; //filtered HR signalint threshold = 200; //FILL IN THIS LINE WITH THE THRESHOLD SIGNAL VALUE THAT YOU'RE GOING TO USEint heartbeatCount = 0; //variable keeps track of number of heartbeatsint beatsPerMinute; //HR in units of bpmint numOfHeartbeats = 5; //total number of heartbeats used to calculate heartratefloat startTime; //time in seconds when first heartbeat occursfloat stopTime; //time in seconds when the last heartbeat (numOfHeartbeats) occursbool possibleHeartbeat = false; //if the signal is above the threshold, we may have a peakvoid setup() { Serial.begin(9600);}// filter out frequencies below 1 Hz.float highFilterFrequency = 1; // create a highpass filter that only keeps frequencies above highFilterFrequencyFilterOnePole filterOneHighpass( HIGHPASS, highFilterFrequency ); // filters out frequenceies greater than 3 Hz.float lowFilterFrequency = 3; // create a lowpass filter that only keeps frequencies below lowFilterFrequencyFilterOnePole filterOneLowpass(LOWPASS, lowFilterFrequency); void loop() {//The next line applies a band pass filter to the signal amplifiedSignal = 100*analogRead(A0); filteredSignal = filterOneHighpass.input(filterOneLowpass.input(amplifiedSignal)); //Serial.println(filteredSignal);//check to see if we have a heart beat if (filteredSignal > threshold) possibleHeartbeat = true; else if (possibleHeartbeat == true && filteredSignal < threshold){ heartbeatCount+=1; possibleHeartbeat = false; Serial.println("heartbeat, ba-bum");//start timing if we have the first heartbeat if (heartbeatCount == 1) startTime = millis()/1000.0; //starting time in seconds//if we count "numOfHeartbeats" heartbeats, calculate a heartrate else if (heartbeatCount == numOfHeartbeats){ stopTime = millis()/1000.0; //stopping time in seconds beatsPerMinute = 60*(numOfHeartbeats-1)/(stopTime-startTime); Serial.print("Your HR is : "); Serial.print(beatsPerMinute); Serial.println(" bpm"); heartbeatCount = 0; } }

    View Instructable »
  • pureAmericanbrother made the instructable Heart Rate Monitor2 years ago
    Heart Rate Monitor

    Does this help?

    View Instructable »
  • pureAmericanbrother commented on pureAmericanbrother's instructable Heart Rate Monitor2 years ago
    Heart Rate Monitor

    I've replaced the separate led and sensor with this combination.https://www.adafruit.com/product/2349It works even better. If you have any questions, let me know.

    View Instructable »