DHT22 freeze for no reason

Platform: pi 3 model B+
OS: Rasbian
Node-RED: 1.0.3
Node.js: v12.14.0
problem node: node-red-contrib-dht-sensor v1.0.4
node-dht-sensor: 0.4.0
bcm2385 libs 1.60

Hi everybody,
I'm using a raspberry with node-red to control my heater - node-red-dht-sensor and node-red-heater. at the moment I have 2 sensors, one inside and one outside.
however, I encounter an issue with the 2 DHT22.
the sensors seem to freeze, anytime and not necessary at the same moment. Once freeze, it doesn't refresh anymore. I have either to reboot or sometimes it works by simply deconnecting the sensor and connect it back.

I have also replaced 1 of the 2 sensors with a new one and it freeze also.
the freeze can happen after 5 mins or after 2 days and I can't figure out why.

I try to find any help online but nothing. Do you have any idea what could make this freeze?

thanks

Welcome to the forum. The DHT series of sensors are not the most reliable, for temperature, the DS18B20 from Maxim is probably the most used sensor and is very easy to interface with node red if you are using a Rasperry Pi.

Hi,

I wanted to have the humidity but if I get only the temprature and it works, it's always better than temp/hum and not working.
I'll try :wink:
thanks

Is it more stable if you only use one sensor

one sensor? DHT22?
I did. I've noticed the second one wasn't connected for a moment (several days) :rofl: and even with this mistake the first DHT did freeze

THe DHT series are slow and not very accurate. If you read them too fast, they will return rubbish. Best advice is not to use them at all - ever!

It used to be that they were the only real option for a cheap temperature/humidity sensor but that is no longer true and there are far better options.

But as others have said, if you only want temperature, get a temp. only sensor like the reliable and very widely used DS18B20 or the TMP36.

I've ordered 2 sensors DS18B20 to replace the DHT and test them.

later, I4ll try again the BME280 because it has also some strange issues. but first, I need to have the temperature for my heater :smiley:
next week I'll be able to test it.

With the proviso that they are indeed genuine.

1 Like

Definitely, only buy them from a reputable source, there are many dubious clones about. If they are very cheap then they may well be clones.

1 Like

to let you know, I've reboot yesterday evening the raspberry and it works... for how long :slight_smile:

I also found the DHT22 to be very unreliable. They froze regularly on the Pi, less often on the ESP8266. Only power cycling the sensor would help. The communication seems to require very accurate timings.

I dumped them all for BME280 (temp, humidity and pressure). Absolutely no issues with those, even on longer lines (>5m) with two sensors connected. :slightly_smiling_face:

2 Likes

I can't see that in the link posted, but there is a lot there so I may just be missing it.

Here you go @Colin:

That is (I think) showing the average error found over a number of devices. You would expect the average error over a number of devices to be close to zero, as some will have positive errors and some negative. For example, if I had ten chips and 5 had and error of +0.4 degrees and 5 had an error of -0.4 degrees then the average error would be zero. So the curve does not say anything about the accuracy of individual devices.
However, If the average is a curve as they show, then that does beg the question as to why don't they remove the curve in the chip so the average is zero for the whole range.

1 Like

Probably true Colin.

I have 2 BME280 which I'll use later for another project

If your DHT is freezing it's not for "no reason" I have to weigh in here. I've done hardware for years and only recently started playing with the pi as a toy. I have used dozens of 18b20's and they are a good chip but so is the DHT series. Electronics in the real world are not always simply plug and play. The real world is messy with lot's of electrical noise and other considerations that perhaps are simply being overlooked. Depending on the length of the run type of wire is important (shielded vs non-shielded) filtering the power supply and the signal wires can be extremely important. If you are using the pi's power supply and running meters of wire the pi pwr may simply be insufficient at the end of the wire due to voltage drop. I would say the DHT is more finicky than the 18b20 but no less reliable or accurate for most needs. I don't have a laboratory calibrated temp sensor so I don't know how much error I have in my projects but it is certainly way more accurate than I have needed it to be plus the humidity was a requirement than made me move. from the 18b20's to the DHT series both the 11 and 22. In the dozen or so I have deployed I have never had a failure, either permanent or temporary or any sort of "freeze" requiring a reboot. Basic hardware design looking at voltage drops over wire run, signal noise and filtering over that run may easily fix your problem. Let's not be so hasty in laying blame on the chip. I have found them to be extremely reliable over the years. This is a programming forum but I assume you are looking for a reliable project at the end and good hardware design may solve your problem.

2 Likes

For temperature and humidity the SHT3x series from Sensirion offer very good value for money.
sensirion-humidity-sht3x-diagram-b9ff2 sensirion-humidity-sht3x-diagram-d4f4d

I believe they are much the same as the BME/BMP-280's, either is good.

I don't believe the DHT's claim the same accuracy as the 18b20 - been a while since I looked. But where the DHT's are really poor is in their humidity sensors. Possibly not really their fault as they were the first cheap sensor for humidity - and lets not forget that the DHT's are humidity sensors, they are not really designed as temperature sensors, its just that you cannot measure humidity electronically without measuring temperature as well.

If you ever compare DHTs side-by-side you will find typically at least 10%+ difference between them, I've seen 20%. They are also known to drift over time and so are likely to become less accurate. They also respond badly to high humidity levels and would require a long time to recover if they are hit with 100% humidity. We've already mentioned how slow they are to take a measurement as well.

There is really no reason to use DHT's now since the other sensors are about the same price or at least low enough not to worry about.