DHT22 - switched sensor types?
-
Hi,
i am trying to set up a DHT22 node. This is my first step with mysensors ever. After figuring out some hardware issues, all connection is working, at least for a distance of around 1 meters.
However, i'd like to ask how big can a temperature offset of a DHT22 sensor be? I have a room temperature of around 22°C, however, this sensor shows around 28°C - and a humiditiy of 23%. So, either the measurement tolerance is quite big, or i have somehow switched both readings.
This is the code i have flashed on the node: https://pastebin.com/E2XWu3F3
And this is how it appears in Home Assistant: https://pastebin.com/rLWn91wsIs my code correct? I think i have some weird errors, e.g. only increasing temperature is registered, when decreasing temperature, the value isn't decreasing as well.
-
@simonszu Looks like you have the temp and humidity swapped around in the send message part
here is a direct copy of your sketch. you are sending the temperature in the humidity message and humidity in the temp message
send(msgHum.set(temperature, 1)); // this should be humidity #ifdef My_DEBUG Serial.print("T: ") Serial.println(temperature); #endif send(msgTemp.set(humidity, 1)); // this should be temperature
-
Ah. Yeah. Thanks. Sometimes one can be really blind when debugging own code.
-
@simonszu Yes I know the feeling well !! Hope it all works as expected now
-
dht sensors are not very accurate anyway
Suggested Topics
-
Arduino Celebrates 10 years (Malmö/Sweden)
Announcements • 29 Mar 2014, 17:08 • hek 29 Mar 2014, 17:08 -
PJON and Minicore not working
Development • 21 Mar 2025, 19:51 • Trand 21 Mar 2025, 19:51 -
LAN8720A - will mysensors work with this module
Development • 13 Nov 2024, 17:06 • Marcin 15 Nov 2024, 10:59 -
Adding Listen only device to my system.
Development • 26 Feb 2025, 00:39 • dpcons 26 Feb 2025, 06:26 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14