Go Down

Topic: [Solved] Arduino Yun and DS18B20 - not finding sensors (Read 2608 times) previous topic - next topic


Apr 28, 2016, 05:55 pm Last Edit: May 02, 2016, 10:40 pm by DarkLiKally

I'm trying to run a DS18B20 with the Arduino Yun.

I've wired the sensor like described in this article

I'm 99% sure, that the sensor is wired correctly (bottom view, flat side up, left pin = pin 1).
So I connected the pins:
  • Arduino GND to sensor pin 1
  • Digital pin 2 (also tried every other pin) to sensor pin 2
  • Arduino +5v to sensor pin 3
  • 4,7k resistor between sensor pin 2 and 3

My problem with this is, the DS18B20 is getting quiet hot. So ok, I know, if this happens, maybe I've connected the sensor the wrong way. So, I've switched the wires of pin 1 and 3 of the sensor. The sensor stays cool but the OneWire library (installed via the Arduino IDE) can't find any devices.
So next try, with a new sensor, I thought maybe the other got damaged but also the same result.

After all, I've tried another new sensor with the parasite power mode, connecting pin 1 to GND and pin 2 to data, 4,7k resistor from +5V to data pin. No result. Another try also connecting pin 3 to GND. Also not finding any devices.

Next thought was that my arduino got damaged. So I've tested every pin (2 - 12) on my arduino with a relay board, every pin output is working as expected. I've also verified every pin's input mode, also everything's working as expected.
The sketches are also executing correctly (tried some basic examples and some custom sketches with the relay board). The linux system with WLAN connection is also fine.

So now my question is, do you have any idea what's wrong with my setup?

If you need more information please let me know.

Thank you, greetings

Here's the datasheet I've used:

Further I've also tried different versions of OneWire and DallasTemperature libraries but without any success.


My problem with this is, the DS18B20 is getting quiet hot. So ok, I know, if this happens, maybe I've connected the sensor the wrong way.
No, you have certainly connected it the wrong way round, but it may well survive it, and apparently there is nothing wrong with the rest of your hardware either. This rather implies your code is faulty, but it is apparently a secret too. More public code is here:


Hot is not good. The DS18B20 could be damaged. Hot means you have reversed GND and 5V.

The OneWire and DallasTemperature are in the Library Manager of the Arduino IDE.
You can try the example from the OneWire or from the DallasTemperature libraries.
The examples of a library appear in the Arduino IDE after installing a library.

The Arduino Yun has the same ATmega32U4 as the Arduino Leonardo. That means that if a library works with the Leonardo, it should work for the Arduino Yun. The OneWire and DallasTemperature are okay.

I think that page at wikispaces is okay. But the examples with the libraries are the first thing to try.

You explain nicely what you did, but we like to know what is going on.
Can you make a photo of your DS18B20 connected to your Yun ?
If you use a library from the internet, please give a link to that library. So we know what you are using.
Do you have an Arduino Uno ? (to test sensors).


Apr 28, 2016, 07:38 pm Last Edit: Apr 28, 2016, 07:50 pm by DarkLiKally
At first, thanks for the fast replies. :) Really nice!

I've took a brand new sensor and connected it like described above to the arduino so that it won't heat up. (But pin 1 (GND) of the sensor is now connected to 5v, isn't it?)

Red = 5v
Brown = GND
Yellow = digital pin 2
Resistor = 4.7k

An image of my setup is in the attachments.


I've installed the latest versions of the two libraries through the library manager of the Arduino IDE (i've cleared the libraries folder before and restarted it after installing).

I've loaded the Simple example of DallasTemperature library. Output:
Code: [Select]

Dallas Temperature IC Control Library Demo
Requesting temperatures...DONE
Temperature for the device 1 (index 0) is: -127.00
Requesting temperatures...DONE
Temperature for the device 1 (index 0) is: -127.00
Requesting temperatures...DONE
Temperature for the device 1 (index 0) is: -127.00
Requesting temperatures...DONE

Then I've loaded the oneWireSearche example. Output:
Code: [Select]

// Start oneWireSearch.ino

// End oneWireSearch.ino

The only modification I've made to the scripts is:
Code: [Select]

  while(!Serial) ;

after Serial.begin in order to see the output from setup() method

No, I only have the Yun. It's my first Arduino project.
I want to monitor some temperatures over a web panel.


