I'm quite new with the electronics part of Arduino, but I thought that this was the basic way to get the DS18B20 temperature device hooked up. However, I can't detect it in my program using OneWire and DallasTemperature.
This is an image of my connections:
Basically my approach was like this:
Connect ground on ground on the DS18B20. Connect 5V from the Arduino to both DQ from the DS18B20 and Port 2 on my Arduino (the two yellow cables). Between the 5V and the two yellow cables, I connected a 4.7K resistor. Vdd on the DS18B20 is not connected to anything.
Anyone have any idea why this is not working as expected for me?
Thanks in advance!
-
1I can't see the DS18B20 in your picture. Can you please sketch up (eg. on paper) your wiring? I can't quite follow your description.Nick Gammon– Nick Gammon ♦2016年11月26日 03:17:28 +00:00Commented Nov 26, 2016 at 3:17
1 Answer 1
Vdd on the DS18B20 is not connected to anything.
According to the datasheet:
When the DS18B20 is used in parasite power mode, the VDD pin must be connected to ground
Connect 5V from the Arduino to both DQ from the DS18B20 and Port 2 on my Arduino (the two yellow cables).
That means port 2 would always be high, right?
According to Temperature Sensor DS18B20 this is the wiring for non-parasitic power:
If you want the two-wire version (parasitic power) it would be:
-
I didn't get the parasitic power version to work, but the top image explained how the rasistor should be placed in the non-parasitic version, and that did the trick! Thanks a lot!Øyvind Bråthen– Øyvind Bråthen2016年11月26日 09:48:05 +00:00Commented Nov 26, 2016 at 9:48
-
Glad it worked. The design is the standard "open drain" concept where the output is "pulled high" by the resistor, and the device drives it low when it wants to output a zero. This allows multiple devices to share that wire because it doesn't do anything any harm if multiple devices drive it low at the same time.2016年11月26日 21:18:02 +00:00Commented Nov 26, 2016 at 21:18