Your DS18B20 temperature sensor is likely a fake, counterfeit, clone...

Maxim DS18B20

Chris Petrich

github.com

A test purchase of 1,000 sensors from 70 different sellers showed the majority to be counterfeits of extremely variable performance.

...unless you bought the chips directly from Maxim Integrated (or Dallas Semiconductor in the old days), an authorized distributor (DigiKey, RS, Farnell, Mouser, etc.), or a big retailer, or you took exceptionally good care purchasing waterproofed DS18B20 probes. We bought over 1000 "waterproof" probes or bare chips from more than 70 different vendors on ebay, AliExpress, and online stores -big and small- in 2019. All of the probes bought on ebay and AliExpress contained counterfeit DS18B20 sensors, and almost all sensors bought on those two sites were counterfeit.

How do I know?

If the ROM does not follow the pattern 28-xx-xx-xx-xx-00-00-xx then the DS18B20 sensor is a clone [1].

Also, there are two Arduino sketches provided to test DS18B20 sensors:

  • discover_fake_DS18B20.ino performs some harmless tests and indicates if they show deviations from authentic DS18B20. Not designed to work with parasitic power.
  • classify_fake_DS18B20.ino is a minimal implementation matching a sensor to a specific Family (see below) based on the response to undocumented function codes. Output is specific but rather boring. Use at your own risk.

Why should I care?

Besides ethical concerns, some of the counterfeit sensors actually do not work in parasitic power mode, have a high noise level, temperature offset outside the advertised ±0.5 °C band, do not contain an EEPROM, have bugs and unspecified failure rates, or differ in another unknown manner from the specifications in the Maxim datasheet. Clearly, the problems are not big enough to discourage people from buying probes on ebay, but it may be good to know the actual specs when the data are important or measurement conditions are difficult.

What are we dealing with?

Definitions differ, but following AIR6273, a counterfeit is an unauthorized copy, imitation, substitute, or modification misrepresented as a specific genuie item from an authorized manufacturer [3]. As of 2019, the main problem is imitations (clones) that are labeled to mislead the unsuspecting buyer. Fortunately, DS18B20 clones are nearly trivially easy to identify: Marking on the chip printed rather than lasered? No mark in the rear indent? Probably a conterfeit. Content of the "scratchpad register" doesn't comply with the datasheet? Probably a counterfeit. Behaves systematically different from known authentic chips? Probably a counterfeit.

What do they look like?

Above (Figure 1) is an example of an authentic, Maxim-produced DS18B20 sensor in TO-92 case.

Example of an authentic, Maxim-produced DS18B20 sensor in TO-92 case.
Figure 1. Example of an authentic, Maxim-produced DS18B20 sensor in TO-92 case.
  • As of writing (2019), the topmark of original Maxim chips is lasered rather than printed.
  • The first two rows, DALLAS 18B20, specify that this part is a DS18B20 (Dallas Semiconductor being the original producer), parasitic power-only chips bear the maring DALLAS 18B20P.
  • The "+" in the 4th row indicates that the part is RoHS compliant ([2]).
  • The 3rd row specifies production year and week number of the year (in this case, week 32 of 2019), and
  • the last two characters in row 3 specify the revision of the die (currently C4).
  • In row 4, the three-digit number followed by two characters are a form of batch code that allows Maxim to trace back the production history.
  • In chips produced 2016 or later I've only come across character combinations AB and AC [1].

The marking inside the indent on the rear of the case is:

  • P (Philippines?) on all recent chips (2016 and younger), and on most(?) chips going back at least as far as 2009 [5].
  • THAI [letter] (Thailand?) where [letter] is one of I, J, K, L, M, N, O, S, T, U, V, W, X and possibly others, at least on some chips produced in 2011 [1]. The uses a different font than the letters making up THAI.

From what I've seen on the TO-92 package, there is exactly one batch code associated with a date code for chips marked P in the indent. This does not hold true for chips marked THAI in the indent [5].

How do I know if I am affected?

If the DS18B20 have been bought from authorized dealers though a controlled supply chain then the chips are legit.

Otherwise, (I) one can test for compliance with the datasheet. (One should actually, as even authentic parts may have been mishandled along an unauthorized distribution chain. But that's yet another issue.) If a sensor fails any of those tests, it is a fake (unless Maxim's implementation is buggy). (II) one can compare sensor behavior with the behavior of Maxim-produced DS18B20. Those tests are based on the conjecture that all Maxim-produced DS18B20 behave alike. This should be the case at least for sensors that share a die code (which has been C4 since at least 2009) [1].

