# Fine-tuning/calibrating DS18b20 thermometer via 1-wire

I am trying to enable remote reading of the temperature gauges in my furnace room by adding DS18B20 thermometers.
Since I had some Raspberry Pis and DS18B20s, and some networking equipment on hand, I decided to crimp on a couple of RJ45 jacks and chain some RJ45 sockets together, with a final network cable with a 1kΩ resistor between the data and 3v wires. This works fine, except for the fact that the temperatures diverge more than I'd like...

Executing cat /sys/bus/w1/devices/28*/w1_slave returns the temperature, but even with the sensors lying next to each other, they diverge by more than 1.5°C I have monitored them over a longer period of time, even covering them with my hand, and keeping them right next to each other.

## Sample output

ad 01 55 05 7f 7e 81 66 16 : crc=16 YES
ad 01 55 05 7f 7e 81 66 16 t=26812
b4 01 55 05 7f 7e 81 66 2b : crc=2b YES
b4 01 55 05 7f 7e 81 66 2b t=27250


## My setup

Is there a way to calibrate them to the same temperature? I would hate to have to take individual quirks into account, as even if I was to round to nearest 2°C there is no real way to be sure they would be in the same increment. And replacing sensors would mean recalibrating values in my code.

The reason for wanting this is that I want to detect whether the furnace is heating the water at the moment, or the water is at target temperature, or (hopefully not) that the incoming water is warmer than the outgoing water, meaning that my hot water tank is heating the house. If I cannot trust the readings, I may get too many false positives.

I have read guides like this instructable, but as far as I can see, this is gathering the calibration data, and not calibrating the actual sensor...

• As far as I remember the genuine parts are +/-0.5°C. Are you sure yours are genuine? For calibration put them in water rather than air. Then stir. – Transistor Mar 22 at 21:03
• Not sure at all. I think i got them off ebay. I guess I'll try acquiring some from a more reputable vendor instead and see if they are more accurate. – Jonas Stumph Stevnsvig Mar 22 at 21:13

Unfortunately, fake DS18B20 devices are well known to be (a) inaccurate, and (b) have varying readings even in a stable environment. The chances of your devices from eBay being fake, is approximately 100%.

This graph, taken from this answer on the earlier question: "Which one of these DS18B20 temperature sensors is fake?" shows the problem. The one genuine device is obviously the stable, top red line. The other 4 unstable and inaccurate readings are from the fake devices.

Answers to that earlier question have several useful links, including this GitHub repo:

https://github.com/cpetrich/counterfeit_DS18B20

which has two Arduino sketches that can help to identify fakes.

Useful search terms include - DS18B20 counterfeit accuracy

• "The chances of your devices from eBay being fake, is approximately 100%". Haha – Christianidis Vasileios Mar 22 at 21:27
• looked at the github and read "If the ROM does not follow the pattern 28-xx-xx-xx-xx-00-00-xx then the DS18B20 sensor is a clone" mine are 77-01-xx and 77-34-xx so most likely the answer – Jonas Stumph Stevnsvig Mar 22 at 21:31

According to the datasheet this is the typical performance curve:

Maybe they are not original, or maybe you have one of the "lucky" 0.27% ones which went beyond the 3-sigma interval.

I also suspect that the voltage that reaches the sensors are not the same. The wires are long, there will be voltage drop. Make sure the contact is good. You can try and swap the connectors of the two thermometers and see if something changes.