[SOLVED] 4 Pin DHT11 sensor fail to read from dht sensor in node mcu blynk app

Node MCU is failing to get reading from DHT11 sensor.
4Pin DHT11: http://modtronix.com/prod/sens/sens_dht11.pdf

Trying this example.
https://examples.blynk.cc/?board=NodeMCU&shield=ESP8266%20WiFi&example=More%2FDHT11

Arduino IDE serial monitor show’s fail to read from dht sensor.

DHT11 sensor is connected to Digital Pin 2. There is a 10k resister between data and vcc of this sensor.

There is a per second blink in node mcu onboard led, Tried adding D4 button for node mcu led blinking, its working. I can see the response.

This sensor is working with arduino uno using analog pin. But don’t know why this isn’t working with node mcu. Most of the people are using 3 pin dht11 sensor. Is that a problem?

Try setting the timer to 2000L as per Adafruit description.

My guess is you are wired up to the wrong pins. On ESP’s that have screen printing on the PCB, D2 doesn’t mean digital pin 2 like it does on an Arduino.

The D references on ESP’s are totally different to the pinout on an Arduino. Look up the pinout for your device,

@myggle Thanks for the adafruit link, Tried changing the timer to 2000 still no change.

@Costas I tried changing the wiring. Also verified the pin position of D2 of amica. My wiring connection is correct. See image of my connection.

As @Costas has said. D2 is not GPIO2. Move your wire to D4, as that is GPIO2.

5 Likes

Although you may be better off changing your code to pin 4 and leaving your wire connected to D2. I believe GPIO2 is a special one that needs to be at a certain state at boot or else it will boot in a different mode.

2 Likes

No it’s not.

@Toro_Blanco Thank you so much I changed code to pin 4 and now it’s working :joy: So happy doing this, really appreciate your help and detailed information about pins. D2 is GPIO4!

1 Like

@Costas you were right my wiring was not correct. The default dht11 Blynk sample code was expecting to connect data pin of sensor to D4(gpio2). Thank You!

Glad to hear it is working.
WOW, 78% humidity. That’s moist. It’s a little drier where I am at (Southern California).

5 Likes

Hey, I am trying to do the same thing as yours. However, when I ran my code, the output from my Serial Monitor is:


And it seems not connecting with my WiFi and Blynk, did u ever face this problem?

It’s not the same issue, open new topic and post your properly formatted code there.

1 Like