Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement

Temperature is one of the most basic environmental parameters, which is closely related to people’s life and industrial and agricultural production. Temperature measurement is inseparable from power supply. The circuit breaker of the hydraulically operated motor is an important equipment of the power grid. It is of great significance to ensure the normal operation of the oil circuit of the hydraulic operating mechanism of the circuit breaker to ensure the safety of the power grid. When the ambient temperature drops to a certain level, the oil flow of the circuit breaker is affected, and the increase in the viscosity of the hydraulic oil is not conducive to the flow of the oil circuit and affects the characteristics of the circuit breaker.

I. Overview

Temperature is one of the most basic environmental parameters, which is closely related to people’s life and industrial and agricultural production. Temperature measurement is inseparable from power supply. The circuit breaker of the hydraulically operated motor is an important equipment of the power grid. It is of great significance to ensure the normal operation of the oil circuit of the hydraulic operating mechanism of the circuit breaker to ensure the safety of the power grid. When the ambient temperature drops to a certain level, the oil flow of the circuit breaker is affected, and the increase in the viscosity of the hydraulic oil is not conducive to the flow of the oil circuit and affects the characteristics of the circuit breaker. Normally, the device displays the current temperature value. When the temperature rises or falls to the specified value, the device will automatically and automatically shut down or open the heating device to prevent accidents, and is an indispensable protection device for the substation. Therefore, it is of great significance to study temperature measurement methods and measurement devices in actual production.

The key to measuring temperature is the temperature sensor. With the rapid development of technology, sensors have entered the third generation of digital sensors. The DS18B20 used in this temperature measurement system belongs to this kind of sensor.

The DS18B20 produced by DALLAS semiconductor is a new generation of intelligent temperature sensor with a microprocessor, but the bus temperature sensor has the characteristics of small size, high precision, convenient interface and long transmission distance. It is widely used in control instruments and measurement and control systems in industry, agriculture, military and other fields.

Two introduction of DS18B20

1. Several features of DS18B20:

a. Because DS18B20 adopts single bus technology, it can directly output the measured temperature value (binary number) through the serial port line or through other I/O port lines and the microcomputer directly connected to the sensor.

b. The measurement temperature range is: -55℃————+125℃,

c. The measurement resolution is: 0.0625°C, which cannot be compared with other sensors.

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Figure 1 DS18B20 external shape and pins

d. Contains 64-bit read-only memory ROM, (the factory serial number of the memory is the unique number corresponding to each device), and the RAM also stores the current conversion value and symbol of the temperature.

e. The user can set the upper and lower temperature limits of each device separately.

f. Contains parasitic power.

2. The structure of DS18b20:

a. 64-bit lithography ROM, can be regarded as the address serial number of DS18B20, as shown in Table 1.

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Table 1

b. The high-speed scratchpad RAM occupies two units of 0 and 1:

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Table 2

In two 8-bit RAMs, binary numbers are stored. The upper five bits are the sign bits. If the temperature is greater than 0OC, the five digits are 0. Multiply the measured value by 0.0625 to get the actual temperature value; if the temperature If it is less than 0OC, the upper five digits are 1. The measured value needs to be negated and added by 1, and then multiplied by 0.0625 to get the actual temperature value.

c. The names and functions of the nine registers:

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
table 3

Three control methods of DS18B20

The operation of DS18B20 is realized by executing the operation command, and its control program is compiled according to the communication protocol of DS18B20. The single-chip microcomputer exchanges data with DS18B20, and the CPU generates the reset sequence and the read-write sequence on the bus according to the single-bus protocol. It includes reset pulse, response pulse, read and write timing, only the response pulse is issued by DS18B20, and the others are issued by single-chip microcomputer. The specific requirements for timing are as follows:

(1) Reset pulse: The single-chip microcomputer sends a negative pulse with a width of 480-960μs and then sends a positive pulse of 5-60μs. At this time, the DS18B20 will send a response pulse of 60-240μs, and the reset sequence ends. That is the echo stage.

(2) Write time slice: write one-bit binary information, the period is at least 61μS, including 1μS recovery time, the DS18B20 automatically samples the data line during 15-60μs after the microcontroller starts the writing program, the low level is “0”, and the high level is “0”. The level is “1”. When the single-chip microcomputer writes “0”, it must continue to be low for 60-120μs, and when writing “1”, the data line must be turned into a high level within 15μs after startup.

(3) Read time slice: read one bit of binary data, the cycle and recovery time requirements are the same as the write time slice. After the microcontroller starts the read sequence, keep it at low level for at least 1μs, and then read in the data before nearly 15μs after the start. Low level is “0”, high level is “1”.

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Figure 2 Initialization sequence

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Figure 3 Read/Write Timing

(4) Execution of ROM operation commands:

In the ROM operation command, there are two commands specially used to obtain the sensor serial number: read ROM command (33H) and search ROM command (FOH). The read ROM command is only used when there is only one sensor on the bus. The specific search process is as follows: (1) The single-chip microcomputer sends a reset pulse to initialize, and the sensor connected to the P3.5 port sends a presence pulse to respond. (2) The single-chip microcomputer issues a search ROM command on a single bus. (3) The microcontroller reads one bit of data from the single bus. The working sequence of ds18b20 includes initialization sequence, write sequence, read sequence, conversion sequence, etc. According to these sequence requirements of the sensor, the subprogram and the main program are written

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Table 4

Hardware Design of Four Temperature Measuring Systems

This system chooses 89C2051 with small size, low cost and built-in 2K EEPROM as the control chip, the crystal oscillator adopts 12MHZ, and 74LS07 and 74LS04 are used to drive three LED digital tubes and a relay coil to drive electric heating equipment. The P3.5 port is used as the acquisition temperature signal line, and the P1 port is used as the Display data line, which together with P3.3 and P3.4 form the displayed ones, tens and sign bits, which are displayed by dynamic scanning. In this system, a temperature signal is measured and controlled, and DS18B20 is connected to P3 of the microcontroller through a single bus. 5. On the pin, the user can set the required temperature measurement value (including the upper limit and lower limit), P3.1 The pin controls the start and stop of the electric heating device, so as to achieve the effect of controlling the temperature. The whole hardware system is simple and clear.

Application of Digital Temperature Sensor DS18B20 in Substation Temperature Measurement
Figure 4 DS18B20 temperature measurement hardware schematic

Five system software design:

The system monitors and controls the temperature and displays the temperature value in real time. The selected temperature sensor chip DS18B20 belongs to a new generation of intelligent temperature sensors adapted to microprocessors.

Workflow of the temperature measurement system: Initialization—Get serial number ROM operation command—Write memory operation command—Read conversion data—Process data—Display temperature—Start the control device. The main program function is to call each functional subroutine and control the start and stop of the electric heating equipment. The subroutines include: initialization subroutine for DS18B20, reading subroutine, writing subroutine, temperature conversion subroutine, numerical calculation subroutine, and display subroutine. (see program block diagram)

Although the programming of this system is more complicated than AD590 temperature measurement, it saves the hardware of A/D conversion, improves the accuracy and anti-interference ability, and the system is stable.

concluding remarks

The innovation point of the author of this article is that DS18B20 is the latest single-wire digital temperature sensor. It has high technical content, complex timing, but low cost. It can also meet the requirements of high temperature measurement accuracy. It is the preferred component. This device uses 89C2051 single-chip microcomputer + serial intelligent sensor to complete this function. It is an excellent choice both economically and technically.

The Links:   https://www.slw-ele.com/lt104v4-101.html“> LT104V4-101 EP4CE30F29C8N

Leave a Reply

Your email address will not be published.