Wednesday, October 12, 2022

Node-red Web Dash Board with Arduino to Show Heart beat rate

 







Circuit Diagram




Program Code

#include <SoftwareSerial.h>

SoftwareSerial SMESerial (6, 7);

#define USE_ARDUINO_INTERRUPTS true    

#include <PulseSensorPlayground.h>    


const int PulseWire = A0;      

const int Ind = 13;           

int Threshold = 550;           

                               

PulseSensorPlayground pulseSensor;  


void setup() {   

  Serial.begin(9600);

  SMESerial.begin(9600);

  Serial.println("Serial Begin");


  // Configure the PulseSensor object, by assigning our variables to it. 

  pulseSensor.analogInput(PulseWire);   

  pulseSensor.blinkOnPulse(Ind);       

  pulseSensor.setThreshold(Threshold);   

  delay(2000);


   if (pulseSensor.begin()) { // If puslse sensor connect properly

    Serial.println("We created a pulseSensor Object !"); 

  }

}


void loop() {


 int myBPM = pulseSensor.getBeatsPerMinute();  

if (pulseSensor.sawStartOfBeat()) {            // Constantly test to see if "a beat happened". 

  

   Serial.println("♥  A HeartBeat Happened ! "); 

   Serial.println(String("BPM: ") + myBPM);                        

                     

   SMESerial.print('\r');

   SMESerial.print(myBPM);

   SMESerial.print('|');

   SMESerial.print('\n');

  

   Serial.print('\r');

   Serial.print(myBPM);

   Serial.print('|');

   Serial.print('\n');

}

  delay(1000);       

}



No comments:

Post a Comment

GPS sensor interface with ESP8266 using Blynk IoT cloud

   Circuit diagram: Source Code: #include <TinyGPS++.h> #include <SoftwareSerial.h> #define BLYNK_PRINT Serial #include <ESP8...