On this tutorial we will going to wire the Heart Beat Sensor using Arduino & Processing. The pulse sensor module is an open source heart rate detection device that detects the hearth pulse rate through the light transmittance change with blood vessel beat. these hearth rate sensor is really useful whether you’re designing an exercise routine, reading your activity or anxiety or you want to add a led to your T-Shirt and Blink along with your hearth pulse or if you want to place the sensor to your finger tips on your earlobe and plug it in to your Arduino you’re ready to read and collect data from your hearth rate.
The pulse sensor is terminated with standard male header so there no soldering required, the device is required voltage of 3~5v dc, 4mA current, a diameter of 0.625″ x 0.125 thick. perfect for artist, athletes, makers and developers who want to easily experiment a live heart rate data into their projects. and it has essentially combined a simple optical heart rate sensor integrated with implication and noise cancellation making it fast and easy to get reliable pulse data.
Software Required:
Arduino IDE (www.arduino.cc)
Processing IDE (www.processing.org)
Electronic Device Required:
Arduino UNO/MEGA/PRO
Hearth Beat Sensor
Jumper wire
Wiring the Pulse Sensor:
Running the code library:
Before running the code you need to include or add the code library to your Arduino IDE. > extract the compress file and copy the folder and save it you Arduino code library then close your Arduino IDE and open again, now you can see the heart rate sensor code at your Code Library, for the Processing IDE, just extract the zip file and open it inside of Processing IDE and RUN the code.
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
// 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 // these variables are volatile because they are used during the interrupt service routine! volatile int BPM; // used to hold the pulse rate volatile int Signal; // holds the incoming raw data volatile int IBI = 600; // holds the time between beats, must be seeded! volatile boolean Pulse = false; // true when pulse wave is high, false when it's low volatile boolean QS = false; // becomes true when Arduoino finds a beat. 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 // UN-COMMENT THE NEXT LINE IF YOU ARE POWERING The Pulse Sensor AT LOW VOLTAGE, // AND APPLY THAT VOLTAGE TO THE A-REF PIN //analogReference(EXTERNAL); } void loop(){ sendDataToProcessing('S', Signal); // send Processing the raw Pulse Sensor data if (QS == true){ // Quantified Self flag is true when arduino finds a heartbeat fadeRate = 255; // Set 'fadeRate' Variable to 255 to fade LED with pulse sendDataToProcessing('B',BPM); // send heart rate with a 'B' prefix sendDataToProcessing('Q',IBI); // send time between beats with a 'Q' prefix QS = false; // reset the Quantified Self flag for next time } ledFadeToBeat(); 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 } void sendDataToProcessing(char symbol, int data ){ Serial.print(symbol); // symbol prefix tells Processing what type of data is coming Serial.println(data); // the data to send culminating in a carriage return } |
Download the source code for Arduino here | ZIP
Download the source code for Processing here |ZIP
Download the starter guide documentation here | PDF
Download the schematics diagram here | PDF