Share this

Design of a temperature measurement system

2026-04-06 05:58:48 · · #1

Abstract: The temperature measurement system studied in this paper consists of a microcontroller, a temperature sensor, a power supply circuit, an LCD display circuit, a temperature acquisition circuit, and an alarm circuit. The temperature sensor converts temperature changes into current changes, then into voltage changes, and finally transmits the data to the microcontroller. The microcontroller displays the temperature changes as data, and if the temperature exceeds the specified range, the alarm system is activated. This system has a certain temperature measurement range and is characterized by strong practicality, high reliability, and high measurement accuracy.

Keywords: temperature sensor; microcontroller; alarm

1 Introduction

Temperature is a crucial physical quantity in industrial and agricultural production and daily life, constantly affecting us. Therefore, its measurement and control are of paramount importance. With the development of modern industrial and agricultural technologies and the increasing demands on living environments, the need for temperature detection and control is urgent. Currently, the development of sensing and communication technologies, along with the emergence of microcontrollers, has further propelled its development. Microcontrollers offer advantages such as small size, powerful functionality, and high reliability. Therefore, using microcontrollers for temperature control can significantly improve the technical specifications of the controlled temperature, and further enhance product quality and quantity. This paper proposes a design scheme for a temperature measurement system based on this objective.

2 System Overall Design Concept

2.1 System Overall Design Structure Diagram

The overall structure of this system is shown in the figure below. It is a measurement system with a microcontroller and sensors as its core.

Figure 1. Block diagram of the alarm system

2.2 Introduction to the working principle of system modules

The main function of the temperature acquisition module is to sense the greenhouse temperature through a temperature sensor and convert it into an analog signal. The conversion module then converts the analog signal into a digital signal and stores the temperature data. The main function of the temperature display module is to display the data written by the control module on a crystal screen under the control of the control module, making it easy to read the temperature values.

The DS18B20 temperature sensor can directly read the measured temperature value. After the measured temperature value is processed by the DS18B20, it is converted into a digital value and then sent to the microcontroller for data processing. The value is compared with the previously set temperature alarm range. If the temperature exceeds the specified range, an alarm will sound and the result will be displayed on the LCD1602.

3. Introduction to System Hardware

3.1 Power Supply Circuit Design

The main function of the power supply circuit is to provide operating power to the microcontroller. Since the microcontroller operates at +5V and the circuit power consumption is very small, the LM7805 series is a 3-terminal voltage regulator capable of providing a 5V output voltage. It has a wide range of applications and includes overcurrent and overload protection circuits. The circuit diagram is shown below.

Figure 2 Power supply circuit

3.2 Temperature Acquisition Circuit Design

The most significant feature of the DS18B20 is its single-bus data transmission method; all data I/O operations of the DS18B20 are performed on a single line. According to the DS18B20's communication protocol, the host (microcontroller) must perform three steps to control the DS18B20 to complete temperature conversion: a reset operation must be performed on the DS18B20 before each read/write operation; a ROM instruction is sent after a successful reset; and finally, a RAM instruction is sent. Only in this way can the DS18B20 perform the intended operation. This system is a multi-channel temperature acquisition circuit design. In this case, we can use a grouping approach, using multiple I/O pins of the microcontroller to drive multiple DS18B20 channels.

3.3 Alarm Circuit Design

To implement a multi-point temperature detection and alarm system, the alarm design uses an AT89C51 microcontroller as the main controller. It uses a scanning method to obtain the temperature value corresponding to the location of the DS18B20 temperature sensor at multiple points. After processing, the value can be immediately sent to the host computer via serial port. If the temperature is not within the set range, an audible and visual alarm signal will be given.

3.4 LCD Display Circuit Design

The display design uses an LCD1602 to display temperature, alarm positions, etc. The LCD displays real-time temperature information from three different locations and temperature exceeding alarm information on the same screen. Repeated experiments have proven its accuracy and reliability.

4 System Software Design

4.1 Main Program Design Flowchart

The software design of this system mainly consists of a main program, a display subroutine, a key scanning subroutine, and a temperature setting subroutine. The flowchart of the main program is shown below. First, the LCD1602 is initialized, then the DS18B20 is checked for proper functioning, followed by a key scan. After scanning, the previously set temperature range is read, and the current temperature is read from the DS18B20 for calculation. If the alarm requirements are met, the alarm circuit sounds a buzzer.

Figure 3 Main Program Flowchart

4.2 Main Program Description of Software Design

5. System Overall Design Circuit Diagram and Description

As required by the design, this design is implemented using the AT89C51 microcontroller. The main control circuit of the AT89C51 microcontroller includes: a reset circuit and a clock circuit.

Reset circuits typically employ two methods: automatic power-on reset and button reset. Microcontrollers require a reset upon startup to ensure the CPU and all system components are in a defined initial state and begin operation from that state. To ensure reliable system reset, a certain reset delay time is applied in the initialization program. When the software program malfunctions or a hardware error occurs, the reset circuit generates a reset signal, controlling the MCS-51 microcontroller to start executing the program from memory location 0000H, thus re-running the software program.

The clock is crucial in microcontrollers, directly affecting their speed and system stability. All functional components of a microcontroller operate based on the clock frequency. There are two common clock circuit methods: internal clock and external clock. MCS-51 microcontrollers often use a 12MHz quartz crystal oscillation frequency. External clock methods use an external oscillation pulse signal and are commonly used when multiple MCS-51 microcontrollers are operating simultaneously for synchronization. This design uses only one MCS-51 microcontroller, so the internal clock method is employed.

In summary, the overall circuit diagram is shown in Figures 4 and 5:

Figure 4 Reset Circuit

Figure 5 Reset Circuit

Read next

CATDOLL Charlotte Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22