Regarding (I), discrepancy between what the current datasheet says should happen and what the sensors do include [1]

  • Family B: reserved bytes in scratchpad register can be overwritten (by following instructions in the datasheet)
  • Family C: the sensor is fixed in 12-bit mode (i.e., byte 4 of the scratchpad register is always 0x7f)
  • Family C: the number of EEPROM write cycles is very small (order of 10 rather than >50k)
  • Family B1, D1: ROM can be changed in software, i.e. it is not lasered
  • Family A2, B2, D: significant number of sensors with offsets outside the ±0.5 °C range at 0 °C
  • Family D: sensor does not respond in parasitic mode (applies to most sensors of Family D)
  • Family D: the temperature reading right after power-up is 25 rather than 85 °C
  • Family D: sensor does not perform low-resolution temperature conversions faster
  • Family D: reserved bytes 5 and 7 of the scratchpad register are not 0xff and 0x10, respectively
  • Family D1: retains temperature measurements during power cycles

Hence, as of writing (2019), every fake sensor available does not comply with the datasheet in at least one way.

Regarding (II), there is one pathetically simple test for differences with Maxim-produced DS18B20 sensors that apparently all counterfeit sensors fail [1]:

It is a fake if its ROM address does not follow the pattern 28-xx-xx-xx-xx-00-00-xx [5]. (Maxim's ROM is essentially a 48-bit counter with the most significant bits still at 0 [1].) Also, with the exception of rare Family A2, none of the fake sensors adjust reserved byte 6 in the scratchpad register correctly or respond correctly to undocumented function codes regarding the Trim values.

In addition to obvious implementation differences such as those listed above under (I) and (II), there are also side-channel data that can be used to separate implementations. For example, the time reported for a 12 bit-temperature conversion (as determined by polling for completion after function code 0x44 at room temperature) is characteristic for individual chips (reproducible to much better than 1% at constant temperature) and falls within distinct ranges determined by the circuit's internals [1]:

  • 11 ms: Family D1
  • 28-30 ms: Family C
  • 325-505 ms: Family A2
  • 460-525 ms: Family D2
  • 580-615 ms: Family A1
  • 585-730 ms: Family B

Hence, there will be some edge cases between Families A and B, but simply measuring the time used for temperature conversion will often be sufficient to determine if a sensor is counterfeit.

An important aspect for operation is a sensor's ability to pull the data line low against the fixed pull-up resistor. Turns out this abilitly differs between families. The datasheet guarantees that a sensor is able to sink at least 4 mA at 0.4 V at any temperature up to 125 °C [2]. Providing a current of 4 mA (1.2 kOhm pull-up resistor against 5 V), the following low voltages were achieved by the sensors at room temperature (note that only 5 to 10 sensors were measured per Family):

  • Family A1: 0.058 - 0.062 V
  • Family B2: 0.068 - 0.112 V (all but one sensor: 0.068 - 0.075 V)
  • Family C: 0.036 - 0.040 V
  • Family D2: 0.121 - 0.124 V

All sensors are well within specs at room temperature but clustering of data by Family is apparent, indicating that the hardware was designed independently. It could be interesting to repeat these measurements above 100 °C.

Alternatively,

It is a fake if the date--batch combination printed on the case of the sensor is not in the Maxim database (need to ask Maxim tech support to find out). (Note that there are counterfeits that use "authentic" date--batch combination.)

Note that none of the points above give certainty that a particular DS18B20 is an authentic Maxim product, but if any of the tests above indicate "fake" then it is most defintely counterfeit [1].

Decapping DS18B20

This collage (Figure 2) shows photos of the dies of all DS18B20 Families we encountered in 2019. All photos are at the same scale, approx. 1.4 mm in width. We broke the TO-92 case open with pliers, detached the die from the plastic case by boiling in colophony, and removed the colophony with acetone in an ultrasonic bath. Photos were taken with a rather ancient USB camera.

Photos of the dies of all DS18B20 Families we encountered in 2019
Figure 2. Photos of the dies of all DS18B20 Families we encountered in 2019

Family A1 is the authentic Maxim-produced DS18B20 (C4 die). All other families are clones. Note the similarities between the dies of Families D1 and D2 (consistent with their similarity in software) and the signifcant differences between Families B1 and B2 (as opposed to their similarity in software).

References

  1. Article and additional materials on github.com
  2. DS18B20 Datasheet, Maxim Integrated
  3. AIR6273 "Terms, Definitions, and Acronyms Counterfeit Materiel or Electrical, Electronic, and Electromechanical Parts", SAE Aerospace Information Report, July 2019.

Downloads

  1. Arduino sketches to test DS18B20 sensors
EMS supplier