0

I have 2 IoT devices for measuring room temperature. Room does not have direct sunlight (it is north oriented and have tree in front of window). One is ESP8266 with DHT11 and next one is ESP8266 with DS18B20. DHT is on the table, away from PC. DS18B20 is on the top of bookshelf next to plant. Both of them shows temperature around 32-33 deg. celsius. It is not that hot in the room for sure. My home thermostat shows 23-24 deg. celsius. Outside temperature is about 15 deg. When I open the window and cool down the room, I can see temerature drop on both sensors, but still ony to around 26-28 celsius. I think, they are overheating themselves.

Code is almost same on both devices. Sampling every minute, so it should not be an issue of overloading sensors. Supply voltage is 3,3V. Not parasitic with 2k2 pull-up resistor.

What should I do to get correct temperature reading from these sensors?

EDIT: I have tired to get sensor out of PCB. First, I have just raised it for lengt of its legs (about 1cm) above board. It helped little, but it is visible, that sensor started cold, and slowly saturated heat from wires. So I took quite thick cables (0,25mm^2) and put sensor about 10cm away from board. And it helped! Temperature is about 23 degrees, what is somwhere in expected range. Most important is, that temperature curve was dropping before stabilizing. Spikes are just 85°C first reading. enter image description here

6
  • 1
    Have you checked, if they are warm? If yes, then they are broken and you need to replace them. Though I suspect more of a calibration problem
    – chrisl
    Oct 19, 2022 at 8:42
  • DHT is cold. DS is little bit warmer than object around, but it is new original chip. I will try to get my hands on another one
    – 110mat110
    Oct 19, 2022 at 8:46
  • I have bought brand new original DS18B20. Replaced other one. Temperature reading is still above 30⁰C. About 6⁰C above thermostat reading.
    – 110mat110
    Oct 19, 2022 at 17:41
  • 1
    start by separating the sensor from the microcontroller by an insulating barrier
    – jsotola
    Oct 19, 2022 at 20:47
  • 1
    Please write an own answer and mark it to help future visitors find a solution to their similar problem. Oct 20, 2022 at 13:16

2 Answers 2

2

It seems, that problem is in heat transfer from ESP chip to thermometer via wires. Worst it was, when chip was on board itself, little bit better when it was raised about 1cm out of board. I have achieved correct readings only when I put sensor on longer and quite thick leads to avoid heat transfer as much as possible.

1
  • I can't just now find a source for this but I have read in several places that the DS18b20's leads (and the ground-lead in particular) conduct heat into the device rather well, and in the case of the plastic-packaged devices that most of us use, probably have the dominant influence on the sensor. This suggests that either the ground lead be in intimate contact with the surface to be measured, or the leads be well insulated, thermally, from influences not of interest.
    – JRobert
    Oct 21, 2022 at 21:25
0

It does not surprise me that a sensor needs a correction to calculate the correct value. I have had the same problems with a range of sensors.

Because linearity is not really important when you need to measure only a room temperature, it would be sufficient to measure room temperature with a reliable thermometer and see how much you need to subtract to correct the value from your sensor. When still in doubt, you could cover the sensor with a plastic bag and measure the temperature dipped in a bowl of water with crushed ice cubes in it.

2
  • Unfortunately, that doesn't help if the error varies over time (e.g. when the sensor reading changes just because it's been on for hours)
    – PMF
    Oct 21, 2022 at 9:41
  • I agree with you that this can happen with a very inaccurate sensor. In my case the fault was specified in the datasheet. A 12 bit digital sensor, LM76 with an accuracy of 1 degree C.
    – hennep
    Oct 21, 2022 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.