Page 1 of 1

DHT22 Problem

Posted: 25 Dec 2015, 11:45
by CHK_BLN
Hello

I use the R57 version. Also in the previous versions of the problem occurred.

On GPIO 14 I have a DHT 22 sensor is connected.
Unfortunately only 11,20 appear to temperature.
Hygro is 29.3%.
The values correspond to about half the correct values

Why is that? What could be the problem?

A 18B20 sensor working properly

Re: DHT22 Problem

Posted: 25 Dec 2015, 15:08
by mrb
low voltage could be an issue. do you have a pull-up resistor on the data pin?

Re: DHT22 Problem

Posted: 25 Dec 2015, 20:22
by CHK_BLN
Hi

The voltage is 3.5 volts
The resistance between VCC and the Data pin is 4.7K

Re: DHT22 Problem

Posted: 26 Dec 2015, 19:34
by mrb
I had a similar issue where it would read about half value every few minutes on R39 but updating to never version fixed it.
Other things to try would be a different pin on the ESP, reset command from the serial interface and flash the latest github revision again to do everything fresh.

Re: DHT22 Problem

Posted: 26 Dec 2015, 20:05
by CHK_BLN
another GPIO I have already tested without success
How does the reset command from the serial Interace?

Re: DHT22 Problem

Posted: 27 Dec 2015, 02:16
by mrb
in arduino software under tools menu open serial monitor and type reset and press enter, esp will reboot to factory default config.

Re: DHT22 Problem

Posted: 21 Jan 2016, 08:45
by VasilijHCN
I also get false readings from AM2302(similar to DHT22), 5k1 resistor to data pin, 3.7v power(single liion cell).
Using this in deep sleep mode, i think the priblem is in a sensor work after *awake* from sleep. temperature readings are 4 degrees error - humidity 50% error. Many people on the web report problems with am2302/dht22.
Solution - i ordered SI7021 and BME280 for my deepsleep mode sensors.

Re: DHT22 Problem

Posted: 21 Jan 2016, 13:59
by chrille
VasilijHCN wrote:I also get false readings from AM2302(similar to DHT22), 5k1 resistor to data pin, 3.7v power(single liion cell).
Using this in deep sleep mode, i think the priblem is in a sensor work after *awake* from sleep. temperature readings are 4 degrees error - humidity 50% error. Many people on the web report problems with am2302/dht22. .


I am experiencing the same - however my module isn't running with deepsleep. I have using AM2302/DHT22 on other ESP8266 modules, with the russian (wifi-iot.ru) software and it's been very reliable, as long as the power is 3.3V - if it drops just slightly below 3.3 it doesn't work and AM2321 or Si7021 is a better fit

- Jan

Re: DHT22 Problem

Posted: 22 Jan 2016, 10:33
by orca30
Same here. I have an AM2320, which runs fine with an Arduino. No results with ESP8266 (nan),

Strange, a DHT11 is running fine with the ESP8266.

Re: DHT22 Problem

Posted: 10 Feb 2016, 07:53
by Helm
Same problem here with DHT22 sensors.

I tried two different sensors with multiple boards type ESP-01 and ESP-12. The vallues are allways 0.00.
When i try it with LUA-code its working.

Any suggestions? I would really like to continue with ESPEASY.

Re: DHT22 Problem

Posted: 10 Feb 2016, 17:08
by tozett
Fill in any IDX number not being zero ??

other people, same problem, maybe here?
http://www.esp8266.nu/forum/viewtopic.p ... =755#p3685
or
http://www.esp8266.nu/forum/viewtopic.php?f=5&t=798

Re: DHT22 Problem

Posted: 10 Feb 2016, 17:16
by costo
Helm wrote:Same problem here with DHT22 sensors.

I tried two different sensors with multiple boards type ESP-01 and ESP-12. The vallues are allways 0.00.
When i try it with LUA-code its working.

Any suggestions? I would really like to continue with ESPEASY.

Did you select : DHT Type = "DHT22" in the task-setting of the device tab, and press 'Submit' ?
When you leave it default it will select DHT11 and this will not work.

Re: DHT22 Problem

Posted: 10 Feb 2016, 19:22
by Helm
Bingo, the missing IDX number was the problem.

That cost me some time, thank you tozett for the hint.

Re: DHT22 Problem

Posted: 10 Feb 2016, 20:34
by highroller
orca30 wrote:Same here. I have an AM2320, which runs fine with an Arduino. No results with ESP8266 (nan),

Strange, a DHT11 is running fine with the ESP8266.
Are you shure that you have connected the right gpio? The pinnumber is not the same as the gpio number (on nodemcu v1 d7 pin is not gpio 7 but 13). I got the "nan" status because of this.

Re: DHT22 Problem

Posted: 16 Mar 2016, 20:07
by DonJuanito
Hi.
If your DHT11/22 reads most of the time 'nan', you have to change a value in the source code of _P005_DHT.ino, around line 98.
Change from "delayMicroseconds(40)" to "delayMicroseconds(20);" :

