robert-hh / Onewire_DS18X20

Classes for driving the DS18x20 sensor with the onewire protocol for Pycom MicroPython
12 stars 6 forks source link

85 °C problem #16

Closed ClemensGruber closed 1 year ago

ClemensGruber commented 4 years ago

I don't know if this is included in the current version. Sometimes you see with DS18B20 sensors 85 °C readings but this may be an error code. To distinguish between error code and true readings I found this interesting information under https://github.com/cpetrich/counterfeit_DS18B20

Solution to the 85 °C-Problem

There is a simple, undocumented, way to discriminate between the power-up 85 °C-reading and a genuie temperature reading of 85 °C in authentic DS18B20 [5]: <byte 6> of the scratchpad register. If it is 0x0c , then the 85 °C-reading is a power-up reading, otherwise it is a true temperature measurement. Does not work with clones of Families B, C, or D, though.

see also https://github.com/robert-hh/Onewire_DS18X20/issues/7

robert-hh commented 4 years ago

Thanks for the hint. It is easy to implement a check, but would sort out some of the counterfeit devices, which would otherwise still reasonably work. Not that I care much about these, but I see complaint coming.

robert-hh commented 4 years ago

Doing a few tests, the check for 0x0c in byte 6 is not a useful one, since that value occurs for good readings too. In my test this was at 25.25 °C, in a proper up and down slope of temperature readings.

ClemensGruber commented 4 years ago

Did you get this reading on a counterfeit devices? ;-) Yes perhaps too optimistic to count on original chips only. He, so we have no option to distinguish between "true" and error code readings? And developer have to decide on application level to replace 85.00 °c with missings or not!?

robert-hh commented 4 years ago

No. The devices I have seem to be genuine ones: Laser printed and with the P stamp on the back.

He, so we have no option to distinguish between "true" and error code readings? And developer have to decide on application level to replace 85.00 °c with missings or not!?

We have been at that point of the discussion already with Andreas (@amotl)

robert-hh commented 4 years ago

I tested one device, which value byte 6 has at 85°C, and it was 0x10. But that is just a single test, and the value of byte 6 varies between 0x01 and 0x10 over the whole test range of 22°C to 90°C. I expect it to be different from 0x10 at 85°C for a different device. P.S.: I heated the DS18B20 with a soldering iron. I could also clip a load resistor on it and heat it with that one. These resistors are usually good for up to at least 200°C.