# DHT22 Error Message

**URL:** https://discourse.nodered.org/t/dht22-error-message/75170
**Category:** General
**Created:** [14 February 2023 10:51 UTC](https://discourse.nodered.org/t/dht22-error-message/75170 "2023-02-14T10:51:45Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![mdj](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@mdj](https://discourse.nodered.org/u/mdj)
#### Post date: [14 February 2023 10:51 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/1 "2023-02-14T10:51:45Z")

</div>

Hi  
I am new to Node-RED and I am trying to setup a simple temp & humidity sensor using a DHT22 but I have an error on the message output.

My setup is  
RPi 4  
OS Bullseye 64bit  
Waveshare DHT22 - 3 cable output  
Node-RED 3.0.2  
Node.js v18.14.0

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/f/8fc550230007bb8a4a9484dcf3102f3267139509.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc5829d32f19de50555ab439fdb333dcc0d76b80.png)

From the Waveshare SLD information the DHT22 shows a 5.1k resistor across vcc and the data pin, so there is no need for another pull resistor, I have connected the DHT direct to the pin on the RPi GPIO, as this sensors comes with a XH2.54 3-pin cable that can be plugged into the GPIO's on the RPi.

PINs used are  
PIN 1 - 3.3v  
PIN 6 - GND  
PIN7 - (GPIO4)

I followed the install process on Node-RED for the DHT22 node and its dependencies but I cannot get the readings output via the debug msg, the error message isvalid: false and errors: 4. I just don't know how to solve it.

I also tried this with OS Buster,  
I also tried 5v PIN,

no change in output msg.

Any help much appreciated.

Thanks,  
Martin

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [14 February 2023 11:12 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/2 "2023-02-14T11:12:05Z")

</div>

> [@mdj](#):
>
> PIN 1 - 3.3v  
> I also tried 5v PIN,

Not sure but I think the DHT22's output is at it's supplied voltage and Raspberry Pi GPIO pins are not safe at 5V.

 ![Untitled 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/a/cae736a62a6048dfc65f67b3fe935af8358e04e5.jpeg)

Try using another GPIO pin, at 3,3V

---

<div class="post-metadata">

### Author: ![mdj](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@mdj](https://discourse.nodered.org/u/mdj)
#### Post date: [14 February 2023 11:22 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/3 "2023-02-14T11:22:36Z")

</div>

Many thanks for the feedback, my default setting is the 3.3v PIN which gives the main error I listed. I just tried 5v PIN to see if it made any difference but no change to the output.  
I have it currently connected to 3.3v PIN.

---

<div class="post-metadata">

### Author: ![gerry](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gerry/32/21604_2.png) [@gerry](https://discourse.nodered.org/u/gerry)
#### Post date: [14 February 2023 13:20 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/4 "2023-02-14T13:20:53Z")

</div>

I have a dozen of these running and have found them reliable but a pain to setup. Also, they are extremely slow and I don't poll them more than 1 every 3 seconds max. Figuring out how to connect them was at best confusing as there were several options such as bcm numbering, physical pin and some others. As I recall there was a lot of trial and error in looking up pin numbers and changing data pins on different gpio pins until I found a combination that worked. Do you have other dht22's you can try? Although that sensor seems pretty robust I'm concerned about having hooked it up to 5 V. I don't remember the spec off hand but I think it's a 3.3 volt device.

---

<div class="post-metadata">

### Author: ![mdj](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@mdj](https://discourse.nodered.org/u/mdj)
#### Post date: [14 February 2023 15:00 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/5 "2023-02-14T15:00:04Z")

</div>

No this is the only one I have which I bought to try out Node-Red with my RPi  
I seen YouTube video's of the same and it looks like being straight forward, but the error does not tell me anything.  
So I cannot figure out is it the dht22 node, BCM, the sensor or my permissions.  
I am currently checking now if my permissions are right as I have it starting on boot, and start the localhost interface to bring up the dashboard as admin user which is different to my pi login details.  
Ultimately, I want to collect the data with MQTT store that in influx with Node-RED creating the flow and display with Grafana.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [14 February 2023 16:58 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/6 "2023-02-14T16:58:45Z")

</div>

This is why so many of us:

a) No longer use DHT sensors 😁  
b) Don't use Pi GPIO.

It seems a lot easier and more reliable to stick sensors into a cheap ESP and send outputs direct to MQTT.

Also, last time I looked, DHT sensors were finally more expensive than newer, better sensors. I guess because nobody wants them any more. Not only are they slow (and they certainly will return errors if you access them too quickly), they are very inaccurate (even the 22's) and the sensors drift out of alignment over time. Of course, we all have some stock of them which is a bit annoying. 🙂

---

<div class="post-metadata">

### Author: ![mdj](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@mdj](https://discourse.nodered.org/u/mdj)
#### Post date: [15 February 2023 09:09 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/7 "2023-02-15T09:09:42Z")

</div>

Many thanks for the feedback, that's my next step now and get a ESP32 DEV board

---

<div class="post-metadata">

### Author: ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)
#### Post date: [15 February 2023 09:59 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/8 "2023-02-15T09:59:51Z")

</div>

Don't overlook the humble Wemos D1 Mini (probably even cheaper than the ESP32 Dev board) and perfectly adequate for the simple task you described.  
AliExpress do a version with a Type-C USB connector.

> **[1.72US $ 18% OFF|Esp8266 Esp-12 Esp-12f Ch340g Ch340 V2 Usb Wemos D1 Mini Pro...](https://www.aliexpress.us/item/2251832465432818.html?spm=a2g0o.productlist.main.1.30d22f11HxgyCp&algo_pvid=7fd8b1e6-e2f2-4e2b-bcad-aba951d25af7&aem_p4p_detail=202302150942354527169138296900007670003&algo_exp_id=7fd8b1e6-e2f2-4e2b-bcad-aba951d25af7-0&pdp_ext_f=%7B%22sku_id%22%3A%2266484777552%22%7D&pdp_npi=3%40dis%21GBP%211.79%211.47%21%21%21%21%21%402145279016764829553308802d06cb%2166484777552%21sea%21UK%211844326759&curPageLogUid=BtNio7niwzTz&ad_pvid=202302150942354527169138296900007670003_1&ad_pvid=202302150942354527169138296900007670003_1&gatewayAdapt=glo2usa4itemAdapt&_randl_shipto=US)**
>
> Smarter Shopping, Better Living! Aliexpress.com

If you just want to measure temperature the DS18B20 is a good choice. If you need to measure humidity and air pressure as well, then you might want to consider the BME280.

---

<div class="post-metadata">

### Author: ![mdj](https://avatars.discourse-cdn.com/v4/letter/m/eb8c5e/32.png) [@mdj](https://discourse.nodered.org/u/mdj)
#### Post date: [15 February 2023 12:48 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/9 "2023-02-15T12:48:14Z")

</div>

Great suggestions and many thanks, I will look at those option

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [16 April 2023 12:48 UTC](https://discourse.nodered.org/t/dht22-error-message/75170/10 "2023-04-16T12:48:38Z")

</div>

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