Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

counterfeit_DS18B20

> DevOps
Open source

How to tell original from fake DS18B20 temperature sensors.

685 stars0 likes2 views
WebsiteGitHub

About

How to tell original from fake DS18B20 temperature sensors.

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

...unless you bought the chips directly from Analog Devices (or Maxim Integrated before Analog Devices acquired them, 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.

Author: Chris Petrich, 30 Nov 2024. License: CC BY. Source: https://github.com/cpetrich/counterfeit_DS18B20/

(Sensor information based on sensors or probes ordered well after 2019 are either indicated as such or tagged with the year of addition, e.g. "(2020)".)

TLDR; 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 [5].

However, the ROM pattern is not a sufficient test for authenticity. Case in point, if the pattern is 28-xx-xx-xx-00-00-00-xx and the topmark specifies die C4 then the sensor is a clone because that ROM pattern pre-dates the C4 die, cf. Discussion 42. (2024)

There is an Arduino sketch provided to test DS18B20 sensors:

  • discover-classify_fake_DS18B20.ino is a menu-driven sketch that performs harmless tests that inidcate if a sensor shows deviations from Dallas/Maxim/Analog DS18B20. It can optionally attempt to match a sensor to a specific Family (see below), largely based on the response to undocumented function codes (use this function at your own risk). The sketch is not designed to work with parasite power. (As of 10 Nov 2024, the two sketches discover_fake_DS18B20.ino and classify_fake_DS18B20.ino from 2019 are removed as they are out of date.)

Nomenclature: The ROM 28-AA-BB-CC-DD-EE-FF-0C would be written 28-FFEEDDCCBBAA in the Linux 1-wire subsystem.

Overview as of 2024

There is the original/authentic DS18B20 (Family A1) which has stood the test of the time, and then there are clones that are either primarily designed to appear as authentic, or designed with innovative or at least useful features.

Within the first group we have Families A2 (obsolete) and A3 (a recent addition) that seem to have been designed to enter the market as counterfeits with the intent to deceive the customer. Family A3 copies every aspect of the originals that had been tested for in the 2019 Arduino sketches of this repository in addition to matching the data in the "Temperature data" plot, i.e. the temperature offset at 0 °C and the conversion time (which, by the way, is among the slowest of all clones). However, unlike Family A2 (which pre-dates this repository), they stopped there with their efforts to replicate the original (the hallmark of a student project...). While I am flattered to see that somebody actually designed and manufactures microchips to my specifications I do consider this a waste of developer skill and advancement in technology. Also in the first group is Family B1v2, which is a recent variant of Family B1 with the 2-byte user memory removed to make it act more like an authentic DS18B20: a somewhat sad course of development; Family G that, as far as I can tell, doesn't add anything significant but introduces quirks that are either funny (cf. byte 6) or will lead to system failure in parasite power mode (like, pulling the data line low(!)); and Family H, which looks a bit like Family G without the quirks. Granted, Families G and H perform 12-bit temperature conversions twice as fast as the authentic DS18B20, so maybe they deserve credit for that.

The second group of clones is the bright side. We see that

  • GXCAS (Family B1 excluding B1v2), 7Q-Tek (Family B2), Mysentech (Family D), and Novosense (Family E) have added 2 or 3 bytes of user memory to their clones (Family E has dedicated function codes to read, write, and store them in EEPROM),
  • Family C, Mysentech (Family D1), and Xinbole (Family F) introduced clones that perform 12-bit temperature conversion in under 30 ms, i.e. 5% of the guaranteed conversion time of the authentic DS18B20 (granted, Family D1 has poor temperature performance),
  • Xinbole (Family F) has an extended temperature mode that allows temperatures to be measured up to 150 °C, and
  • Mysentech (Family D2) can enter a 14-bit mode with 0.016 °C resolution.

I really appreciate the hidden gems in some of the chips and the efforts of the engineers behind them. However, none of this should be understood as an endorsement as I have not tested whether the sensors live up to the specification in their respective datasheets, let alone the specifications in the Maxim/Analog datasheet.

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 genuine item from an authorized manufacturer [13]. 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 is an 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 ([1]).
  • 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 [5].
  • The marking inside the indent on the rear of the case is
    • P (Philippines?) on all chips 2016 through 2019, on most chips in 2020 (2020), and on most(?) chips going back at least as far as 2009 [5].
    • THAI (Thailand?) where 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 \[5\]. The uses a different font than the letters making up THAI.
    • possibly additional markings or no markings on some chips since 2020 (cf. Issue 21, Issue 22) (2020)
  • 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 [5]. This does not hold true for chips marked THAI in the indent [5].

To avoid confusion: the relevant Maxim part number of the chips investigated here is DS18B20+, i.e. TO-92 package and RoHS compliant. Not everything said on this page may apply to the DS18B20+PAR parasitic power-only variant (I cannot tell since I have only looked at a handfull of those). For the sake of brevity, the chips are referred to as DS18B20 as written in the datasheet [1].

How do I know if I am affected?

If the DS18B20 have been bought from authorized dealers though a controlled supply chain and are marked as being produced by either Maxim or Analog Devices 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 [4]). (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 [5]) [5].

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

  • 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, D1: 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
  • Family E: has custom scratchpad register
  • Family F: completion of temperature conversion cannot be polled
  • Family F: can measure temperatures up to 150 °C (rather than 125 °C)
  • Family A3: polling for completion of temperature conversion works only after some delay

Hence, as of 2019, every fake sensor available did not comply with the datasheet in at least one way. (As of 2024, this cannot be said of Families A3 or H.)

Regarding (II), there is one reasonably simple test for differences with Maxim-produced DS18B20 sensors that most counterfeit sensors fail [5]:

  • It is a fake if its ROM address does not follow the pattern 28-xx-xx-xx-xx-00-00-xx, except if it follows the pattern 28-xx-xx-xx-00-00-00-xx and claimes to contain a C4 die [5]. (The ROM is essentially a 48-bit counter with the most significant bits still at 0 [5].) (2024) Only Family A3 uses a deceptive ROM, but as of 2024, they are overdoing it. Also, with the exception of rare Family A2 and Families A3, B1v2, and H, none of the clones set reserved byte 6 in the scratchpad register correctly. Only the clones of Family A2 and A3 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

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++authenticitycounterfeitds18b20fake

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
CategoryDevOps
PricingOpen source

> Related tools

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理