Strange Value (%.3f) Showed in Labled Value Display - DHT11

Problem Statement:

I am using Blynk Example Browser to build DHT11 sketch, I can see temperture & humidity in serial window successfuly, but did not see any value show up in Blynk Labled Value Display Widgets, both temperature & humidity labels showed " %.3f ", I was doing DHT22/NodeMcu with Blynk Widgets several times without any issue, but I could not figure out what is going on for this case, can somebody show me which portion could be wrong, thank you.

  1. Hardware model: NodeMcu ESP8266 with Wi-Fi
  2. Using Android 6.0.1 with latest Blynk App
  3. Using Blynk Server
  4. Using Blynk Library version: v0.5.3
  5. Using Updated DHT library 1.3.0

    Log 1:

[4235] Connected to WiFi
[4236]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.5.3 on NodeMCU

Give Blynk a Github star! => https://github.com/blynkkk/blynk-library

[4248] Connecting to blynk-cloud.com:80
[4558] Ready (ping: 0ms).
Temperature: 30.00C
Humidity: 58.00%
Temperature: 28.00
C
Humidity: 54.00%

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";

#define DHTPIN 2          // What digital pin we're connected to

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11
//#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V99, h);
  Blynk.virtualWrite(V100, t);
  
  Serial.print("Temperature: ");
  Serial.print(t);
  Serial.println("*C\t");
  Serial.print("Humidity: ");
  Serial.print(h);
  Serial.println("%\t");
}

void setup()
{
  // Debug console
  Serial.begin(115200);

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);

  dht.begin();

  // Setup a function to be called every second
  timer.setInterval(15000L, sendSensor);
}

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

I roll it back to v0.5.2, it works, no issue now.

This is another example of where searching before posting would possibly help :stuck_out_tongue_winking_eye:

There was another topic recently with issues displaying floats on Blynk Library 0.5.3… Probably solved with latest Arduino Core for ESP, as that is what I am running and I have no problem displaying float values.

What version of Arduino Core are you running for the ESP8266… it needs to be 2.4.1

1 Like

It IS solved in latest ESP Arduino Core - not a blynk library issue.

1 Like

Not that anyone will actually READ it :stuck_out_tongue_winking_eye: but “Requires ESP ARDUINO Core 2.4.1” should be added to the Library announcement.

1 Like

I will add a runtime check in the next update. That will enforce updates.

1 Like

Actually I searched the forum few times with key word “DHT11” or “%.3f”…etc, I did not see any related threads there, thus, I recalled what I did recently, and then I realized what I’ve done earlier was installed Blynk Library 0.5.3, thus, that’s why I rolled it back to 0.5.2.

Finally I wanna thank you gentlemen to contribute and develop such good Blynk APP/Platform for us, have a nice weekend ^.^

1 Like

Yes, Searching is a art form as much as science, that is for sure… but in the case of something happening after a significant (forum wide) change/announcement, just skimming other posts since the change is another form of “searching” without keywords.

So happy that I first searched before asking for help :rofl: