Dr. Kayarvizhy N Dr. Kayarvizhy N

Internet of Things

Pulse Sensor

May 16, 2016All posts

Pulse Sensor

Pulse Sensor is an open source heart rate detector that detects the heart rate through the light transmittance change with blood vessel beat.

Circuit

Arduino Sensor
5V Middle Pin
GND Third Pin
A0 S (Purple)

 


Download PulseSensor_Amped_Arduino-master.zip file from below link unzip it, and move it to your Documents/Arduino folder

https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino

0pen project in Arduino via *File > Sketchbook > PulseSensor_Arduino-Master > PulseSensorAmped_Arduino_1dot2.ino

In above code static boolean serialVisual=false

Change the value ” false to true” then run the code

 

/* Pulse Sensor Amped 1.4 by Joel Murphy and Yury Gitman http://www.pulsesensor.com

---------------------- Notes ---------------------- ---------------------- 
This code:
1) Blinks an LED to User's Live Heartbeat PIN 13
2) Fades an LED to User's Live HeartBeat
3) Determines BPM
4) Prints All of the Above to Serial

Read Me:
https://github.com/WorldFamousElectronics/PulseSensor_Amped_Arduino/blob/master/README.md 
---------------------- ---------------------- ----------------------
*/

// Variables
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin

// Volatile Variables, used in the interrupt service routine!
volatile int BPM; // int that holds raw Analog in 0. updated every 2mS
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // int that holds the time interval between beats! Must be seeded! 
volatile boolean Pulse = false; // "True" when User's live heartbeat is detected. "False" when not a "live beat". 
volatile boolean QS = false; // becomes true when Arduoino finds a beat.

// Regards Serial OutPut -- Set This Up to your needs
static boolean serialVisual = true; // Set to 'false' by Default. Re-set to 'true' to see Arduino Serial Monitor ASCII Visual Pulse


void setup(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS 
// IF YOU ARE POWERING The Pulse Sensor AT VOLTAGE LESS THAN THE BOARD VOLTAGE, 
// UN-COMMENT THE NEXT LINE AND APPLY THAT VOLTAGE TO THE A-REF PIN
// analogReference(EXTERNAL); 
}


// Where the Magic Happens
void loop(){

serialOutput() ; 

if (QS == true){ // A Heartbeat Was Found
// BPM and IBI have been Determined
// Quantified Self "QS" true when arduino finds a heartbeat
fadeRate = 255; // Makes the LED Fade Effect Happen
// Set 'fadeRate' Variable to 255 to fade LED with pulse
serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial. 
QS = false; // reset the Quantified Self flag for next time 
}

ledFadeToBeat(); // Makes the LED Fade Effect Happen 
delay(20); // take a break
}

void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}

 

0 0 votes
Article Rating
0 0 votes
Article Rating
Subscribe
Notify of
3 Comments
Oldest
Newest Most Voted
huss
huss
9 years ago

why my result only show value s145 and s144? and both my led also not blink. can u help me?

pierfraxxxx
pierfraxxxx
9 years ago

The same:why my result only show value s145 and s144? and both my led also not blink. can u help me?
Updates?

mariam
mariam
9 years ago

Hi, I have a problem in compilation:

ECG63:29: error: expected unqualified-id before ‘<' token

static boolean serialVisual = true; // Set to ‘false’ by Default. Re-set to ‘true’ to see Arduino Serial Monitor ASCII Visual Pulse

^

ECG63:29: error: expected unqualified-id before ‘<' token

static boolean serialVisual = true; // Set to ‘false’ by Default. Re-set to ‘true’ to see Arduino Serial Monitor ASCII Visual Pulse

^

C:\Users\HP\Desktop\code_ECG\ECG63\ECG63.ino: In function ‘void setup()’:

ECG63:36: error: ‘interruptSetup’ was not declared in this scope

interruptSetup(); // sets up to read Pulse Sensor signal every 2mS

^

C:\Users\HP\Desktop\code_ECG\ECG63\ECG63.ino: In function ‘void loop()’:

ECG63:46: error: ‘serialOutput’ was not declared in this scope

serialOutput() ;

^

ECG63:53: error: ‘serialOutputWhenBeatHappens’ was not declared in this scope

serialOutputWhenBeatHappens(); // A Beat Happened, Output that to serial.

^

exit status 1
expected unqualified-id before ‘<' token

help me