Code: Select all

        pinMode(Plugin_005_DHT_Pin, OUTPUT);
        // DHT start condition, pull-down i/o pin for 18ms
        digitalWrite(Plugin_005_DHT_Pin, LOW);              // Pull low
        delay(18);
        digitalWrite(Plugin_005_DHT_Pin, HIGH);             // Pull high
        delayMicroseconds(20); // was 40. With 40, sensor returns NaN most of the time...
        pinMode(Plugin_005_DHT_Pin, INPUT);                 // change pin to input
        delayMicroseconds(10);
The value 40 has to be changed to 20, as 40 microseconds is the maximum, and 20 the minimum. Choosing to use the maximum value as not a good choice. I think it really should be changed in the Github trunk code...

Re: DHT22 Problem

Posted: 19 Mar 2016, 13:28
by Martinus
Changed to 20 in R88. See if it helps...

Re: DHT22 Problem

Posted: 20 Mar 2016, 12:53
by cherowley
Seems good in r90 :)

Edit: woops, is in fact r90...

Re: DHT22 Problem

Posted: 20 Mar 2016, 13:45
by Martinus
Changed another timing setting in DHT plugin. I got a few incorrect values in the domoticz chart (half the actual value). Seems fixed now in R90.

Re: DHT22 Problem

Posted: 12 May 2016, 21:43
by orca30
So, I got the DHT22 and the DHT11 running with a home-brew ESP8266 + USB adapter for power supply. Now I have a NodeMCU board on which I connected the DHT 22 and DHT 11.

I am using pin D7 (GPIO13), I have set the index and the DHT type correctly. I have applied the patch below (set DelayMicroseconds to 20). However, I get NaN most of the time and (very) seldom strange values from the DHT11 (12 degrees instead of 22).

Is it a problem with the 3,3v supply of the NodeMCU board? Did anybody manage to get the DHTs to run with the NodeMCU?

regards,
orca30

Re: DHT22 Problem

Posted: 27 Sep 2016, 17:29
by adrianmihalko
I had same problem, you must fill in IDX number, after that works, but this should be fixed.

Re: DHT22 Problem

Posted: 27 Sep 2016, 18:01
by Drum
Please check the voltage going to the DHT-11, and check the data sheet for it as well. It requires a pullup resistor and recommends a capacitor.

I have a nodeMCU(v1) and DHT-22 with a 2A wallwart which puts out 5.5V and I have a big capacitor on the 3.3V rail. Works better, but I think the AMS1117 and diode cut it down too much for the DHT-11 if you do not have really good power. I don't have problems when I use better voltage regulators.

If you really want to stick with NodeMCU I would suggest a BME-280.

Re: DHT22 Problem

Posted: 27 Sep 2016, 20:58
by adrianmihalko
My DHT22 is running now a few hours, but the Humidity reading is too high:
Screenshot 2016-09-27 20.54.39.png
Screenshot 2016-09-27 20.54.39.png (76.38 KiB) Viewed 21216 times
:oops:

Re: DHT22 Problem

Posted: 28 Sep 2016, 00:15
by adrianmihalko
*is too low

Re: DHT22 Problem

Posted: 28 Sep 2016, 15:48
by Drum
I usually have that problem with the DHT11, but no the DHT22... Could be a bad sensor. No idea if all the manufactures test them before they send them out.

Might be cheaper to use a more expensive and reliable sensor.

Re: DHT22 Problem

Posted: 28 Sep 2016, 20:27
by adrianmihalko
I am now trying to calibrate. 24hour with salt in a jar - it should be around 75%. Then I try to put in a jar filled with water - it should be around 100%.

SI7021 seem to be accurate out of the box.

BMP280 - is measuring +1C out of the box

BMP180 - temp OK, pressure little bit different than BMP280 (+-1hPa) who knows what is closer to reality.

Re: DHT22 Problem

Posted: 23 Apr 2017, 18:24
by beic
adrianmihalko wrote: 28 Sep 2016, 20:27 I am now trying to calibrate. 24hour with salt in a jar - it should be around 75%. Then I try to put in a jar filled with water - it should be around 100%.

SI7021 seem to be accurate out of the box.

BMP280 - is measuring +1C out of the box

BMP180 - temp OK, pressure little bit different than BMP280 (+-1hPa) who knows what is closer to reality.
Hi adrianmihalko,

I know it's an old post, but...

Did you managed to solve the AM2320 LOW humidity reading without calibration?

I bought 6pcs of it, 2pcs from one seller and 4pcs from another!

First I thought that the sensors are defective regarding the humidity measurement results.

All my sensors attached to one ESPEasy unit are measuring almost the same humidity level from 47% to 51% (HTU21D, SI7021, AM2301, DHT11, DHT22), but those AM2320 sensors always measuring to LOW humidity level from 31% to 33% again attached to the same device. :(

The AM2320 temperature reading is fine, but the humidity reading are just terrible!

Maybe it's a library issue?

Also, I managed to develop a plugin for the AM2320 sensor on the I2C bus, but again, I got to LOW humidity readings.

Any thoughts?

Kind regards,
Viktor