I'm using a TinyDuino with a Protoboard to measure temperature with a 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.
Edit
Here's a schematic from a site which uses a resistor. The only difference is my board has VCC, one site said to connect VDD on the sensor to VCC, this one shows it connecting VDD to 5V. I'm not sure the difference
Best Answer
The document with all your answers is the DS18B20 datasheet. Whenever you have questions about a part or interaction between multiple parts, the datasheet(s) should be the first thing you look at.
One of the more relevant statements from the datasheet:
This pullup may also provide parasite power. Figure 1 shows a 4.7k resistor between V_PU and DQ.
Additionally, also from the datasheet:
That should answer your second question. To answer the first question, it's likely because it's a tutorial for using a TMP36 temperature sensor, which is completely different than a DS18B20. The TMP36 is an analog output temperature sensor, the DS18B20 is a digital temperature sensor that communicates via the 1-wire protocol (proprietary to Maxim), and consequently, there is really nothing in common between those two sensors. You will want to use a library that implements the 1-wire protocol to communicate with that sensor.