Comments on: [SOLVED] DHT11/DHT22 – Failed to read from DHT sensor https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Mon, 11 Sep 2023 20:51:57 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: md saddam https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-850220 Tue, 25 Jul 2023 16:06:13 +0000 https://randomnerdtutorials.com/?p=84445#comment-850220 In reply to sai.

in float you ,,,,f ,,,,should be small

]]>
By: Larry Stein https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-842589 Sat, 24 Jun 2023 15:06:03 +0000 https://randomnerdtutorials.com/?p=84445#comment-842589 I found a simple workaround for this issue. I’m supplying the DHT22’s neutral through a spare digital pin, driven low. It works great. All you have to do is set that pin, inside the DHT’s error routine, as an input for 10ms(ie: floating), then back to output and low. Just don’t send 5v through its neutral pin, it will not thank you for that! I had initially thought of using a relay to interrupt its power, which it seems is the issue with DHT’s, but I lucked onto the fact the neutral path data says it is more that capable of sinking the current of a DHT22. Not sure I would try it with more than 1 x DHT though!

]]>
By: Jon Bray https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-813786 Sun, 29 Jan 2023 18:01:54 +0000 https://randomnerdtutorials.com/?p=84445#comment-813786 In reply to Renzo Giurini.

When playing with a moisture sensor a while ago I found that you can supply power from one of the digital output pins, which you can of course control in code (the moisture sensors degrade quickly if kept constantly powered). I might try that with the DHT22.

]]>
By: IulianP https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-797225 Sat, 12 Nov 2022 19:59:23 +0000 https://randomnerdtutorials.com/?p=84445#comment-797225 For me it was the power too low:
I developed an ambient thermostat based on ESP8266. Powered from one 18650, for the voltage to be correct, i used a 3.3V LDO. DHT22 was powered from the same LDO and readings were NaN. As soon as I switched the power of DHT22 directly to 18650, correct readings occurred. Thank you!

]]>
By: Andreas https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-771995 Sat, 30 Jul 2022 19:45:16 +0000 https://randomnerdtutorials.com/?p=84445#comment-771995 In reply to Richard.

Yes, I was also struggling with the “Failed to read from DHT sensor!” message, but after some googling I found something. On the page: https://github.com/mkjanke/ESP32-C3-Fanspeed I found out that the time critical code for the ESP32 is not protected. After changing the DHT.h file as indicated on the page, the values were reliably delivered.

]]>
By: Jeremy Shull https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-768599 Tue, 12 Jul 2022 20:46:01 +0000 https://randomnerdtutorials.com/?p=84445#comment-768599 In reply to Stumble.

Also thanks! This fixed it for me. I had the sensor wired to D5 in the ESP8266 and changed the code to use Pin14 and it worked fine.

]]>
By: João Vitor Toledo https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-755479 Sat, 04 Jun 2022 13:31:40 +0000 https://randomnerdtutorials.com/?p=84445#comment-755479 install SimpleDHT! works FINE!
o problema é a biblioteca. então instale a Simple DHT:
#include <SimpleDHT.h>

// for DHT22,
// VCC: 5V or 3V
// GND: GND
// DATA: 2
int pinDHT22 = 4;
SimpleDHT22 dht22(pinDHT22);

void setup() {
Serial.begin(115200);
}

void loop() {
// start working…
Serial.println(“=================================”);
Serial.println(“Sample DHT22…”);

// read without samples.
// @remark We use read2 to get a float data, such as 10.1C
// if user doesn’t care about the accurate data, use read to get a byte data, such as 10
C.
float temperature = 0;
float humidity = 0;
int err = SimpleDHTErrSuccess;
if ((err = dht22.read2(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
Serial.print(“Read DHT22 failed, err=”); Serial.print(SimpleDHTErrCode(err));
Serial.print(“,”); Serial.println(SimpleDHTErrDuration(err)); delay(2000);
return;
}

Serial.print(“Sample OK: “);
Serial.print((float)temperature); Serial.print(” *C, “);
Serial.print((float)humidity); Serial.println(” RH%”);

// DHT22 sampling rate is 0.5HZ.
delay(2500);
}

]]>
By: shooter https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-739725 Tue, 19 Apr 2022 06:24:01 +0000 https://randomnerdtutorials.com/?p=84445#comment-739725 In reply to Manmohan Rathi.

meaning that i need to use clk pin instead of D5 on my esp8266?

]]>
By: Manmohan Rathi https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-733122 Mon, 21 Mar 2022 17:23:41 +0000 https://randomnerdtutorials.com/?p=84445#comment-733122 In reply to Stumble.

Brother!! Can’t be grateful enought for this!! I’ve been trying to figure this out since like 3 4 hours!! Your comment solved it! Have a good life Mate!!!

]]>
By: Stefan https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/#comment-634876 Thu, 24 Jun 2021 05:55:36 +0000 https://randomnerdtutorials.com/?p=84445#comment-634876 Hi,
I have this problem with an AM2302 and Atmega 328:first reading it’s OK and then I change conditions(temp and humid) and nothing happens.But,if I reset the microcontroller,the new reading it’s correct.And so one.
In the beginning of sketch I have “delay_ms(2000);”
Can someone tells me why?
Thank you.

]]>