Failed to read from DHT11 sensor NodeMCU

I am trying to use DHT11 with Blynk App. It was working perfectly fine 2 months ago. Today I am trying to use it again but no matter what I try, it just doesn’t work.

What I have already tried:

  1. Changing my sensor with a new one
  2. Updated Blynk libraries
  3. Trying different pins

Can anyone please help me to identify the problem?

[This is my exact circuit diagram](

Error Log:

[20718] Connecting to AndroidAP
[21221] Connected to WiFi
[21221] IP:
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.4 on NodeMCU

[21302] Connecting to
[31303] Connecting to
[32040] Ready (ping: 180ms).
Failed to read from DHT sensor!
Failed to read from DHT sensor!
Failed to read from DHT sensor!


#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "my_token"; //Enter the Auth code which was send by Blink

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "AndroidAP";  //Enter your WIFI Name
char pass[] = "my_pass";  //Enter your WIFI Password

#define DHTPIN 0          // Digital pin D3

// Uncomment whatever type you're using!
#define DHTTYPE DHT11     // DHT 11

SimpleTimer timer;

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!");
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);  //V5 is for Humidity
  Blynk.virtualWrite(V6, t);  //V6 is for Temperature
  Blynk.virtualWrite(V7, h); // Humidity for graph
  Blynk.virtualWrite(V8, t); // Temperature for 

void setup()
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, ssid, pass);


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

void loop()
{; // Initiates Blynk; // Initiates SimpleTimer

This is my settings and it was working previously. I also tried to change it to NodeMCU 1.0 (ESP 12E Module) but still not working.

There have been a few posts recently about some DHT libraries not working well with Blynk, like this one:

Personally, I don’t use DHT sensors because they are so inaccurate, so have no first-hand knowledge of using these with Blynk.

Maybe switching to something like the BME280 is a better long term solution anyway.


1 Like

If you have an Arduino Uno or something try with that, because it may be a DHT11 problem… I do use “lits” of DHT22 and they work OK. Which dht library do you use? I use the one from Adafruit (you need to install 2 libs described HERE ). I would also switch to a different GPIO, say GPIO5 or GPIO4 (D1, D2 on NodeMCU)…

1 Like

Thanks everyone, the connectors were faulty :confused: I changed the connected wires and it starts working again. Wasted my 4 5 hours :expressionless:

DHT sensors are indeed inaccurate. BME280 and BME680 seem good I will try it. Actually I am building it for my hydroponic greenhouse.
Can you also suggest good sensors for water pH and TDS check?

I found this one for pH but not sure if they are reliable or not.

No experience of Ph or TDS I’m afraid, but I would imagine that any sensor that’s permanently immersed in water or soil, and has a current applied across it either permanently or frequently will have a limited life due to the electrolysis effect on the sensor elements.

Might be worth going for the cheapest you can find and replacing frequently.


4 posts were split to a new topic: Sensor connection issue