I have been using NodeMcu board for my project with a pulse sensor, DH11 sensor, and temperature sensor. Everything has worked well in spite of the pulse sensor. It doesn't show any readings that always printing with 0 values in my serial monitor I have conected the wire as well and the code also has compiled well. but the sensor doesn't read anything it still remaining as 0 values.

#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.
#include <PulseSensorPlayground.h>     // Includes the PulseSensorPlayground Library.   

//  Variables
const int PulseWire = 0;       // PulseSensor PURPLE WIRE connected to ANALOG PIN 0
const int LED13 = 13;          // The on-board Arduino LED, close to PIN 13.
int Threshold = 550;           // Determine which Signal to "count as a beat" and which to ignore.
                               // Use the "Gettting Started Project" to fine-tune Threshold Value beyond default setting.
                               // Otherwise leave the default "550" value. 
PulseSensorPlayground pulseSensor;  // Creates an instance of the PulseSensorPlayground object called "pulseSensor"

void setup() {   

  Serial.begin(9600);          // For Serial Monitor

  // Configure the PulseSensor object, by assigning our variables to it. 
  pulseSensor.blinkOnPulse(LED13);       //auto-magically blink Arduino's LED with heartbeat.

  // Double-check the "pulseSensor" object was created and "began" seeing a signal. 
   if (pulseSensor.begin()) {
    Serial.println("We created a pulseSensor Object !");  //This prints one time at Arduino power-up,  or on Arduino reset.  

void loop() {

 int myBPM = pulseSensor.getBeatsPerMinute();  // Calls function on our pulseSensor object that returns BPM as an "int".
                                               // "myBPM" hold this BPM value now. 

if (pulseSensor.sawStartOfBeat()) {            // Constantly test to see if "a beat happened". 
 Serial.println("♥  A HeartBeat Happened ! "); // If test is "true", print a message "a heartbeat happened".
 Serial.print("BPM: ");                        // Print phrase "BPM: " 
 Serial.println(myBPM);                        // Print the value inside of myBPM. 

  delay(20);                    // considered best practice in a simple sketch.

  • 1
    If you want help you'll need to tell us exactly how you connected everything to the ESP8266. Otherwise you're asking people to take blind guesses about it. Also, please edit your question and paste the actual output of the program into it. – romkey Oct 7 '20 at 1:24
  • start at the begining ... write a simple sketch that only retrieves one parameter and prints it to the serial monitor, for example, the temperature ... have no other code in the sketch – jsotola Oct 7 '20 at 2:51
  • yes I already have checked with some basic example sketch which is already have given with the library but It still remaining as 0 values for the heart rate – Sharifdeen Ashshak Oct 7 '20 at 4:28
  • It's probably a hardware problem. Since you've decided not to tell us how you wired things up, we can't help you. – romkey Oct 7 '20 at 4:40
  • 1
    yeah, Now I have edited my scatch with minimal code – Sharifdeen Ashshak Oct 7 '20 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.