Principles and Experiments of the DS18B20 Temperature Sensor

Release Date:

2022-05-30

Author:


   DS18B20 temperature sensor The configuration register sets different bits to specify the temperature resolution and the number of conversion cycles; the lower five bits are always “1.” The TM bit is used to configure whether the DS18B20 operates in normal mode or test mode. When the DS18B20 temperature sensor leaves the factory, this bit is set to 0, and users do not need to modify it. R1 and…

  R0 is used to set the DS18B20’s resolution, which can be configured to 9, 10, 11, or 12 bits. The corresponding temperature resolutions are 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, respectively. By default, the initial settings use a 12-bit resolution, meaning R0 = 1 and R1 = 1.

8380eca5-f1a6-4271-8743-e7d069962432.jpg

  1. DS18B20 temperature sensor It accommodates a wider range of operating voltages, with a voltage control range of 3.0 to 5.5 V, and can be powered via the data line in parasitic power‑management mode.

  2. Employing a unique single-wire interface, the DS18B20 requires only a single port line to connect with the microprocessor, enabling bidirectional communication between the microprocessor and the DS18B20.

  3. The DS18B20 supports multi-point networking; multiple DS18B20 sensors can be connected in parallel on a single three-wire bus, enabling multi-point temperature measurement through networked operation.

  4. The DS18B20 requires no external components during operation; all sensor elements and the conversion circuitry are integrated into a transistor‑shaped IC.

  5. The temperature range is −55°C to +125°C, with an accuracy of ±0.5°C between −10°C and +85°C.

  6. The programmable resolution ranges from 9 to 12 bits, corresponding to temperature resolutions of 0.5°C, 0.25°C, 0.125°C, and 0.0625°C, enabling high‑precision temperature measurement as required.

  7. The temperature can be converted into a digital value with 9-bit resolution in 93.75 ms, or with 12-bit resolution in 750 ms, offering faster conversion speeds.

  8. The measurement results are directly output as digital temperature signals and transmitted to the CPU via a single bus, with CRC codes also being sent simultaneously, providing strong anti-interference and error-correction capabilities.

  9. Negative-Voltage Characteristics: When the power supply polarity is reversed, the chip will not burn out due to overheating, but it will not function properly.

  External structure

  As shown in the appearance diagram of the DS18B20 temperature sensor, when facing the sensor’s front side (the side with the sensor model marking), the pins are arranged from left to right as follows: Pin 1 is GND, Pin 2 is the DQ data line, and Pin 3 is VDD.

  If the sensor is connected in reverse, one of the power supplies will short-circuit, causing the sensor to overheat and potentially leading to damage. Therefore, we must pay close attention to the direction of sensor development.

  Internal structure of the DS18B20 temperature sensor

  The 64-bit serial number stored in the ROM is permanently etched at the factory and can be regarded as the DS18B20’s address serial number. The purpose of the masked ROM is to ensure that each DS18B20 has a unique identifier, thereby enabling multiple DS18B20s to be connected to a single bus.

  The DS18B20 temperature sensor’s internal memory comprises a high-speed register RAM and a non-volatile, electrically erasable EEPROM that stores the high-temperature trigger TH, the low-temperature trigger TL, and the configuration register.

  High-speed cache memory

  The high-speed data buffer consists of a 9-byte system, and its allocation is as follows:

  When the temperature conversion command (44H) is issued, the converted temperature value is stored in high-speed temporary memory.

  The stored data consists of two bytes, with each byte comprising 8 bits for a total of 16 bits. The most significant bit (MSB) of the first byte serves as the sign bit S. The microcontroller reads the data via a single-wire interface, with the least significant bits appearing first and the most significant bits following.

  If the measured temperature is greater than 0, these five bits are “0”; the actual temperature is obtained by multiplying the measured value by 0.0625 (with a default resolution of 12 bits). If the temperature is less than 0, these five bits are “1”; the actual temperature is calculated by adding 1 and then multiplying by 0.0625.

  Taking 85 degrees as an example, since the temperature is greater than 0, we can see that the first five bits of the two bytes are 0. Converting this binary value to decimal: 2^6 + 2^4 + 2^2 + 2^0 = 85.

  The data is output as the hexadecimal value 0x0550. Since the upper five bits of the high byte are zero, this indicates that the measured temperature is positive. The decimal equivalent of 0x0550 is 1360; multiplying this value by the 12-bit resolution of 0.0625 yields +85 degrees.

  The above is what has been introduced. DS18B20 temperature sensor Principles and experiments—please feel free to contact us for more information! Our company has many years of experience and looks forward to welcoming you at any time.



Previous Page: What are the characteristics of temperature and humidity sensors?

Next page: What is the primary function of a BBQ meat probe temperature sensor?