Academic Journal of Science and Technology ISSN: 2771-3032 | Vol. 8, No. 3, 2023 14 Laboratory Reactor Monitoring System Based on IoT Xinbo Yang1, a, Dazhi Yang1, b, Yuxing Wang1, c Sichuan University of Science & Engineering, Yibin 644000, China a1433635576@qq.com, b15708179867@qq.com, c1192534921@qq.com Abstract: In response to the limitations of existing laboratory reaction vessels, such as the lack of remote monitoring and low level of intelligence, a laboratory reaction vessel monitoring system based on the Internet of Things (IoT) is designed. This monitoring system utilizes a controller with the STM32F407 chip as its core to collect and control the temperature and motor parameters of the reaction vessel. Data exchange with the OneNET cloud platform is facilitated through a WiFi communication module. The remote monitoring terminal establishes a WiFi connection with the OneNET cloud platform, enabling real-time data and command transmission with the STM32F407 controller. Experimental results demonstrate that the system can effectively achieve real-time remote monitoring of the reaction vessel’s operational status, meeting the expected objectives. Keywords: Laboratory reactor, stm32f407, Onenet cloud platform. 1. Introduction Reactors in laboratory settings play a pivotal role in sectors including food production, medicine, and specialty chemical manufacturing. The exacting regulation and observation of parameters, such as temperature and motor speed within these reactors, assist in the elevation of reactive productivity and the bolstering of manufacturing safety. Consequently, there has been a trend towards continual refinement and the intelligentization of reactor control apparatuses [1]. Predominantly, the surveillance of reactions within laboratory reactors by current control systems is conducted through numerical instruments affixed to the reactors themselves [2], hindering remote monitoring and lacking data retention capabilities, which necessitate manual data recording and thereby reduce operational efficiency. In response, a novel laboratory reactor monitoring system was architected, leveraging an STM32F407 microchip-based controller, an intuitive visualization interface via the OneNET cloud platform, a WeChat mini-program for remote oversight, and an interactive touchscreen for local control, all underpinned by IoT technology. This innovative system provides the facility for monitoring laboratory reactors both distantly and locally without wires. 2. Organization of the Text This system comprises a remote monitoring module, a local control module, and an execution and monitoring module. The remote monitoring module is established using a WeChat mini-program as well as the OneNET data visualization interface and cloud platform, facilitating real-time remote surveillance of the reaction vessel’s operational state. The local master control module, composed of an STM32F407 controller, a touchscreen, and a WiFi module, is responsible for collecting and regulating the temperature and motor parameters of the reaction vessel and transmitting this data to the remote monitoring module via WiFi. The execution and monitoring module encompasses a temperature acquisition module, a stirring motor, an electric heating rod, a brushless motor drive board, and a solid-state relay. The temperature acquisition module sends collected temperature readings to the main controller, which then utilizes a PID algorithm to produce PWM signals controlling the solid-state relay’s switching, indirectly modulating the heating rod’s power. The STM32F407 controller also actuates a DC brushless stirring motor through a brushless motor driving circuit. The overall framework for the laboratory reactor monitoring system is illustrated in Figure 1. Figure 1. Presents an overview of the system’s overall structure. 3. Design of System Hardware 3.1. Choice of Master Microcontroller The chief microcontroller for the laboratory reactor monitoring system employs the STM32F407 chip, which utilizes an ARM Cortex-M4 core. With its extensive peripheral resources, it is capable of fulfilling every functional demand of the system. The board features a high clock frequency of up to 168MHz, 140 GPIOs, 192KB SRAM, 1MB FLASH, and 12 16-bit timers, offering a rich set of resources that ease the integration of external circuits. 3.2. Touchscreen Interface A Taojing TJC8048X570_011 serial touch screen handles the system’s display and control functions. The touchscreen’s operational voltage spans 4.75 to 7V and has a 7-inch 15 interface, including an inbuilt ARM7 microprocessor. It is linked to the STM32F407 controller through a serial port, employing a custom-tailored communication protocol [3] 3.3. Wireless Connectivity For data forwarding, the system utilizes an ESP8266-01S wireless WiFi module, interfacing with the main microcontroller through a serial port. The module functions as a client device under Station mode, connecting the STM32F407 controller to the internet via a WiFi network [4]. 3.4. Temperature Data Acquisition The system’s temperature data is collected by a combination of the MAX31865 module and a PT100 platinum resistance temperature sensor. The MAX31865 is equipped with a 15-bit ADC and accommodates 2-, 3-, or 4- wire connections, featuring a maximum conversion duration of 20 milliseconds. The PT100 sensor is capable of high- precision measurements over a temperature range of -200°C to 800°C. Illustration 2 shows the wiring schematic of the MAX31865 module, connecting a three-wire PT100 sensor via FORCE+, RTDIN+, and RTDIN-. The module translates the PT100 sensor’s resistance and the ratio of voltage drops across a reference resistor into a digital readout, which is processed by the microcontroller through the SPI bus [5]. Figure 2. MAX31865 Module 3.5. The motor module The system’s blender incorporates a direct current brushless motor, actuated via a tri-phase H-bridge driver. Operationally, a Hall sensor affixed to the motor’s extremity captures the rotor’s positional data, with feedback relayed to an STM32F407 controller. Employing a six-step commutation paradigm, the STM32F407 orchestrates the motor’s kinetic function by systematically engaging the drive board’s MOSFETs [6] Motor velocity is gauged by Hall sensor output and deduced according to Equation 1, whereby N denotes the rate of revolution in RPM, F_t corresponds to the Hall pulse frequency, and C signifies the cumulative counts. Figure 3 illustrates the voltage acquisition schematic for the motor driver, inclusive of supply voltage and thermal detection. A resistive divider circuit feeds into the LMV358 dual op-amp’s A channel, with the same nodal voltage present at Pin 1. Post ADC assimilation, the supply’s voltage tally, VBUS, is ascertainable via Equation 2. Temperature is ascertained using an NTC thermistor (R1), inversely proportional to thermal influx. This NTC, alongside a 4.7K resistor, establishes a potential drop, interfaced through the B channel op-amp, rendering an ADC-collected VTMEP signal capable of R_t resistance delineation through Equation 3. R_t, thus, aligns with the NTC’s resistive index at extant temperatures, with the board’s thermal state inferable through an NTC cataloged dataset. 𝑁 ∗ ∗ 60 (1) 𝑉𝐵𝑈𝑆 ∗ 1𝐾 (2) 𝑉𝑇𝑀𝐸𝑃 . . ∗ 4.7𝐾 (3) Figure 3. Power Supply Voltage and Temperature Acquisition Circuit 4. Software Design The software design primarily encompasses the STM32F407 controller program, along with various functional subroutines, such as the program for communication between the ESP8266 module and the OneNET cloud platform, as well as the design of the monitoring interface. 4.1. Main Control Program Design The STM32F407 controller program is written in C language on the Keil uVision5 development platform, encompassing the temperature module data acquisition program, serial communication program with the touchscreen, serial communication program with the WiFi module, brushless DC motor drive program, and the PID water temperature regulation program for the reaction kettle. The flow of the STM32F407 controller program is illustrated in Figure 4. Upon power-on, the system initializes, including the initialization of the serial ports, timers, variables, as well as the temperature acquisition module and the WiFi module. Subsequently, the system parameters are set via the touchscreen, adjusting the temperature of the reaction kettle and the operating speed of the stirring motor. Following this, the values of the temperature sensor and motor operating parameters are collected. The motor is controlled using the motor drive program, while the PID water temperature control algorithm regulates the temperature of the reaction kettle based on the collected temperature values. Finally, the STM32F407 controller sends data to the cloud platform via the WiFi module. 16 The branch on the right side of Figure 4 presents the PID water temperature control process. When the temperature falls below the set value, the STM32F407 controller outputs PWM waveforms to control the on-off cycle of the solid state relay, indirectly regulating the power of the heating rod. When the temperature exceeds the set value, the heating rod is turned off for natural cooling. Figure 4. Flowchart of the STM32F407 controller program 4.2. The communication between ESP8266 and the OneNET cloud platform The communication between the ESP8266 wireless module and the OneNET cloud platform is based on the MQTT protocol. To enable the ESP8266 module to send data to the cloud platform, it is necessary to first configure the OneNET cloud platform, create a product, add a device, and then initialize the WiFi module, connect to the cloud platform, and send the data [7]. The process through which the STM32F407 controller sends data to the cloud platform via the ESP8266 is depicted: Initially, the controller sends a series of AT commands to the ESP8266 wireless module through the serial port for initialization. These commands encompass testing, setting the module’s operational mode, resetting, enabling DHCP, connecting to WiFi, and ultimately establishing a TCP connection alongside configuring the IP address and port number of the cloud platform to connect to the OneNET server. Subsequent to connecting to the cloud platform, the STM32F407 controller encapsulates the data into an array and transmits the encapsulated data to the cloud platform based on the previously acquired API-Key, product ID, and device ID during the OneNET cloud platform configuration process [8]. 4.3. Monitoring Interface Design The monitoring interface consists of the OneNET data visualization interface, WeChat mini-program interface, and touch screen interface. The OneNET application editing module provides a UI management interface that transforms the data uploaded by the terminal devices into visual forms such as curves, charts, and dashboards. By dragging the provided controls onto a blank canvas and configuring the properties of the controls, including creating data sources, binding the data streams to be displayed, and specifying relevant names and data formats, the application design can be completed. Once successfully published, the system generates a URL link that allows users to monitor in real-time the temperature and motor operation 17 parameters of the reaction kettle by opening the link on a computer. This system utilizes WeChat mini-program as the mobile monitoring platform, and the design of the WeChat mini- program is implemented using WeChat Developer Tools with JavaScript as the development language. The mini-program includes a home page and a temperature curve interface, allowing users to intuitively monitor parameters such as motor speed, temperature, and driver board voltage of the reaction kettle. Users can also adjust the motor speed and temperature of the reaction kettle by dragging sliders. [9] The touch screen manufacturer provides a graphical HMI software for designing the touch screen interface. This software supports various configuration controls, including buttons, progress bars, text, and pointers, to meet different design requirements. Users can easily achieve layout design by simply dragging and dropping controls, making the development process straightforward and efficient. The software also offers special data instructions for implementing logical functions. 5. Methodology of Testing and Analysis This document outlines the creation of an IoT-based reactor monitoring system for laboratory use, developed after a thorough investigation of the system’s software and hardware dynamics. To validate the functionality, a 5-liter water tank was utilized as a surrogate for the reactor during laboratory test trials, with the test setup illustrated in Figure 5. Figure 5. Diagram of the Experimental Platform During testing, the interfaces for system monitoring at a given instant were documented via screenshots. Figure 7 showcases the local touchscreen monitoring interface, while Figures 6 and 8 depict the remote OneNET visualization interface and the WeChat mini-program interface, respectively. These interfaces confirm the successful reception of data by the OneNET cloud platform from the STM32F407 controller, and the seamless representation of various parameters such as reactor temperature and motor speed, with the speed slider manipulating the Pulse Width Modulation (PWM) duty cycle. Motor speed and temperature settings could be configured either directly on the local touchscreen or remotely by manipulating the controls on the interfaces of the WeChat mini-program or OneNET visualization, hence adjusting the reactor’s internal conditions. Figure 6. OneNET Data Visualization Interface Figure 7. Touchscreen Interface Figure 8. WeChat Mini Program Interface 6. Summary The IoT-based laboratory reactor monitoring system integrates multiple technologies such as OneNET cloud platform, WeChat mini-program, serial communication, and wireless communication. It accomplishes both remote and local monitoring of the laboratory reactor. The chief innovation of the system lies in its use of the WeChat mini- program and the OneNET cloud platform to enable remote monitoring capabilities. Test results have demonstrated that the system is capable of displaying the reactor’s temperature and motor operational parameters both remotely via the 18 OneNET cloud platform’s visualization interface and the WeChat mini-program, as well as controlling these variables through the touchscreen interface, the mini-program, and the visualization interface. This affirms that the system achieves the anticipated functionality and offers significant reference value for the industry of reactor monitoring systems. References [1] Huai Chaolei. Optimization of Reactor Temperature Control Parameters and PLC Control System [D]. Hebei University of Science and Technology, 2020. [2] Wang, Huaqiang, and Xu, Qiutian. Remote Monitoring System for PET Reactor Based on IoT and Cloud Platform. [J]. Instrumentation Technology and Sensors, 2016(12):79-82. [3] Li, Liangjing, Zhang, Xueqin, and Liu, Huabo. Design of Energy-saving Constant Temperature Control System Based on USART-HMI Smart Serial Screen. [J]. Manufacturing Automation, 2021, 43(09): 140-143. [4] Zhang, Qilong, and Chen, Xiangping. Smart Home System with OneNET Cloud Platform and WiFi Remote Control. [J]. Modern Electronics Technique, 2020, 43(14): 25-29. [5] Li, Wenqin, Zhong, Yimin, and Fang, Ting. Design of High- precision Monitoring System for Furnace Wall Water Temperature Difference Based on MAX31865. [J]. Journal of Lanzhou University of Technology, 2020, 27(06): 62-66. [6] Wang, Huaqiang, and Fan, Xianwen. Optimal Design of Brushless Motor Speed Control System Based on PID Algorithm. [J]. Manufacturing Automation, 2022, 44(07): 110- 112+144. [7] Liu, Zhongchao, and Fan, Lingyan. Design of Cow Pedometer System Based on STM32 and OneNet Cloud Platform. [J]. Transactions of the Chinese Society of Agricultural Machinery, 2022, 43(07): 31-35. [8] Liu, Zhongchao, Ding, Qianhua, Fan, Lingyan, et al. Design of Cow Body Temperature Monitoring System Based on WiFi and Cloud Platform. [J]. Heilongjiang Animal Husbandry & Veterinary Medicine, 2022(08): 55-59. [9] Feng, Dongdong, Wang, Juan, Zhu, Jiajun, et al. Development of Cattle Farming Environmental Monitoring System Based on Internet of Things. [J]. Journal of Hebei Agricultural University, 2023, 46(01): 103-109.