Is a resistor required between VCC and Data for my temperature sensor?

mozobata

Newly Enlightened
Joined
Jul 17, 2017
Messages
1
I'm using a TinyDuino with a Protoboard to measure temperature with a DS18B20(here is the datesheet of ds18b20),I was following this tutorial but am not getting any valuable information back on the arduino when I try to read the value on the data port.


I just started reading around and it looks like most people put a resistor between VCC and Data. I'm fairly new to electronics, so 1) I don't know why the tutorial doesn't mention this and 2) I'm not sure what putting a resistor between those two would do?

Any help or explanation appreciated.

fQs5C.jpg




 

DIWdiver

Flashlight Enthusiast
Joined
Jan 27, 2010
Messages
2,725
Location
Connecticut, USA
Welcome to the forum!

I hope you find not only what you were looking for, but much more as well.

Short answer: The pullup resistor IS necessary. 4.7K should be good for this application, if you have less than 10 feet or so between the 'duino and the '1820.

Longer answer:

I've done a lot of work with Dallas Semiconductor's 1-Wire devices, including an older version of the DS18B20. Dallas has since been acquired by Maxim. Yes, I know that dates me.

Since communication both to and from the device is on the same pin (DQ, aka DATA), and you can't afford to have one side try to drive it low while the other side drives it high (this would cause potentially damaging high currents in both chips), both chips are set up so they can only pull the line low, not high. The resistor is used to pull the line high when neither side wants it low. That way, if the chips fight, they both pull the line low, and no harm is done.

This limits the data speeds, because the pullup is much slower than a chip driving the line high. The data speeds are limited by the time constant of the pullup resistor and the capacitance on the DQ line. For short distances this can be ignored. But if you are running a long cable between the 'duino and the '1820, the capacitance of the cable can add up and you might have to reduce the value of the pullup resistor. We normally used 1K, but we expected to encounter some length of cable with multiple 1-Wire devices. The 4.7K should be fine for short distances and a single device.

It's possible to eliminate the +5V connection to the '1820. You need a pullup resistor of 500-1000 ohms to supply the 1-1.5 mA current the '1820 draws while making a temperature measurement. That way you can have a connection of only one wire (plus ground).
 
Last edited:
Top