This sealed digital temperature probe lets you precisely measure temperatures in wet environments with a simple 1-Wire interface. The DS18B20 provides 9 to 12-bit (configurable) temperature readings over a 1-Wire interface, so that only one wire (and ground) needs to be connected from a central microprocessor.
Note: The pinout for this sensor is as follows: RED=Vcc BLACK=GND WHITE=SIG
This website shows a decent diagram of how to use the pull-up resistor. https://create.arduino.cc/projecthub/TheGadgetBoy/ds18b20-digital-temperature-sensor-and-arduino-9cc806
The current wire colors on the temperature sensor should be:
RED=Vcc BLACK=GND WHITE=SIG
Previously, the wire colors indicated a different connection => https://www.sparkfun.com/products/11050#comment-52a60f8cce395f052a8b456a .
We also don’t have any information on the temperature rating of the round plastic temperature cover that it can handle. We have not tested it under those conditions before. We tried looking at the manufacturer’s page and it doesn’t look like they have tested it under extreme conditions.
If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.
Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels
Based on 28 ratings:
1 of 1 found this helpful:
Makes it super easy to measure temperature.. 1 wire bus is sweet too..
1 of 1 found this helpful:
Hard to find a DS18B20 with a long wire. This one has it. I use them on my fridge and freezer monitoring units. They all passed the counterfeit test you can find by searching for the Arduino code. Most ones sold on popular non Arduino type sites are counterfeit fakes. These are the real Dallas chips.
1 of 1 found this helpful:
I used to think that this was too expensive until I realized how long it makes me to make them myself and now think it is well worth the price.
5 of 5 found this helpful:
I was emailed by SFE to write a review on this sensor. I had wired it (I thought) per the instructions and it didn't work. I read the data sheet on the internal part and it seemed to suggest that a pullup resistor was only needed if the part was scavenging power from the data line. Since I was giving it 5v on the red wire, I didn't think that applied to me. After entering my initial (unhappy) review, I read some of the other reviews. I didn't see others having (many) problems and one reviewer noted that he had to add a "10k pullup". I did that and it worked! I'm now happy :-) and will try to figure out how to run 2 sensors off a single Arduino port.
Have you contacted our technical support department @ firstname.lastname@example.org - they are usually pretty good at getting things like this working, and if they can't help you get it working they can help you setup a replacement sensor for you.
4 of 4 found this helpful:
The example code SparkFun supplies is not the best, but with a bit of tweaking it could work okay. I would much rather suggest this library as it also supports multiple sensors (and does not try to use some LCD display): https://github.com/milesburton/Arduino-Temperature-Control-Library
Also, the standard One Wire library in the Arduino Library Manger is required.
This was my first actual experience with 1-Wire. The description seems to indicate that "no external components are needed" and you just need to wire it up and go. Not exactly. A pull up resistor is required between the white data line and red power line. I threw a 10k in there, but I have seen lower values used. For whatever reason, I was unable to get the AVR internal pull up to work with it.
The nice thing about 1-Wire and this component is you can put a bunch of these all on just one pin. They each have a 64 bit unique address (which you need to "discover"). I was able to get 3 sensors going by connecting power, ground, and all the data lines to to Pin 7, for example.
1 of 1 found this helpful:
Most of the time, this sensor returns the correct temperature, but... (1) About 1 in every 30 readings, the sensor doesn't respond to the 1-Wire device search. (2) About 1 in every 50 readings, the sensor returns 65535. (3) About 1 in every 100 readings, the sensor returns a reading 0-20C off from the actual temperature.
These are usually pretty solid little units. If it seems to be acting inconsistently, I'd recommend getting in touch with our tech support team. They should be able to help you out.
7 of 7 found this helpful:
Just took it out of the box. Sure would be nice if there was a little piece of paper that told which wire was which. I'm going to guess: Red = V+ Black = GND White = Data But why make me guess?
2 of 3 found this helpful:
This is a great encapsulation of the DS18B20. We would buy it in the thousands if we could get a data sheet for it for UL. I have been told there is no data sheet available so we will have to use another device.
1 of 2 found this helpful:
Easy to connect got it working in less than 30 minutes.
Nearly perfect. Sturdy construction. Very easy to configure for use with the Raspberry Pi... maybe 5-10 min max. This sensor requires shielding in order to be used outdoors, but that's not a big deal. My only disappointment is the cable length is short. It'd be great if it came in different sizes.
These work great and I like the 6' lengths. I've had problems reading 3 shorter ones I bought from Adafruit.
Easy to connect and very sturdy. Keep in mind you have to allow for the thermal characteristics of the plastic coating. Very flexible cable
Quick, and easy installation and operation
I am using these to monitor the temperature in a bread proofing box - one embedded in an electrically heated layer of bricks, and one in a pan of water which gives me a warm moist environment for raising bread. It's powered by a PICAXE 18M2+ processor with the AXE133Y OLED display, and switches power (120 VAC) off and on to the 150 watt snow-melt cable embedded in the bricks.
These temperature sensors are very easy to hook up, and the measurements they give are accurate.
The sensor was easy to get connected and begin reading. It has continually provided consistent temperature readings while submerged in water.
Very accurate temperature sensor and very easy to setup and use. Using with an Arduino Uno for now.
I use this sensor with the esp8266 "thing" and it's been really easy to do with onewire. I use this sensor on a saltwater aquarium, and it looks really well sealed, so I'm not concerned about the exposure to a more corrosive environment.
There is one important detail missing, 4.7K pull up resistor for the data wire. The sensor will not work otherwise.
Once this is done the sensor works perfectly.
This works perfect on my Raspbery Pi wether station! It have beed running 3 years now, taking the temperature every 15 min and not a single problem. I have ordered one more to go with a wether station a other place.
These are excellent and reliable. Be careful to size your pullup resistor appropriately. I had a resistor 2k too small, and the probes worked ok with it but it may have put strain on them and they eventually stopped reporting accurate temps. Fixing the resistor size got the accuracy back.
Also, Sparkfun goes seriously above and beyond the call in providing tech support and even replacement parts. Super super impressed.
I'm very sorry to hear that! We've not heard of one of these failing in this manner before. Someone from our support department will be contacting you shortly to help you with this.
The first sensor I received was dead on arrival, however a Sparkfun responded quickly and sent a replacement within a couple day with free two day shipping! Fantastic service and the second sensor worked perfectly. In fact, I am ordering another! Great for aquarium or other applications with a long cable and easy setup.
I try cheaper products from Amazon but it all fails especially below zero thus I return to use SparkFun sensors to save time & money
It's been running with the provided test program which spits out temp values about 2 per second. It started at room temp and I grabbed and held the probe tip; it crept up degree by degree. I changed the test program to only print the temp when it changes - this is much more useful and revealed it occasionally glitches and gives -1000 as the temp. It appears waterproof. Next I will try it submerged in PLA 3D printer resin.
I have tested them with my RaspberryPi and work great!
Looking for answers to technical questions?
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
Log in or register to post comments.
How long is the cable?
Is this submersible? If so: To what depth?
Can someone comment on response time. I want to use one to control a mash process and since there may be pockets of hot water I need fast response time.
I have a couple of these hooked up using the OneWire...they read fine when USB powered, but when I power my 2560 Mega with a 9v wall wart they both read 185??
What do I need to do? I am lost.
What is the tip of the sensor made of? Does it interfere on the measurement somehow?
Hmmm.... I assume the black wire is GND, the red wire is VDD, and the white wire is DQ? I can't find that data anywhere.
I made the assumption and it works. You would be correct.
For anyone having trouble with the pin out, the few of these I've used had the colors on pins you wouldn't expect. The pin out: Black = 5V, White = GND, Red = Signal. Not sure if this is an inconsistency with the manufacturer or if that is the pin out on all of these. I physically cut one of these open to confirm this. If you are having trouble, give this orientation a shot.
Doh. I tried Black = 5V, White = GND, Red = Signal and mine went up smoking.
I had previously used "black wire is GND, the red wire is VDD, and the white wire is DQ" -- which worked for me -- but I ripped my connections out before realizing I hadn't written them down. When I looked them up another time, I followed the 2nd set of advice that didn't coincide with my device.
Why isn't this data part of the description? ugg....
I grab a newer version, and you're correct. There may have been some inconsistencies in the wire colors inside the cable. The older version I had definitely worked with the colors I mentioned above. But, the new one fried and swelled up when I tried the pinout I previously mentioned. Trying a second unit revealed that RED=Vcc, BLACK=GND, and WHITE=SIG.
"-55°C to+125°C temperature range"
i see that as rating for the DS18B20, but what about the wire jacket/insulation?
Here is one that can be used in hydroponics, food, and laboratory equipment. Sparkfun should stock this.. they already stock the pH kit from this company.
Atlas Scientific sold me a faulty pH stamp last year, costing me almost 2 full days of work, and then promised to send me a free EC stamp to make up for it (but did immediately replace the faulty pH stamp). They kept claiming the EC stamp was out of stock until they quit returning my emails. I just contacted another staff member though and he says he will send me the EC stamp.
What is the tip made out of? Some kind of epoxy?
I was wondering if anyone could help explain to me how to hook this temperature probe up to a zigbee using a 4.7K pull up resistor and connecting it to a digital input? Or guide me to an online discussion that I can't find on this probe?
I have it hooked up to a 3.3V power source, then to pin 19 digital input D1(3) setup for digital input on zigbee. I am trying to read the signal, but all it says in processing is "high" or "true". Thank you.
I got 5 of these and Having issues getting them to work. I've tried about 10 different tutorials.
Using both arduino Uno and Mega I have my red wire connected directly to my board 5v. black to board Gnd. white to digital pins (tried them all) and a resister soldered between 5v and signal. all the address finders for one wire say no addresses found. any suggestions? I know I didn't fry any cause I tried all of them.
I am having the same issue with all of the tutorials I have found Here http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html and here http://bildr.org/2011/07/ds18b20-arduino/
Did you figure it out? Thanks!
Any issue(s) with burying these in soil?
Hi all. I am using this one outside where it is normal with subzero temperatures. When it gets colder than around 1 degree celcius, the sensor starts to be i accurate. It shows temperatures that is higher than it really is. Right now it is -8. My sensor shows -2. Any experiences? I have The sensor is connected to a breadboard-arduino uno - usb to pc.
Are the three wires standard gauge? If so, does anyone know what gauge? Thanks.
We're seeing accuracies that are more like +/-1.5-3.0 C even in the mid-range of this device. Still working out if that is linear. Using a thermo pen, magnetic stirrer thermocouple, and infrared thermometer as baselines.
Unfortunately Jacket insulation around the sensor can't stand up to repeated strain above 200 degrees Fahrenheit. Seems stupid these things can report back temperatures greater than what the insulating material is rated for. Useless for my application unfortunately.
Can it used in seawater? Material?
I am having some issues where I read -127C from one of these, anyone have any idea why this might be happening? I am using the latest one wire and dallas lib's...
Does anyone know why all of a sudden this sensor would start, seemingly at random, report -196.6F (after conversion) then bounce back to normal, about 77F. I changed nothing in the code of my Arduino or the circuit. Perhaps the device is going bad? Any thoughts?
Mine do that when the connection is loose.
I currectly own a couple of these sensors and I'm looking to acquire a couple more for high temp measuring (aprox 100 degrees celcius)... Can the material of the sensor handle this temp? I see the details specify 125 max but dont know if its been tested and stressed at these levels?
Can this sensor handle being frozen in a block of ice and monitor temperature during that time? Min temperature will be about -15 C, one degree accuracy is fine.
This ain't food safe, right? I need it for some small wine tanks. Actually I wanted Atlas Scientific's, but got this one.
I would personally not worry about using it in food, but you may feel differently. Elsewhere in these comments a customer links to a stainless-steel version which may be more appropriate for your application.
can this be interfaced with an arduino pro micro? if so, how.
Google Arduino and the sensor type (DS18B20) and you'll find lots of information on how to do this.
It can be used to measure human body temperature?
Not mine, but if you have a willing subject, I don't see why not.
"Think warm thoughts boy, this sensor's mighty cold"
I would like to know if this sensor could be connected to a phidget 8/8/8 as a simple analogic sensor? I already have the env-tmp made by Atlas scientific and it looks like the sensor must be told to send data rather than it maintains an analog voltage all the time. The procedure is turn on a digital port for millisecond, read the associated analog port, then turn off the digital port. The digital port supplies the 5 volt signal to excite the sensor. That seems I have to connect both on a digital and analog inputs and it isn't convenient to me. I just would like an analogic sensor and nothing else.
Otherwise, I'll have to buy an other sensor for my project, something I could directly connect on an analogic interface. So maybe this reference : DS18B20 could be ok with the phidget. Any feedbacks are welcomed!
This is not an analog sensor like the TMP36. This sensor has a "1-Wire" digital interface, which requires the host system to send it a special digital command sequence to get the temperature reading, which will also be a digital sequence. Read through the links and comments to learn how best to interface to this sensor.
I can't make this work with my Arduino. I have the red wire on 3v, the black on Gnd, and the white on A1. I have also have a TMP36 on A0 wired the same. With my meter, I am getting 3.3v at the solder point but nothing on the white wire. The TMP36 gives me about 0.7v. Did I do something wrong? Do I have a bad sensor?
Opps just learned that this is a digital sensor. Lets drop it on a free digital pin and see what happens.
Ok, this has been asked twice in the comments, but I can't find the answer. Does it need the 4.7k pull-up resistor?
Yes it does. You can place the pullup at the Arduino or close to it, between 5V (or 3.3 if your Arduino is 3.3V) and the DQ pin of the sensor. This sensor works very well. It is stable even with a longer cable.
My first application used the TMP36. I quickly abandoned that sensor. While it is good for monitoring a temperature inside an enclosure, it is too susceptible to noise when remote. The DS18B20 on the other hand is awesome for remote sensing and is offered in a nice probe for you. All that extra code is well worth it.
I have had one of these in my spa pools solar panel for about three months and it has failed. It is stuck reading 85C, power is still good at the start of the cable so assume something has broken down inside the probe. More info on error here http://www.picaxeforum.co.uk/archive/index.php/t-20929.html (post not by me). Pool has a small amount of chemicals in it, but panel can and does occasionally boil the water when the pool is at the set point. Assume this caused the problem - annoying since 125 is the range! My probe is stainless now plastic as shown in the picture.
can I know if this sensor can be used to measure the human body temperature plz?
Not mine, but if you have a willing subject, I don't see why not.
Just hooked this thing up. Took only a couple minutes, and works great. For those who dont think its accurate enough, it comes defaulted at 12 bit resolution which equates to 0.0625°C increments. You can blow on the thing and watch the temp change. I'm going to be using it in my saltwater tank shortly, I'll post an update when I do.
Accuracy and resolution aren't the same thing. Good to know it's fast and responsive though.
I want to bury it 2 meters deep into the ground to measure the temperature near my water pipes - how long can I make the cable without affecting the accuracy of measurements? I'm going to connect it to raspberry PI - will I need a power supply for the sensor or something if the wire goes around 6 meters? Silly question, I guess. Does it include the 4.7K resistor?
1-wire devices are designed for long networks (hundreds of meters) so you're most likely fine. Do read the datasheet for interfacing information; Dallas/Maxim also have application notes on best practices for reliable networks.
Forgot to ask this when i bought it, but is this safe to use in food production? What type of plastic coating is it PP? There is nothing about it in the data sheet.
Hi, just wondering if you have had any luck implementing this probe with a Libelium Waspmote? Any help would be appreciated. I took a look at the mbed example, but not sure it works with the Waspmote. Might be wrong. Thanks!
Was considering this for my saltwater controller, but it doesnt seem sensitive enough, nor is there any details on the casing making it impossible to consider. however, when taking apart a dead heater i found the same IC controlling it. maybe that's why the $90 heater died only 4months after installation. anyone know of a better solution?
I'm curious as to how accurate you need it for aquariums. If anything you could always stick it in water that you already know is the right temp and measure what the sensor reads. I've used these in my fermentor refrigerator for about a year. While they may be off by up to 0.5 C, I consider it more accurate than all but one of my thermometers and they certainly don't fluctuate IME.
FWIW, I've had a DS18B20 in my kegerator (~5C) for about 2 years.
You can always use thermocouples...
mmmm kegerator... my issue is the health of the livestock, not me.. but i did come up with a way to safely use it via 1way overflow :)
By the looks of it, its non-shielded cabling.
Made my own using Sugru to seal the sensor.
My current thoughts are leading to those recent "Flex-Seal" commercials :D glad there's a pre-built solution available :)
If you were going to decouple this, wouldn't you want the capacitor at the DS18B20 end of the thing, instead of 6 feet away?
One-wire devices should not need decoupling capacitors in general, at least not according to the application notes I've read. In fact, if you're using it in two-wire (parasitic power) mode, capacitors would be detrimental. Why do you ask?
I have been using these for a while without any decoupling and they work great, the only thing you need is a 4.7k pull up tied between the power and data line. Very accurate little sensors as well.
Ohh my. I was under the assumption this was decoupled. I'm sadface now. Can the bulb at the end be easily removed and then decoupled, replaced, and resealed with food safe waterproofer easily? Better yet. Just tell me IT IS decoupled.
Decoupling it at the sensor end would most likely ruin the waterproof seal.
already made one with just plain heatshrink and caulking but this looks much better!
I do as well but I agree this is much much nicer looking than mine with liquid tape and heatshrinking
Nice! Was just about to checkout when I saw this. How well does this hold up to harsh environments (ie salt water)?
We just might have to test that out. I'm thinking about putting it in the video for next week.
Or chlorinated pool water????
hum, good idea. maybe weak bases and acids?
More or less when it does break down, what is released? Is it safe for us (remembering the brewmeisters from above)?
ugh, this is getting more and more complicated. I'm not sure how to easily test that one.
There's probably an MSDS available for the envelope material.
Lol did you expect anything different?
Yeah! That would be really cool if we can use it in Salt Water Fish TANKS! (OR fresh water Tanks!) Though I would be worried using it with the Discus- they can be real temperamental with 1 Deg F change
You can read in the datasheet that the resolution can be better : "The resolution of the DS18B20 is configurable (9, 10, 11, or 12 bits), with 12-bit readings the factory default state. This equates to a temperature resolution of 0.5°C, 0.25°C, 0.125°C, or 0.0625°C." The 12 bits needs 750ms to be done... but it's ok for me.
I don't believe this is accurate enough to be used as a sensor for "controlling a tank heater" as there is too many to consider and catastrophe could result. For my marine environment its simply to be used as a general reference/log/arm. The more you automate a reef, the more things that can go wrong. And when something goes wrong it costs more than I spend on gas in a year.
I'm with you, however, is it food grade or is it going to off gas chemicals into my beer?
My question exactly - is it foodsafe?
We homebrewers gots to know!
Not likely to be food safe, especially at elevated temperatures.
I'm surprised you guys didn't all know about these stainless steel versions (maybe this means Sparkfun should sell them?). See stainless probes at: http://www.brewershardware.com/BCS-460-Temperature-Sensors/
(As an aside, BrewTroller was THE reason I got into electronics and micros... but for some reason, I haven't finished sourcing all the parts for BT, lol.)
Definitely interested in this. Even if it's not food safe, would it be suitable for an application like Sous Vide where it is near food, but not directly in contact with it?
Also, does it already have the 4.7k resistor on the data wire?
I just purchased one specifically for sous vide. Where the food is contained in a sealed bag and the probe is not, I don't see it being a problem.
You could cover it with a long and thin cellophane bag.
I'm glad someone is asking this, because it was my first application thought as well.
+1 I'd like to use this in my hydroponics setup.
+1 on this. homebrew application. food safe?