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 -
Radio waking up for no reason.
Development • 4 Jul 2020, 21:09 • Sasquatch 15 Jan 2025, 08:33 -
Counting Incoming and Outgoing Messages from a Gateway
Development • 10 Dec 2024, 21:57 • Trand 14 Dec 2024, 20:23 -
Sending offset to node
Development • 31 Jan 2025, 00:59 • bsl88k 4 Feb 2025, 12:14 -
MQTT-Help me understand about the MQTT Gateway.
Development • 2 Mar 2025, 01:44 • dpcons 12 Mar 2025, 23:39 -
Saving last known good state, but not in EEPROM
Development • 30 Jan 2024, 18:46 • OldSurferDude 15 Jan 2025, 08:51