What precautions should we take when using the DS18B20 digital temperature sensor?
Release Date:
2021-11-29
Author:
DS18B20 digital temperature sensor Although it offers advantages such as a simple temperature‑measurement system, high measurement accuracy, convenient connectivity, and minimal占用 of port resources, several considerations should still be kept in mind during practical applications:

Lower hardware costs require relatively sophisticated software to compensate. Because DS18B20 digital temperature sensor Serial data communication with the microprocessor requires strict adherence to the read/write timing sequence when programming the DS18B20 digital temperature sensor; otherwise, the temperature measurement results cannot be retrieved. When developing system software in high-level languages such as PL/M or C, it is advisable to implement the DS18B20 interface in assembly language.
The datasheets for the DS18B20 digital temperature sensor do not specify a limit on the number of DS1820 devices that can be connected to a single‑wire bus, which might lead one to assume that any number of DS1820s can be daisy‑chained. However, this is not the case in practical applications. When more than eight DS1820s are connected to a single bus, it becomes necessary to address the microprocessor’s bus‑driving requirements—this is an important consideration when designing multi‑point temperature‑measurement systems.
The bus cable connecting a DS18B20 digital temperature sensor has length limitations. In testing, when the standard signal cable exceeds 50 meters in length, the measured temperature data becomes inaccurate. Switching to a twisted‑pair shielded cable extends the normal communication range to 150 meters; further increasing the number of twists per meter in the twisted‑pair shielded cable can extend this range even more. This phenomenon is primarily caused by signal waveform distortion resulting from the bus’s distributed capacitance. Therefore, when designing a remote temperature‑measurement system with the DS18B20, it is essential to carefully account for both the bus’s distributed capacitance and impedance matching.
In the design of a digital temperature‑sensor measurement program, after sending the temperature‑conversion command to the DS1820, the program invariably waits for the DS1820’s response. If any digital temperature sensor has a poor connection or is disconnected, the program will receive no response when attempting to read the DS1820, causing it to enter an infinite loop. This issue should also be carefully considered in both the hardware wiring and software implementation of the DS1820.
For temperature measurement, it is recommended to use shielded four‑core twisted pair cable: connect one pair of conductors to signal ground, and the other pair to VCC and ground; ensure that the shield is grounded at a single point at the source end.
DS18B20 digital temperature sensor Work sequence:
The master sends a low‑level pulse lasting 480 to 960 microseconds, then releases the bus to a high level and monitors the bus for the next 480 microseconds. If a low level is detected, it indicates that some devices on the bus have responded. If no low level is observed and the bus remains high, it means no device on the bus has responded.
As a slave device, the DS18B20 digital temperature sensor continuously monitors the bus for a 480–960 µs low‑level pulse immediately after power-up. If such a pulse is detected, it waits 15–60 µs after the bus transitions to a high level, then pulls the bus low for 60–240 µs to signal that it is ready. If no pulse is detected, it keeps monitoring and waiting. The write cycle lasts from 60 µs to 120 µs. At the start of the write cycle, the master pulls the bus low for 1 µs to indicate the beginning of the write operation. If the master wishes to write a 0, it maintains the low level for 60 µs until the end of the write cycle, then releases the bus to a high level. If the master wishes to write a 1, it pulls the bus low for 1 µs at the start and holds it low until the write cycle concludes, after which it releases the bus to a high level. As a slave, the DS18B20 waits 15 µs after detecting that the bus has been pulled low, then begins sampling the bus for 15–45 µs. During sampling, a high bus level corresponds to a 1, while a low bus level corresponds to a 0.
Previous Page: What role does the DS18B20 digital temperature sensor play in a circuit?
Next page: Should you choose this company when purchasing a PT1000 platinum resistance temperature sensor?
Latest Updates
What types of temperature sensors are there?
2023-05-22