Not Displaying Any Value on Blynk App with nodemcu ESP32 + dfrobot heart rate sensor

Hi, everyone. I have been working on a project that connect nodemcu esp32 with dfrobot heart rate sensor link and I just can’t get any value being display on the app. There’s only 3 wires that connect between the nodemcu esp 32 and dfrobot heart rate sensor. I also been following the tutorial from this youtube videotutorial esp8266 but it wont work on my app, just no value display. ps: I have tested it on esp8266 too but it won’t work as the video shown). I have been struggling, any help with be appreciated.

Here as follows
nodemcu esp 32 ------------------ Dfrobot heart rate sensor
GND ----------------- GND
3.3v ----------------- VCC
GPIO 32 ----------------- Signal

• Smartphone OS - Redmi K20 Pro[MIUI 11.0.8 ] / Xiao Mi A2 Lite (Tested on both devices)
• Blynk Library version : v.0.6.1
• Code:


#define heartratePin 32
#include "DFRobot_Heartrate.h"
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>


DFRobot_Heartrate heartrate(DIGITAL_MODE); ///< ANALOG_MODE or DIGITAL_MODE


BlynkTimer timer;
char auth[] = "zSgIpS-vRCeOEohVzuHWlaVpBNl5eaxG";                              
char ssid[] = "Gummya";    
char pass[] = "testtest1";  

void setup() {
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(2000L, sendUptime);
}

void sendUptime() {
  uint8_t rateValue;
  heartrate.getValue(heartratePin); ///< A1 foot sampled values
  rateValue = heartrate.getRate(); ///< Get heart rate value 
  if(rateValue)  {
    Blynk.virtualWrite(V98,rateValue);
    Serial.println(rateValue);
  }

  //delay(20);
}

void loop() {
  
  Blynk.run();
  timer.run();
 
}

Anyone are welcome to comment if you happen to have any idea to tackle this issue. Thanks in advance.

Regards
yys100

I think the issue is that the code that looks for pulses is meant to run in the void loop - which probably won’t work well with Blynk.
You’re calling the timed function once every 2 seconds. If the sensor detects a pulse at exactly the moment when the timed function is called then you’ll get a result, but the odds on that happening are pretty slim.

I think you’d probably be better-off using an interrupt, but I doubt whether you’ll get the sort of results you’re hoping for when using Superchart.

Pete.

Hi, thanks for getting back to me. As for the suggestion using interrupt, could you please provide me an example so that I could work on it as my programming skill is not very good. Besides, are they any alternatives that display the value I want on the app for my case? I would like to try it out. If would be good if you could point out what I should add/change in my code and I’ll be grateful to you. And I am just using the widget gauge to display value (using digital mode), that’s what I want.

Thanks

Regards
yys100

I’d suggest that you do a bit of searching for interrupt examples.

Blynk is an IoT app, and isn’t really aimed at the sort of things you’re trying to do. Give it a go by all means, but I wouldn’t put too much time and effort into it.

Pete.