6

I have an IoT device in the field measuring temperature next to a wind machine. See this video for an explanation as to what a wind machine is—basically a big fan attached to an engine.

Last night, while the wind machine was running, I started getting temperature readings that were rapidly changing, with a maximum change of 29F in 7 seconds. See chart below, and data at this link: diagram depicting normal and oscillating operation.

I've never seen anything like this before and I've got 50+ DS18B20 probes in the field for similar use cases. I make sure to recalc CRC from the probe and do a number of tests for real values, so I am pretty sure the values below equate to what the DS18B20 actually thought the temperature was.

My best theory is that the temperature probe got wet, and then the fan blowing air across it cooled the probe down. This explanation seems like it fits the best, but I don't understand how it can make the DS18B20 go as low as it does in the data—the lowest temperature recorded is -24C° / -12F°, which seems impossible.

Is there anything else that could cause this?

2 Answers 2

4

Keep in mind that the value returned from the DS18B20 is depending on the voltage received. If this voltage has fluctuations, then your readings are going to flux as well. I've seen mine go from 20C to -127C in seconds...found out one of my wires was starting to short. Replaced the wire, problem went away. I would hazard a guess that maybe something along those lines is happening to your sensor?

3
  • 1
    This seems unlikely, as I am recalculating the CRC on my host device. I would agree with @brendmcl. When you encountered this, were you recalculating CRC? May 11, 2018 at 18:38
  • 1
    @HeathWestbrook: No, I was not. I was actually doing a read several times a second and then doing an average....while throwing out reading that were +/- 10% from the current moving average. What Brendan says makes sense; wild voltage fluctuations would certainly make it hard to report the temp :) If you suspect the voltage is not steady, you could always put a capacitor across the power lines to try and smooth it out a bit.
    – JD Allen
    May 11, 2018 at 22:21
  • 1
    Another wild card to keep in mind is the tolerance on the pull-up resistor. I expect resistance would vary substantially if it were exposed to such thermal changes. However, again in this case your CRC would catch it as it only effects the digital transmission of the reading, not the taking of it. Re: taking readings several times per second - might be something to look at. Some of my DSs take up to 500ms to read and transmit a single reading (not sure if the block is in the reading or the transmitting though I suspect the latter).
    – BrendanMcL
    May 14, 2018 at 0:25
4

Re the previous answer: the DS18B20 is a digital sensor - it takes the reading locally, stores it locally and though a separate read process digitally transmits the result (usually 12bit resolution) on the OneWire bus to which it is attached. The transmission of the reading to the host is not voltage sensitive (in that a different voltage will represent a different temperature value). However, voltage problems can corrupt the signal.

The -127C reading is actually a return from the OneWire bus code of 0xFF (ie 1111 1111) which is an error from the bus that it failed to receive a reading from the DS18B20. As a decimal signed integer that is -127.

Re anomalous readings (that appear digitally valid), I don't have an exact root cause answer but have experienced and solved similar.

In my case a particular sensor on a longish cable run (approx 20m) both when sharing a bus with others and on its own occasionally returns 80c (whereas the usual range is 15-25 for water temperature in a header tank).

I at first though it a digital corruption via mismatched signal reflections especially when mixed with shorter runs, however this should have been detected in the CRC and on isolation to a single bus the problem continued anyway.

Interestingly I have narrowed the problem to rapid thermal changes in the wire temperature (dropping from 20C to 10C over an hour or so), even while the DS remained very stable, immersed in 20K litres of water. I put this down to a slight change in conductivity on the voltage supply wire. (If it where signal wire related then again the CRC should catch it). This could well be a similar situation with your fan activation.

I have solved it in two ways electrically (though neither are 100% reliable) and one way in software.

Electrically, locating the pull up resistor close to the sensor (rather than at the bus termination) gives far more stable results generally in terms of bus errors (avoiding the -127s). The other electrical solution was to increase the supply voltage to compensate for the longish run to 5.2v and also drop the bus end resistor down to 2.2K. This pretty much got rid of the odd 80C reading, but not entirely.

In software, I accepted that unreliability was to be dealt with and implemented some sanity checking whereby if a result came in that was clearly wrong, then my system (polling every 2 minutes), simply repeated the previous valid result along with a warning.

My software sanity checks include: basic range checking of possible valid values (> -5 < 70) which applies to all my sensors; and a check for out-of-bounds delta change since the last valid result using a tunable time window (in case a series of invalid results continue past the window - in which case I accept the next valid range value as really valid). This may or may not be appropriate given the rapid changes your wind machine could trigger.

Another possibly not to dismiss is that perhaps you just have a single dodgy sensor.

8
  • 1
    80C is close to 85C, and 85C is the power on reset value of the temperature register. Are you sure you were receiving 80C and not 85C? I make sure to not accept 85C on my host device through filtering like you've mentioned above. I also do other sanity checking, but as my devices encounter a wider range of temperatures, I allow valid readings to be as high as 60C and as low as -25C. All of the above readings fall into this band. This makes me think this is not an electrical issue and is more likely a phenomenon actually experienced by the ds18b20's sensor, like evaporation May 11, 2018 at 18:43
  • 1
    Yes, dry/wet baulb temps could be a factor - especially with air driven rapid evaporation - still very big jumps you are seeing. Good pickup on the 85c startup - I’ll go back and check my logs.
    – BrendanMcL
    May 12, 2018 at 22:27
  • 1
    @Heath Westbrook - right you are. Had to dig a bit but sure enough the values are 85C not 80. Many thanks - didn't realise this. Looking at my logs of the time, the occurrence is quite random, which leads to me to think its supply voltage problems causing it to reset per my other triangulation on the issue.
    – BrendanMcL
    May 14, 2018 at 0:11
  • 1
    @Heath Westbrook thinking further on your issue - does the period of oscillation coincide with the left-right pivoting of your fans? Any other temp or humidity sensors in the area (eg away from the wind) that could be used to range check the environment at the time? (watched your vid btw - quite interesting).
    – BrendanMcL
    May 14, 2018 at 0:16
  • 1
    @BrandonMCL NP on the 85C. I had this problem for a LONG time before I realized what was going on. May 15, 2018 at 4:02

Your Answer

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

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