DS18B20
Programmable Resolution
1-Wire is a registered trademark of Maxim Integrat ed Pr o duc ts , Inc .
1-
DESCRIPTION
The DS18B20 digital thermometer provides 9-bit
to 12-bit Celsius temperature measurements and
has an alarm function with nonvolatile userprogrammable upper and lower trigger points.
The DS18B20 communicates over a 1-Wire bus
that by definition requires only one data line (and
ground) for communication with a central
microprocessor. It has an operating temperature
range of -55°C to +125°C and is accurate to
±0.5°C over the range of -10°C to +85°C. In
ad d it io n, t h e DS18B20 can derive power directly
from the data line ( “parasite power”) , eliminat ing
the need for an external power supply.
Each DS18B20 has a unique 64-bit serial code,
which allows multiple DS18B20s to function on
the same 1-Wir e bu s. Thu s , it is simple to us e one
microprocessor to control many DS18B20s
distributed over a large area. Applications that
can benefit from this feature include HVAC
environmental controls, temperature monitoring
systems inside buildings, equipment, or
machinery, and process monitoring and control
systems.
FEATURES
Unique 1-Wire® Interface Requires Only One
Port Pin for Communication
Each Device has a Unique 64-Bit Serial Code
Stor ed i n an On-Board ROM
Multidrop Capability Simplifies Distributed
Temperature-Sensing Applications
Requires No External Components
Can Be Powered from Data Line; Power Supply
Range is 3.0V to 5.5V
Measures Temperatures from -55°C to +125°C
(-67°F to +257°F)
±0.5°C Accuracy from -10°C to +85°C
Thermometer Resolution is User Selectable
from 9 to 12 Bits
Converts Temperature to 12-Bit Digital Word in
750ms (Max)
1 of 22 REV: 042208
User-Definable Nonvolatile (NV) Alarm
Settings
Alarm Search Command Identifies and
Addresses Devices Whose Temperature is
Outside Programmed Limits (Temperature
Alarm Condition)
Available in 8-Pin SO (150 mils), 8-Pin µSOP,
and 3-Pin TO-92 Packages
Software Compatible with the DS1822
Applications Include Thermostatic Controls,
Industrial Systems, Consumer Products,
Thermometers, or Any Thermally Sensitive
System
PIN CONFIGURATIONS
18B20
(DS18B20)
DD
2
(DS18B20Z)
3
(DS18B20U)
7
N.C.
ORDERING INFORMATION
DS18B20
DS18B20
18B20
-55°C to +125°C
-55°C to +125°C
DS18B20Z
DS18B20
-55°C to +125°C
+Denotes a lead-fr ee p ac k age. A “+” will appear on the top mark of lead-free packages.
T&R = Tape and reel .
*TO-92 packa ges in tape an d re el ca n be or der ed w ith s tra ight or f o rmed leads . Ch oose “SL” for st raig ht leads. Bulk T O -92 or de rs ar e s traigh t
leads only.
PIN DESCRIPTION
SO
PIN
SOP
TO-92
NAME FUNCTION
1, 2, 6,
7, 8
3 8 3 VDD
2, 3, 5,
6, 7
— N.C. No Connection
Op tio nal VDD. VDD must be grounded for operation in
parasite power mode.
Data Input/Output. Ope n-drain 1-Wire interface pin. Also
4 1 2 DQ
provides power to the device when used in parasite power
mode (see the Powering the DS18B20 section.)
5 4 1 GND Ground
OVERVIEW
Figure 1 s hows a block diagram of the DS18B20, and pin descr iptions are given in the Pin De scription
table. The 64-bit ROM stores the device’s unique ser ial code. The scratchpad memor y contains the 2-byte
temperature r egister t hat stores t he digital ou tp ut from the te mperatur e sensor . In add ition, t he scratchpad
provides access to the 1-byte upper and lower alarm trigger registers (TH and TL) and the 1-byte
configuration reg ister. The co nfiguration register allows the user to set the resolut ion of the temperat ureto-digital conversion to 9, 10, 11, or 12 bits. The TH, TL, and configuration registers are nonvolatile
(EEPROM), so they will retain data when the device is powered down.
The DS18B20 uses Maxim’s exclusive 1-Wire bus p rotoco l that impleme nts bus commu nicat ion u sing
one control signal. The cont rol line requires a weak pullup res istor since all dev ices are linked to t he bus
via a 3-state or open-drain port (the DQ pin in the case of the DS18B20). In this bus system, the
microprocesso r (the master dev ice) identifies and addresses devices on the bus using each de vice’s unique
64-bit code. Because each device has a unique co de, the number of devices that can be addressed on one
2 of 22
DS18B20
bus is virtually unlimited. The 1-Wire bus protocol, including detailed explanations o f the commands and
“time slots,” is covered in the 1-Wire Bus System section.
Another feature of the DS18B20 is the ability to operate without an external power supply. Power is
instead supplied through the 1-Wire pullup resistor via the DQ pin when the bus is high. The high bus
signal also charges an internal capacito r (CPP), whic h the n sup plie s po wer to the de vic e whe n the bus is
low. This method of deriving power from the 1-Wire bus is referred to as “parasite power.” As an
alt ernative, the DS18B20 may also be powered by a n external sup ply on VDD.
Figure 1. DS18B20 Block Diagram
PARA SITE POWER
CPP
POWERSUPPLY
SENSE
AND
1-Wire PORT
TEMPER ATUR E SENS OR
REGISTER (EEPROM)
REGISTER (EEPROM)
(EEPROM)
OPERATION—MEASURING TEMPERATURE
The core funct ionality o f the DS18B20 is its dire ct-to-digita l temperatu re sensor. The resolution of the
temperature sensor is user-configurable to 9, 10, 11, or 12 bits, corresponding to increments of 0.5°C,
0.25°C, 0.125°C, and 0.0625°C, respectively. The default resolution at power-up is 12-bit. The DS18B20
powers up in a low-power idle state. To initiate a t emperature measurement and A-to-D conve rsio n, the
master must issue a Convert T [44 h] command. Following the co nversion, the result ing t hermal data is
stored in the 2-byte t emperature register in the scratchpad memory and the DS18B20 returns to its idle
state. If the DS18B20 is powered by an e xter nal s upply, the master can issue “read time slots” (see the
1-Wire Bus S yst em section) after the Convert T command and the DS18B20 will respond by tr ansmitting
0 while the t emperature co nversion is in pr ogress and 1 whe n t he c o nver sio n is do n e. If the DS18B20 is
powered with parasite power, this notification technique cannot be used since the bus must be pulled high
by a st r ong pu llup dur ing the e nt ire te mperatur e conversion. T he bus requ irements for par asite pow er are
explained in d etail in the Powering the DS18B20 section.
The DS18B20 output temperature data is calibrated in degrees Celsius; for Fahrenheit applications, a
lookup table or conversion rout ine must be used. The t emperat ure data is sto red as a 16-b it sign-extended
two’s complement number in the temperature register (see Figure 2). The sign bits (S) indicate if the
temperature is po sitive or negat ive: for po sitive nu mbers S = 0 and for negat ive numbers S = 1. If the
DS18B20 is configured for 12-bit resolut ion, a ll bits in the temperature reg ister w ill contain valid data.
For 11-bit resolution, bit 0 is undefined. For 10-bit reso lution, bits 1 and 0 are undefined, and for 9-bit
resolution bits 2, 1, and 0 are undefined. Table 1 gives examples of digital output data and the
correspond ing temperature reading for 12-bit resolution conver sions.
3 of 22