[22:56:13][D][sensor:093]: 'Temperature': Sending state 23.30000 °C with 1 decimals of accuracy
[22:56:13][D][sensor:093]: 'Humidity': Sending state 38.00000 % with 0 decimals of accuracy
From my primary school days, I remember that 26.6 - 5.5 = 21.1.
I’ve also noted several times that after power down, the sensor starts reading totally different values well below zero.
[23:13:34][D][sensor:093]: 'Temperature': Sending state -18.30000 °C with 1 decimals of accuracy
[23:13:34][D][sensor:093]: 'Humidity': Sending state 24.90000 % with 0 decimals of accuracy
I live in an old house but it is not that cold. Usually the temperature inside the house is close to the outside temperature …
I’m puzzled by the initial inaccurate reading, which I would expect to be at most in 10th of a degree off the real temperature. Secondly, why does the offset not make mathematical sense?
If I remove the offset, the temperature goes back to 26.6C.
The leads are very short and I use a 4.7k pull-up resistor. I’m using the RX pin on a basic sonoff GPIO03 for the input. This pin is used for the initial programming but this configuration has worked in the past before my HA corrupted itself.
do you need the 4.7k resistor for it? If it’s the sensor module then it’s already built in all the ones i’ve ever seen. Why would you expect it to be at most a 10th of a degree off? What does the data sheet say the accuracy of these are? it’s accurate within 2-5% so at 26.6C that’s 0.5C - 1.3C would be within tolerance.
Although I still use some dht22’s and mine tend to only be off 1.0F, the dht11/22 are some of the worst and least accurate temp sensors. It’s probably not even the best choice to install in a Sonoff either. Why not use something like a thermistor or DS18B20? much smaller and better performance. The other alternative is a relay that already has a temperature sensor in too…
I recall to have read the need for a pull up resistor when I first implemented the sonoff’s 1 year ago. Can’t find it now. It might be needed for the input of the Sonoff to work properly.
The AM2302/DHT sensor’s datasheet says +/- 0.5 C accuracy, meaning, it is not within tolerance. Also, why the strange behaviour when I use and offset? I was more thinking of some kind of data corruption but I would expect a random temperature reading, not a consistent, incorrect reading, if that makes sense.
Try with pull-up resistor. If it report the same - get another sensot from box and try it.
There is lot of defective sensors, even sold under f.e. Sonoff name.
Prefer to have spare one every time
Thanks. You are right, you need a pull up resistor. There is a warning after compilation.
I seem to have found a work around. As I re-used the RX pin of the Sonoff for the data in from the AM2302/DHT sensor, at boot up, with the sensor in place, the Sonof won’t join the network. When I power the Sonoff up in situ, without the DHT, it boots properly and joins the network. If I insert the sensor at this stage, the readings are way out, e.g -17C. If I wirelessly update the Sonoff afterwards, it appears to have more reasonable temperature readings (still +7C to high) but I use filters with offset.
Maybe, as this is what I am going to try, I should use the Sonoff for what it is: an RF controlled mains switch, and get a separate temperature sensor (nodeMCU) for each room.
The original idea was so neat: radiator valve controlled by Sonoff with integrated temperature sensor.
Yes, it recommends using a 4.7k resistor. What im saying is most of them already come with with a pullup resistor built-in already if you are using a dht “module” and not the sensor all by itslef.
dht22 “module”
dht22 “sensor”
You should always still check to see if it has one or needs it but, you can find this information in the product specifications too.
The trick is…
You just gotta read YOUR product specs and not what every stranger online tells you to do because you may not be using the same terminolgy like module vs. sensor and people are on these forums all the time talking out their backside and have no clue what they’re even saying. Read your own documentation and there’s no confusion or doing things wrong.
Thank for the extensive reply. My mum said something similar about strangers . The problem is not the pull-up though. The readings are inaccurate and should be at least within+/- 0.5 deg. The readings are 5 to 10 degrees out?!?! If data is garbled (poor connection/interference) you would get inconsistent reading. Mine are consistent but with a gigantic offset.
My guess is that it has something to do with the Sonoff basic, re-usuing the RX input (used for programming via the pin header). If I interrupt power, with the sensor in situ, the readings tend to be sub zero (see screenshot). If I interrupt the power without the sensor and push the sensor in situ later, the readings tend to be out 5 to 8 degrees above the room temperature, which I correct with an offset in ESPHome.
I dont know. You never mentioned which sonoff you’re even using and there’s different versions of the Sonoff Basic so its anyones guess. My suggestion is just buy better relays that have temp/overheat sensors in them. Thats pretyy standard and power monitoring is becoming pretty standard too.
Shelly has a whole variety of relays, dimmers, rgb controllers, etc. They put access to the headers right on the backs, you dont even have to open the case to reflash them.
The temperature sensors in them are not for reporting room temperature either. Electronics get hot and putting a temp sensor next to hot Electronics wont give you good room temperatures. They only give you, “Hey! Something is wrong” warnings before they shut down in an attempt to not self destruct.
Theyre basically the same price but Shelly makes them easy to flash and gives instructions. They can accept mqtt, udp, webhooks with stock firmware and they act as BT gateways around your house just like a proxie does… Its an easy choice for me. https://www.shelly.com/en-us