DHT22 Problem

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

DHT22 Problem

#1 Post by CHK_BLN » 25 Dec 2015, 11:45

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

mrb
Normal user
Posts: 11
Joined: 15 Dec 2015, 13:54

Re: DHT22 Problem

#2 Post by mrb » 25 Dec 2015, 15:08

low voltage could be an issue. do you have a pull-up resistor on the data pin?

CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

Re: DHT22 Problem

#3 Post by CHK_BLN » 25 Dec 2015, 20:22

Hi

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

mrb
Normal user
Posts: 11
Joined: 15 Dec 2015, 13:54

Re: DHT22 Problem

#4 Post by mrb » 26 Dec 2015, 19:34

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.

CHK_BLN
Normal user
Posts: 24
Joined: 19 Nov 2015, 22:14

Re: DHT22 Problem

#5 Post by CHK_BLN » 26 Dec 2015, 20:05

another GPIO I have already tested without success
How does the reset command from the serial Interace?

mrb
Normal user
Posts: 11
Joined: 15 Dec 2015, 13:54

Re: DHT22 Problem

#6 Post by mrb » 27 Dec 2015, 02:16

in arduino software under tools menu open serial monitor and type reset and press enter, esp will reboot to factory default config.

VasilijHCN
Normal user
Posts: 18
Joined: 08 Oct 2015, 18:02

Re: DHT22 Problem

#7 Post by VasilijHCN » 21 Jan 2016, 08:45

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.

chrille
Normal user
Posts: 88
Joined: 26 Aug 2015, 15:11
Location: Horsens, Denmark

Re: DHT22 Problem

#8 Post by chrille » 21 Jan 2016, 13:59

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
Jan Chrillesen, Denmark

orca30
Normal user
Posts: 6
Joined: 14 Nov 2015, 20:58

Re: DHT22 Problem

#9 Post by orca30 » 22 Jan 2016, 10:33

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.

Helm
Normal user
Posts: 2
Joined: 10 Feb 2016, 07:43

Re: DHT22 Problem

#10 Post by Helm » 10 Feb 2016, 07:53

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.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: DHT22 Problem

#11 Post by tozett » 10 Feb 2016, 17:08

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

costo
Normal user
Posts: 490
Joined: 21 Nov 2015, 15:03

Re: DHT22 Problem

#12 Post by costo » 10 Feb 2016, 17:16

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.

Helm
Normal user
Posts: 2
Joined: 10 Feb 2016, 07:43

Re: DHT22 Problem

#13 Post by Helm » 10 Feb 2016, 19:22

Bingo, the missing IDX number was the problem.

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

highroller
Normal user
Posts: 31
Joined: 09 Feb 2016, 22:16

Re: DHT22 Problem

#14 Post by highroller » 10 Feb 2016, 20:34

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.

DonJuanito
Normal user
Posts: 7
Joined: 16 Mar 2016, 20:01

Re: DHT22 Problem

#15 Post by DonJuanito » 16 Mar 2016, 20:07

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...

Martinus

Re: DHT22 Problem

#16 Post by Martinus » 19 Mar 2016, 13:28

Changed to 20 in R88. See if it helps...

cherowley
Normal user
Posts: 125
Joined: 14 Jan 2016, 09:39

Re: DHT22 Problem

#17 Post by cherowley » 20 Mar 2016, 12:53

Seems good in r90 :)

Edit: woops, is in fact r90...
Last edited by cherowley on 20 Mar 2016, 14:35, edited 1 time in total.

Martinus

Re: DHT22 Problem

#18 Post by Martinus » 20 Mar 2016, 13:45

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.

orca30
Normal user
Posts: 6
Joined: 14 Nov 2015, 20:58

Re: DHT22 Problem

#19 Post by orca30 » 12 May 2016, 21:43

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

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: DHT22 Problem

#20 Post by adrianmihalko » 27 Sep 2016, 17:29

I had same problem, you must fill in IDX number, after that works, but this should be fixed.

Drum
Normal user
Posts: 299
Joined: 07 Feb 2016, 11:56

Re: DHT22 Problem

#21 Post by Drum » 27 Sep 2016, 18:01

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.

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: DHT22 Problem

#22 Post by adrianmihalko » 27 Sep 2016, 20:58

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 5718 times
:oops:

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: DHT22 Problem

#23 Post by adrianmihalko » 28 Sep 2016, 00:15

*is too low

Drum
Normal user
Posts: 299
Joined: 07 Feb 2016, 11:56

Re: DHT22 Problem

#24 Post by Drum » 28 Sep 2016, 15:48

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.

adrianmihalko
Normal user
Posts: 51
Joined: 15 Sep 2016, 00:20

Re: DHT22 Problem

#25 Post by adrianmihalko » 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.

User avatar
beic
Normal user
Posts: 117
Joined: 18 Aug 2016, 18:19

Re: DHT22 Problem

#26 Post by beic » 23 Apr 2017, 18:24

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

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests