Frontiers in Computing and Intelligent Systems ISSN: 2832-6024 | Vol. 5, No. 3, 2023 54 Non‐contact Infrared Temperature Measuring Device based on stm32 Fanrun Meng, Zhiren Zhu, Liming Zhou College of Electronic Engineering, Tianjin University of Technology and Education, Tianjin 300222, China Abstract: With the epidemic raging around the world, people's health is under great threat. How people can detect the epidemic in the first time becomes a very important matter. At this stage, the primary symptom of the outbreak is fever. Therefore, whether in hospitals, various government administrative departments or in office buildings, residential areas and other crowded areas, will be measured by the body temperature to judge the health of personnel. However, the traditional methods of temperature detection need to touch or test the subjects at close range, which will bring certain threats to the human health of the inspectors. Therefore, the design of non-contact and remote epidemic prevention and control equipment is extremely urgent. In this paper, through the use of STM32F103C8T6 micro-controller, the ultrasonic ranging module is used to monitor the distance of the measured personnel in real time. When the measured personnel enter the test range, the infrared temperature sensor MLX90614 is used to test the temperature of the measured personnel. Once it exceeds the set alarm value, the alarm is alerted. The system has high testing efficiency and precision, which is suitable for epidemic prevention and control. Keywords: STM32F103C8T6 Micro-controller; Ultrasonic Ranging Module; MLX90614 Infrared Temperature Sensor. 1. Introduction The purpose of this topic is to develop a non-contact infrared temperature measurement device that is simple to operate and accurate in detection. Because the new coronavirus has a very strong transmission ability, the developed device must achieve a short measurement time to avoid the patient contacting with other people for a long period of time; at the same time, this device should have a high detection accuracy. According to this feature, this topic is committed to the use of temperature sensors through the realization of a microcontroller[1][2] such a fast and efficient microprocessor to achieve real-time, accurate testing of people's body temperature. The microprocessor is a fast and efficient automatic processing equipment, and choosing a suitable one for the project among the many microcontroller models is a research component of the project. In addition, the accuracy of the sensor and the test time are prerequisites for the successful realization of the system. Therefore, what kind of sensor products to use is also a very important research content of this project. 2. System Architecture Analysis 2.1. Design Proposal 2.1.1. Microcontroller Selection Option 1: STM32 microcontroller STM32[3][4] series microcontroller is a class of 32-bit microcontroller, which has faster processing speed, more internal registers and more external devices that can be connected. In addition, as an ARM core processor, the unique architecture of the STM32 MCU allows it to meet the needs of most designs. Option 2: Arduino Arduino microcontroller is a new type of electronic platform that can be controlled using C, java, or even reptilian language (Python). It consists of two main parts: the Arduino board and the Arduino IDE. Arduino can sense the environment through different sensors. Arduino based projects can either contain only Arduino or can contain Arduino along with some other software that runs on PC. Option comparison: STM32 series microcontroller and Arduino are both microprocessors, and there are more devices supporting STM32 series microcontroller, and the firmware library used in programming STM32 microcontroller can be borrowed from the program of similar projects through the method of transplantation, which can effectively improve the efficiency of programming. Therefore, we finally choose STM32 microcontroller as the control chip. 2.1.2. Sensor Selection Program 1: DS18B20 temperature sensor DS18B20 is a professional temperature detection sensor, there are different forms such as ordinary type, waterproof type, etc. The sensor can measure the temperature of the environment, but also can measure the temperature of the human body, however, it will be based on the measurement of the distance of the accuracy of the difference produces a certain difference. The sensor temperature detection range is -80 to 150 degrees, the accuracy is about 0.1 degrees, high accuracy. Program 2: MLX90614 infrared temperature sensor MLX90614 sensor is a non-contact infrared sensor. Program comparison: DS18B20 sensor detection accuracy and MXL90614 sensor is not much difference, the detection of the temperature range DS18B20 sensor is also a little more superior. However, DS18B20 sensor in the detection of human body temperature, the need to contact with the human body in order to better detect the accurate body temperature value, for the epidemic, the need to avoid contact, from this point of view, non-contact infrared sensors can be a good solution to this problem, although the temperature range is slightly poorer, however, the measurement of the accuracy of the similar, and can be infrared temperature measurement, in line with the design requirements. So, choose to use the MLX90614 infrared temperature sensor as a temperature measurement sensor device. 55 2.1.3. Display Selection Option 1: Digital Tube Digital tube is a kind of display device made by using LED light-emitting principle, which can display numbers from 0 to 9 and individual letters such as A, B, and so on. According to the direction of the LED, it has a common cathode, common anode difference, in the drive, you can directly display the numbers and letters written as an array of forms, and called in the program. The driver of the digital tube is relatively simple and does not take up a lot of ports, usually a 4-bit digital tube only needs to take up about 8 ports. Option 2: LCD1602 The LCD1602 is an LCD device that can display the numbers that the system needs to display, in addition to displaying letters and so on. When it adopts the direct control method, it occupies a large number of ports, and when it adopts the indirect control method, it occupies a small number of ports, and will occupy 11 ports at most. Option Comparison: Both digital tube and LCD1602 can display temperature and distance, only the digital tube displays fewer digits and LCD1602 can display more digits. With the increase in the number of digital tubes, the number of ports it occupies is also growing, so, from the perspective of the number of displays, there is no doubt that LCD1602 is more appropriate. The LCD1602 is finally chosen as the display device. 3. Hardware Circuit Analysis 3.1. Infrared Temperature Module Design One of the main tasks of the system is to measure the body temperature of the user. To better measure the body temperature without contact, the system uses a non-contact infrared temperature[5] measurement sensor, MLX90614. The circuit diagram of the non-contact infrared sensor, is shown in Figure 1. The pin description of the device, as shown in Table 1. Figure 1. Infrared temperature module circuit diagram Table 1. Non-Contact Infrared Sensor Pinout Serial No. Name Pin Description 1 VCC Power Positive 2 GND Ground 3 SCL Serial clock line 4 SDA Serial data cable The module has four pins, namely: VCC, GND, SCL and SDA. The communication between the module and STM32 microcontroller adopts the communication mode of I2C bus, and SCL connects to the B0 and B1 ports of STM32 microcontroller. I2C bus is a type of serial synchronous communication where SDA is used for data sending and receiving and SCL is used for synchronization of data sending and receiving. When it is idle, it presents the characteristics of high resistance state, and its start condition and stop condition are controlled by the host output level. SDA transmits one bit of data in each clock cycle of SCL, and in the process of transmitting, when SCL is at a high level, the data on SDA is in the valid state; and when SCL is at a low level, the data on SDA is in the invalid state. 3.2. Ultrasonic Ranging Module Design One of the core functions of this system is for the detection of distance, ultrasonic[6] distance measurement module is a device that utilizes the working principle of ultrasonic waves to measure the actual distance. The circuit diagram of the ultrasonic distance measurement module is shown in Figure 2, and the pin description of the device, as shown in Table 2 Figure 2. Ultrasonic Ranging Module Circuit Diagram Table 2. Ultrasonic Module Pinout Serial No. Name Pin Description 1 VCC 3.3-5V power supply, power positive 2 TRIG Trigger signal input 3 ECHO Trigger signal output 4 GND Ground The working principle of the ultrasonic module is: the module has a transmitter and a receiver, when the module transmits ultrasonic waves, it will turn on the timer at the same time, the ultrasonic signal encounters an obstacle, in addition to a small portion of it will be absorbed by the obstacle, most of it will bounce back. At this time, the receiver will receive the signal and turn off the interrupt. This time will be automatically recorded by the microcontroller, and the speed of the ultrasonic wave transmitted in the air is constant, about 340m/s, so the distance can be calculated according to the formula of distance equal to speed × time (since the time is the time of a round trip, the distance is 2 times the distance). The power supply for the module is 3.3V, the TRIG pin is connected to port C15 of the microcontroller and ECHO is connected to port C14 of the microcontroller. 3.3. Display Module Design Table 3. LCD1602 Pin Function Serial No. Name Pin Description 1 VSS Power Ground 2 VDD Power Positive 3 V0 LCD Bias Input 4 RS Data/Command Selector 5 R/W Read/Write Control Signal 6 E Enable Signal 7 D0 Date I/O 8 D1 Date I/O 9 D2 Date I/O 10 D3 Date I/O 11 D4 Date I/O 12 D5 Date I/O 13 D6 Date I/O 14 D7 Date I/O 15 BLK Backlight Negative 16 BLA Backlight Positive LCD1602 display is a kind of passive display device, with its micro-power consumption, small size and strong anti- interference ability and other advantages, in many application systems in an increasingly wide range of applications. LCD l602 LCD module is two lines of 16 characters, with 5×7 dot 56 matrix graphics to display characters of the LCD display. LCD 1602 module pins according to the function of the pins can be divided into three categories: data, power and programming control class. class, power class, and programming control class. Among them, pins 7-14 for the data lines, select the direct control mode when you need to use 8 data lines, indirect control when you only need to use D4-D7 high four data lines. LCD1602 pin function is shown in Table 3, the circuit diagram of the display module, as shown in Figure 3. Figure 3. Display Module Circuit Diagram The control of the display module adopts the communication method of 4-bit indirect control, and the data lines of D4-D7 are connected to ports B5-B8 of the microcontroller. Besides, the three control ports of RS, R/W, and E are controlled by ports B12, B13, and B14 respectively, and the contrast adjustment end Ro ensures the display effect by connecting a potentiometer. 4. System Debug Analysis 4.1. Hardware Commissioning Usually, after the program design is completed, the program needs to be simulated using simulation software (e.g., Proteus, Multisim, etc.), but since the devices STM32, such as the infrared sensor and the microcontroller used in this design, do not exist in the software, it is not possible to simulate the system, and thus debugging of the hardware system can be carried out directly. Detecting the connection of the devices through a multimeter without powering up is called hardware testing. In the first step, the power interface is tested to see if VCC and GND, which are connected to the power supply, are correctly connected. In the second step, check whether the GPIO port and the pins of the device are the same as the bits declared in the program. Finally, press the switch to check whether the power supply port power is 5V and the pins of the STM32 microcontroller output both 3.3V and 5V. 4.2. System Debugging After the hardware circuit is tested without any problem, the system is tested as a whole. Turn on the power supply, first check whether both the upper and lower lines of the display show data and whether they are the same as those set in the program. The second step is to check whether the operation of the buttons is normal or not, press the three buttons respectively, and observe whether they are the functions of selecting, adding and subtracting respectively. If this function is normal, plug in the ultrasonic module and test whether the data on the display changes in real time. Finally, plug the infrared module, observe whether the temperature changes and whether the measurement results are accurate. During testing of the system, a number of issues arose, which are described: 1. Infrared temperature measurement accuracy of 0.01 degrees, too high precision. Solution: Usually, temperature displays are added or subtracted in 0.1 degrees, and using 0.01 is too precise to be meaningful for the design. Therefore, the range of the display is changed from 0.01 degrees to 0.1 degrees by modifying the program. 2.The display shows the temperature initially at 30 degrees and adds or subtracts by 0.1 degrees. Solution: Since the body temperature is 37 degrees, if the initial value is set to 30 degrees and carried out in 0.1 degrees plus or minus, so that the alarm value will be added to 37 degrees is too much trouble, in order to adapt to the body temperature of 37 degrees alarm, the program will be changed to the initial value of the temperature to 37 degrees. 3. Infrared temperature measurement module does not measure temperature. Solution: The module does not display the temperature, first of all, check the connection of the hardware, whether the four pins are connected to the power supply, whether it is connected to the microcontroller port of the statement, by checking the hardware and there is no problem. After that, check the software part, the infrared module communicates with the microcontroller through the I2C bus, whether the start and stop are written correctly, and whether the acquired data are written correctly, firstly, check whether the communication of the infrared module is correct or not, and secondly, check whether the address and the data that this data is written to display are correct or not. By checking the program, it is found that it is caused by the start state of I2C communication is written wrongly and not set high level, and this problem is solved by modifying the program. 5. Conclusion Figure 4. Schematic 57 This topic through the STM32F103C8T6 microcontroller control system operation, the use of ultrasonic ranging module for real-time monitoring of the distance of the person under test, when the person under test into the test range, the use of MLX90614 infrared temperature sensor for the test of the person under test for the test of the temperature of the person under test, once exceeded the set alarm value the system will beeping alert. The system is designed to respond to the epidemic prevention and control, therefore, the design functions are determined to serve this purpose. According to the requirements of the function, the suitable devices are selected reasonably, and the circuit diagram is drawn according to the working principle of the devices and the program is written according to the circuit diagram. Finally, the complete circuit schematic of this design is attached, as shown in Figure 4. References [1] Peter, Grosshans. "micro controller.", KR20010014972A. 2001. [2] Xu, et al. "How to enhance the reliability of a single chip microcomputer application system." - (2006). [3] Zhang, Hui Fu , and W. Kang . "Design of the Data Acquisition System Based on STM32." Procedia Computer Science 17(2013):222-228. [4] Xu, Zhang . "Design of electric power data acquisition system based on STM32." Electronic Measurement Technology (2010). [5] Lussier, Sherin , D. R. Tomellini , and M. Penney . "Infrared thermometer." US, US20050226307. 2005. [6] Peng, Chunyi, et al. "Acoustic ranging." US, US2008 304361A1.