As anyone who’s wanted to measure temperature with a Raspberry Pi knows, it doesn’t offer analog input. This means that the TMP36 sensor which is commonly used with the Arduino doesn’t work. The most popular option for the Pi is the DS18B20, which is a digital sensor that utilizes the 1-wire interface and is natively supported by the Pi. It’s considerably more expensive than the TMP36, and as is the case when a component is expensive and popular, it’s prone to counterfeiting. I recently experienced this firsthand.
Being a hobbyist, I rarely buy from large, reputable supplier such as Newark or Mouser because my orders aren’t large enough for it to make sense. So I often order parts from Amazon, Ebay and AliExpress. If I’m really concerned with quality I’ll stick with reliable sellers I’ve used in the past located in the USA. However I frequently buy parts direct from China as well and have generally had good luck. In the case of the DS18B20 sensors, I felt it was best to stick with a domestic seller so I did, ordering two sensors for $4/piece which seemed to be in line with what I should expect to pay for them.
I was pretty excited about using these, so as soon as I could I wired one up to a Raspberry Pi 3 B to try it out! I followed Adafruit’s DS18B20 tutorial, and noted that if the sensor is wired backwards, it will get real hot and then it’s toast. So I checked and double-checked all my wiring before I connected 3.3v power to the sensor. Once I was sure I had it right, I connected power to the sensor and… it overheated really fast. I pulled the power pin and started checking my wiring again. I looked really closely at the photos on Adafruit’s site, looked up the sensor data sheet, and viewed countless tutorials and schematics on the web. I’m know I’m a bit dyslexic at times, but everything I saw seemed to confirm I had it wired correctly… what gives?
So I flipped the sensor around. It didn’t overheat now, but it also didn’t show up in /sys/bus/w1/devices on the Pi. Okay, let’s try the other sensor. Same results. Now I’m really sure it’s not me, and I’m starting to suspect bad parts. So I did a lot of searching on the web, and I found several instances of people receiving counterfeit DS18B20 sensors, which are really just transistors marked as DS18B20s. So I grabbed a meter and checked mine… and what do you know, they’re NPN transistors. Ugh. Well, problem solved.
In this thread on the Arduino.cc forum, user DarkLiKally describes exactly what I went through – the sensor is overheating, they know wiring it backwards will cause this, but they’re 99% sure it’s wired correctly. And sure enough, other users on the forum believe at first that it’s almost certainly user error, until photos are posted showing otherwise. Once again, it turns out to be a transistor masquerading as a DS18B20. This is what’s most frustrating about this particular counterfeit though – not only do you not receive the part you actually ordered, but you’re then driven crazy wondering if it’s something you did wrong even though you’re sure you did it right!
I ended up purchasing another batch of sensors, this time from an Ebay seller I’d used several times in the past. I had to order 10, which was why I hadn’t used them the first time, but now I have 10 working DS18B20 sensors instead of 2 overpriced transistors. As for the counterfeit parts, I opened a dispute with the seller, expecting they would respond and work it out with me. For reasons I don’t understand, they chose instead to wait until the last minute to give me a refund with no explanation or apology. Oh well, at least I got my money back. In the end all I lost was a little bit of my time… and maybe a little bit of my sanity.
Back to Electronics | Back to Main Menu
Originally posted January 7, 2017 on my old site; posted here April 6, 2018 with minor revisions.