DS18B20 Arduino User Manual – Part 1 – Device Basics

Overview

DS18B20 Temp SensorThe DS18B20 is a solid state temperature sensor that uses the Dallas OneWire technology as it’s means of communicating with the outside world.

It is not quite as simple to use as a TMP36 or an LM35,  but it does have its advantages.   Among them is the fact that you can connect more than one of them in a string and thus save some of that precious Arduino IO.

Another is that it is quite accurate when compared to other popular Arduino temperature sensors.

Basic Specifications

ParameterValue
Supply Voltage3.0 to 5.5 Volts DC
Measurement Range-55C to 125C
(-67F to 257F)
Accuracy+/- 0.5C from -10C to 85C
OutputOneWire Serial Communication

OneWire Communication in a Nutshell

OneWire communication is a serial protocol offered in Maxim Products.  It is a Half Duplex protocol in Master Slave arrangement.  OneWire has some pretty cool features, such as:

  • It only has one data line
  • It allows for more than one device to be connected to that data line
  • Each device has its own unique 64 bit address
  • Devices can be parasitically powered

While a discussion of OneWire is worthy of more than a few words, it is beyond the scope of this article.  Rather, the intent here is to simply allow you to put the accuracy of the DS18B20 to immediate practical use.

A more thorough discussion of OneWire can be found in this Maxim Online Presentation.

DS18B20 Pinouts

18B20 Temp SensorThe DS18B20 is most commonly offered in a TO92 package.    The figure shown represents that package.   Other packages are available and the datasheet ( found below) should be consulted for those pin outs.

That said, ALL DS18B20 packages offer the same three pins.  They are defined as follows:

GND – Ground

DQ –  Date Line

VDD – 3.0 to 5.5 Volts DC

 

 

DS18B20 Arduino Tutorial #1

The first tutorial is nothing more than a repeat of what is a sketch that comes prepackaged with the Arduino software you downloaded from Arduino.cc.   The sole purpose of setting this up is so that you can prove to yourself that your DS18B20 will work.    Beyond that, there is lot going on here that you will want to understand before you build a project around it.

Connect your Arduino to your DS18B20

Connect your Arduino as shown in the picture below.   Pay good attention and do include the 4.7K ohm resistor.

DS18B20 Ardunio Connections

Load the Sketch

As previously mentioned, you already have the sketch.   The sketch you will be loading is named “DS18x20_Temperature“.

You can find this file by clicking on the File menu, then Examples and finally, OneWire.

Upload the Sketch and Open your Serial Monitor

Once you’ve uploaded your sketch and opened the Serial Monitor,  you should have an output that looks something like the picture below:

DS18B20 Ardunio Tutorial 1 Output

 Related Documents

DS18B20 Datasheet

One Comment

  1. Gebriel December 14, 2015

Add a Comment

Your email address will not be published. Required fields are marked *