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?
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.
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
next week I'll be able to test it.
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.
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.
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.
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.