Using a Pi Pico to Test DS18B20 Temperature Sensors

 The DS18B20 is an easily found temperature sensor, both the sensor itself (it looks like a transistor) and as a waterproof probe with the sensor inside a metallic case. What many don't know is that a large part of the sensors sold are not original parts and many have serious defects.


A throughout study on these clone sensors was done by Chris Petrich, the result can be seen at https://github.com/cpetrich/counterfeit_DS18B20. In the Arduino IDE's Library Manager, you will find the library CheckDS18B20 by Koen DV which can identify the various versions found by Chris.

I decided to make my own version of the test from Chris's observations. In my first tests, I used a Pi Pico W with an e-Paper display (just because that was what I had in my hands at that moment). Later I opted for a soldered version, using an RP2040 Zero and an OLED display. The result fits in an Altoids box:


My software is based on both documented and observed characteristics of the legit and fake sensors:

  • The pattern of the sensor's address (in the legit part the address is a 48-bit counter and the two most significant bytes are still zero)
  • The initial content of the registers (as documented in the datasheet)
  • The support for various ADC resolutions (some clones only support 12-bit resolution)
  • The time needed to do a temperature reading (as observed by Chris)
The software and hardware details can be seen at https://github.com/dquadros/TestadorDS18B20.

The bad news is that most of the sensors I have are not original parts and some have big defects.

Comments

Popular posts from this blog

Using the PIO to Interface a PS/2 Keyboard