The photo shows that you have the resistor between Ground and Data. Your red wire is connected to +5V on the Yun but to the Gnd pin of the DS18B20. The brown wire is connected to Yun ground and ds18b20 Vdd.

Don't send me technical questions via Private Message.


DarkLiKally, do you understand el_supremo ?
This is a clear picture : http://johnny-five.io/examples/temperature-ds18b20/
Perhaps you better show us a photo of your new wiring before you apply power to the Arduino.


Apr 29, 2016, 06:46 am Last Edit: Apr 29, 2016, 06:52 am by DarkLiKally
Yes, I know that, but the problem is, when I turn around the sensor, so that VDD of sensor is connected to red wire and GND of sensor is connected to the brown wire then the sensor starts getting very hot.

I've attached another image with the rotated sensor. Now the setup is like on your template right?

I've not powered this setup for now because I know the sensor will get hot.

I really have no idea what's wrong.


Apr 29, 2016, 07:43 am Last Edit: Apr 29, 2016, 07:47 am by Koepel
And you don't have another Arduino board ?
Do you have a multimeter to measure the value of the resistor ?
Can you do a diode test on your DS18B20, perhaps it is a transistor.
Can you measure the voltages of the three pins ?

Maybe you have a batch of counterfeit DS18B20, or a production series was wrong and should have been destroyed. Where did you buy them ? Maybe a bunch of transistors was labeled as a DS18B20 and sold to you.

The DS18B20 I have, are shiny on the top (with a rib), shiny on the flat side, and on the round side is a round dent. The text is very hard to read. The pins are in line. Did you bend the middle pin ?

If you would use an other Arduino board, other wires, other breadboard, other DS18B20, other resistor, and connect it like the picture of your Reply #6, then it works.

Conclusion: measure the value of the resistor, get another DS18B20 (a real one).


No I don't have another board.

I've measured the values:

Resistor: 4680 Ohm (4.7k)

Diode Test:
Red wire to sensor pin 3
Black wire pin 2 - ~1010
Black wire pin 1 - ~1010

So it's a NPN transistor?
hFE Test
-> 452

pin 1 and 3 = 4.99 V
pin 1 and 2 = 4.98 V

Do I have a real transistor or is it possible that the sensor appears like that?

The appearance of the sensor is exactly like you described. Yes I've bend the middle pin, they're in line.

However, I've ordered another set of sensors from another vendor. They will be delivered on monday. I will try it again then and give you an update whether it worked or not.

Thank you very much for your fast help.


Apr 29, 2016, 04:16 pm Last Edit: Apr 29, 2016, 04:31 pm by Koepel
Diode test from GND to the other pins is like a diode of 0.55V.
Diode test from 5V to other pins is nothing.
Diode test from DATA pin to GND : nothing.  Diode test from DATA pin to 5V : 2V.
I believe you that it will get hot in the photo with your Reply #6. But it should not. It is a big mystery. Perhaps it is a psychological experiment and you are fooling us :o Anything is possible at this moment. Do you know someone else who can test one of those DS18B20 ?
Sometimes it helps if you explain everything to someone else. Engineers can have a blind spot when they have a thinking error.


Are they marked as a DS18B20 on the flat face of the device?
It seems to me that it is a transistor and powering it up as shown in your last photo would make it heat up.

Don't send me technical questions via Private Message.


No, sadly I don't know anyone who could test it.
But I will try the new sensors when they arrive on monday.

I also can't verify your measures.

It's labeled like mentioned in reply #3 (the text which is very hard to read)



Hmmmm. This is weird. All I can suggest is to move the whole thing somewhere else on the breadboard. Perhaps there's a bad connection in the breadboard itself.

Don't send me technical questions via Private Message.


Yes, I've already tried that, also with direct wire bridges without breadboard. Nothing works, sensors are always heating up.

My Arduino is fine I think. I've connected a LCD display now (using the pins where the sensor was connected) and it works without any problems, everything as expected.

I still have no idea what's wrong with the sensors.

I'll hope the sensors are broken or they're really fake.... I ordered a cheap package from a third party store over amazon (the vendor had 5 stars so don't know..)
Now I ordered some sensors from another vendor from my country, will be delivered on monday.



Hello, back again,

I received the new set of sensors today, I've connected them like in reply #6 and everything works.

The old sensors are fake, they were only transistors with wrong label, I've asked at the electronics store.

The problem is solved now, thank you all very much for the help.


Go Up