DHT22 AM2302 sensor doesn't work in nodered

Platform: pi 3 model B+ rev.1.3

OS: Rasbian

Node-RED: 1.0.5

Node.js: v12.17.0

problem node: node-red-contrib-dht-sensor v1.0.4

bcm2385 revision. a020d3

DHT22 sensor: AM2302

image

Hello I'm new in using Nodered but I found it perfect for my home automation project.

I bought 2 sensors DHT22 instead of the DHT11.

I used succesfully the DHT11 sensor connected to GPIO23 (physical pin 16) recieveing temperature and humidity values.

I changed the DHT11 with the DHT22 sensor connected to the same GPIO23 and changing the sensor model into the node-red-contrib to DHT22

and I recived wrong values as output:

{"_msgid":"99d420d7.3025b","topic":"rpi-dht22","payload":"0.00","humidity":"0.00","isValid":false,"errors":4,"location":"Test_T&H","sensorid":"dht22"}

I tried the same sensor with the same connection with Adafruit library and it works properly

I don't know how to solve it. But for me it's necessary to find a solution because I want to continue to work with nodered.

Can someone help me?

Thank you

Regards

I had the same thing happen when I switched from a dht11 to dht22. What finally fixed mine was changing the pin numbering from physical pins to bcm. Sounds dumb but it worked.

Thanks gerry for your suggestion but in my case it doesn't work. I changed from Physical pins (rev.2) to
BCM gpio

image

following my wiring connection

but I always received wrong values:

{"_msgid":"e68c589b.d4d8f8","topic":"rpi-dht22_test","payload":"0.00","humidity":"0.00","isValid":false,"errors":4,"location":"Test_T&H","sensorid":"dht22"}

I tried also to change the connection pin to other pins but nothing happened.

I thought the possible problem could be the correlation between the pins in the list node-red-contrib-dht-sensor and the real pins so I changed (and tested) all the proposed pin numbers into the node-red-contrib-dht-sensor list, but nothing.
Following my wiring pin table:
image

Could the problem be a no compatibility of the sensor DHT22 AM2302 with the node-red-contrib-dht-sensor? Or does it depend from my hardware configuration?
Does anyone know if there is an alternative palette to node-red-contrib-dht-sensor to control a DHT22 sensor into nodered?

Just to verify, did you install the BCM2835 library and node-dht-sensor as it says in the pre-req's?

No I didn't install the BMC libraries as told in the pre-req's.

But I just do it and update the BMC to the version 1.65:
image
Then I followed the other 2 steps in pre-req's and I re-installed the node-dht-sensor dependency and the node-red-contrib-dht-sensor node.
And I updated npm to the latest version (patch) 6.14.5 and Node-js to version 12.17.0

The output values coming from node-red-contrib-dht-sensor are still wrong with both BCM GPIO (in my case 23) or Physical pin rev.2 (in my case 16).

Are you sure you have the pins connected properly? Is it possible the dht22 pin outs on the board are different than the dht11?

After installing the BMC v1.65 library, node-dth-sensor and then the node-red-contrib-dht-sensor, I wired up a dht22 using:
Pin 1 (3.3v) to pin 1 of the dht22
Pin 6 (Gnd) to pin 4 of the dht22
Pin 16 (BCM 23) to pin 2 of the dht22
and a 10K resistor between pins 1 and 2 of the dht22

the node is reporting fine.

{"_msgid":"591e2642.bdc308",
  "topic":"rpi-dht22",
  "payload":"23.20",
  "humidity":"34.60",
  "isValid":true,"errors":1,
"sensorid":"dht22"}

I would uninstall/install node-red-contrib-dht-sensor and try again. If that doesn't work, try another dht22.

Just a note: Be careful with the resistor as many of the packaged DHT sensors have the resistor already in the circuit. I don't know if the DHT you are using has one or not but read the data sheet carefully.

Hello I bought and tested a new sensor DHT22 (a branded one) and now it works fine. So my problem was the sensor.
I suggest to buy brended sensors and not generic unbrended sensors and of course to use the good node-red-contrib-dht-sensor.
Thanks to gerry and zenofmud for your suggestions

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.