This temperature sensor provides a digital output signal to
allow easy interfacing to a microcontroller or a microprocessor using the 1-Wire® communication protocol. Since
communication with the sensor is digital, it can be placed
at a distance from the controller circuit without worrying
about disturbances and interference from the surrounding
environment.
The thermal sensor board uses three connections: Vcc
(5V power), GND and a bidirectional data line (DQ). The
DS18B20’s temperature measurements range between
-55°C and +125° C and are expressed in 9 to 12 bit reso-
lution (user denable) with ±0.5°C accuracy in the -10°C
to 85°C range. Resolution is set through the conguration
register.
USING THE SENSOR
Red wire
5V positive
power supply
Black wire
GND negative
power supply
Yellow wire
Temperature output/
data request
To begin temperature measurement and A/D
conversion the “Convert T” (code: 44h) command
is issued. The sensor transmits a 0 during the
conversion and returns a 1 when the operation is
complete. The resulting two bytes are available
in the sensor’s scratchpad memory and correspond to the measured temperature, expressed
in Celsius. The “Read ScratchPad” (code: BEh)
command is used to access the measurement
from memory. The 2-byte register (for an 11-bit
sampling) is structured as shown in Fig. 1. The
structure of the 2 bytes returned in 11-bit mode
are as follows: the rst 11 bits (including all of the
least signicate byte and the rst three bits from
the most signicate byte) express the temperature
value, the last ve express the sign and are all 0’s
if the temperate is positive (above zero) and all 1’s
if the temperature is negative (below zero).
The DS18B20 is capable of expressing temperatures with decimal values. Looking at Fig. 1, you will see that the
rst four least signicant bit values are less than 1. The rst one 0.0625, the second one is 0.125, that the third
one is 0.25 and that the fourth one is 0.5.
Fig. The structure of the two bits successively emitted by the MM101, each time it is queried: the LS byte is
the one weighing less, while the MSB byte is the more signicate one. This structure is referred to as an 11-bit
representation, plus sign.