STMicroelectronics
1MB 1M x 8 FLASH ARM®...
Ⅱ. Internal structure of DS18B20
Ⅴ. Symbol, footprint and pin configuration of DS18B20
Ⅵ. Driving principle of DS18B20
Ⅶ. Where is the DS18B20 sensor used?
DS18B20 is a commonly used digital temperature sensor. It outputs a digital signal and has the characteristics of small size, low hardware overhead, strong anti-interference ability and high precision. In this article, we will introduce the DS18B20 sensor one by one from the aspects of structure, characteristics, working principle, pin arrangement etc..
DS18B20 is the first temperature sensor produced by DALLAS Semiconductor in the United States to support a "single bus" interface. It has low power consumption, strong anti-interference ability, easy to match the advantages of the processor, the temperature can be directly converted into a digital signal through the line. DS18B20 using 1-Wire communication that is only a data line (and ground) and microcontroller communication. The sensor has a temperature detection range of -55°C to 125°C and also has an accuracy of +-0.5°C when the temperature range exceeds -10°C to 85°C in addition. Additionally, the DS18B20 can be powered directly from the data line without requiring an external power supply.
Unlike conventional thermistors, it utilizes single bus technology to effectively minimize external interference and improve measurement accuracy. At the same time, it can directly convert the measured temperature into serial digital signals for microcomputer processing, making data transmission and processing simple through a simple interface.
Replacements and equivalents:
• DS18B20+
• DS18B20+T&R
• DS1821C+
The sensor is mainly composed of 4 times, which are 64-bit ROM, temperature sensor, non-volatile temperature alarm trigger Tm and configuration register. The 64-bit serial number in the RO is photo-engraved before leaving the factory. It can be regarded as the address serial number of the DS18E20. The 64-bit serial number of each DS18E20 is different. The cyclic redundancy check code (CRC=K~8+X~5+X~4+1) of the 64-bit ROM. The function of the ROM is to make each DS18B20 different, so that multiple DS18B20s can be connected to one bus.
• Single-wire transmission: DS18B20 uses a single-wire transmission protocol (1-Wire) for communication. This protocol allows the DS18B20 to communicate with only one data cable for data transmission and power supply.
• Large range: The sensor can measure over a temperature range of -55°C to 125°C, making it suitable for a wide range of temperature monitoring needs.
• Multi-point measurement: With the 1-Wire bus, we can connect multiple DS18B20 sensors for multi-point temperature measurement.
• Unique hardware address: Each DS18B20 sensor has a unique 64-bit hardware address, which is automatically assigned by the manufacturer during the production process. This 64-bit hardware address is associated with the sensor's model number, production date and serial number, so each sensor has its own unique identity. With this 64-bit hardware address, the sensor can be individually identified and communicated with.
• Digital output: The DS18B20 outputs digital temperature values, which can be directly integrated with digital systems without the need for analog signal conversion.
• High accuracy: The DS18B20 sensor has the ability to measure temperatures with a maximum accuracy of ±0.5°C, making it suitable for application scenarios that require high accuracy.
• Low power consumption: The sensor operates from a supply voltage range of 3 V to 5.5 V. Its low power consumption makes it ideal for scenarios that require continuous temperature monitoring over long periods of time. The power consumption of this sensor is so low that it can work for long periods of time without any degradation in performance.
The reading and writing timing and temperature measurement principle of DS18B20 are the same as those of DS1820, but the number of digits of the temperature value obtained is different due to different resolutions. Compared with the DS1820, the temperature conversion delay time of the DS18B20 is shortened from 2 seconds to 750 milliseconds. The oscillation rate of the temperature coefficient crystal oscillator changes significantly with changes in temperature, and the generated signal is used as the pulse input of counter 2. Counter 1 and the temperature register are preset to a base value corresponding to -55°C. Counter 1 counts down the pulse signal generated by the low temperature coefficient crystal oscillator. When the preset value of counter 1 decreases to 0, the value of the temperature register will increase by 1, the preset value of counter 1 will be reloaded, and counter 1 will restart counting the pulse signals generated by the low temperature coefficient crystal oscillator. This process will continue until counter 2 counts to 0, at which point the accumulation of the temperature register value will stop. Finally, the value in the temperature register is the measured temperature.
The pictures above are the symbol, footprint and pin configuration of DS18B20.
The driving process of DS18B20 mainly relies on the 1-Wire bus system. This bus system allows one bus master to control one or more slave devices. In this case, our MCU acts as the master and the DS18B20 always acts as the slave. In the 1-Wire bus system, all commands and data are sent in accordance with the principle of low-order bit first.
1-Wire bus systems use only one data line and require an external pull-up resistor of approximately 5kΩ. Therefore, in the unused state, the level on the data line is high. Each device (whether master or slave) is connected to the data line through an open-drain or 3-state gate pin. This design allows each device to "free up" the data line so that when one device is not transmitting data, other devices can effectively use the data line. The 1-Wire bus interface (DQ pin) of DS18B20 is composed of an open-drain circuit of its internal circuit. Its hardware configuration is shown in the figure below:
There are three main steps to implement the DS18B20 driver:
Step one: initialize DS18B20;
Step two: ROM command (followed by any data exchange request);
Step three: DS18B20 function command (followed by any data exchange request);
Each access to DS18B20 must follow these steps. If any of these steps are missing or not performed, the DS18B20 will not respond.
• Scientific research experiments: Due to its exceptional precision, the sensor is frequently employed in scientific research experiments, particularly those necessitating precise temperature measurements.
• Cold chain logistics: The DS18B20 sensor plays a key role in cold chain logistics. It is used to monitor the temperature of goods throughout the transportation process, ensuring the quality and safety of temperature-sensitive goods.
• Industrial automation: When monitoring the temperature in the production process, the sensor can help companies keep track of the equipment operation status in real time to ensure that the equipment and processes are at the proper temperature conditions, which in turn improves production efficiency and quality.
• Electronic equipment temperature monitoring: In electronic equipment, DS18B20 sensors can be used to monitor the temperature of individual components, detecting temperature anomalies in a timely manner, thus avoiding problems such as equipment damage and data loss due to high temperatures.
• Internet of Things (IoT) applications: Designed for embedded systems and IoT devices, this sensor facilitates remote temperature monitoring and data collection by connecting to devices like microcontrollers or Raspberry Pi.
• Temperature control systems: In addition to this, the sensor is commonly used to realize temperature control systems, such as thermostats, greenhouse control systems, air conditioning systems and so on. By using DS18B20 sensors, these systems can provide precise temperature control as required to ensure proper operation of the system.
Frequently Asked Questions
1. What is a DS18B20 sensor?
The DS18B20 is a small temperature sensor with a built in 12bit ADC. It can be easily connected to an Arduino digital input. The sensor communicates over a one-wire bus and requires little in the way of additional components.
2. Is DS18B20 a digital sensor?
The core functionality of the DS18B20 is its direct-to- digital temperature sensor.
3. What is the difference between LM35 and DS18B20?
A DS18B20 is factory calibrated to output the right temperature. An LM35 is factory calibrated for voltage (not temperature), and the Arduino has to convert this to temperature.
4. How accurate is the DS18B20 sensor?
The DS18B20 digital thermal sensor is quite accurate and does not require any external components to operate. It can measure temperatures from -55°C to +125°C with a measurement accuracy of ±0,5°C.