Skip to main content

An intelligent heating system based on the Internet of Things and STM32 microcontroller


Under the rapid growth of Internet of Things technology, many households are moving towards smart solutions. Addressing the inflexibility of temperature control in traditional heating systems, this research focuses on designing an intelligent heating system. To enhance flexibility and intelligence, an intelligent heating system based on the Internet of Things and STM32 microcontroller is proposed. Furthermore, the study identifies limitations of traditional proportional-integral-derivative control methods and establishes an optimization control model for heating system output temperature based on the Dynamic Matrix Control algorithm. Results indicate that the system's web interface successfully draws temperature curves, displaying clear data on detected temperature and humidity. The output temperature optimization control model shows a temperature rise of 2 °C and a temperature control error index of 0.0543 during the initial heating stage, and a control error index of 0.0353 during the mid-heating stage when the valve relative opening is close to 0. And the temperature control effect is better than traditional PID control, fuzzy PID control, genetic algorithm based PID control, and predictive feedback predictive control, without obvious indoor temperature overshoot phenomenon, which has certain advantages. In conclusion, the proposed system and model exhibit favorable application outcomes, offering technological support for the intelligent management of heating systems.


As the economy advances and living standards improve, the development of intelligent infrastructure closely related to residential life is gaining attention. Heating, a system or device used for warming indoor spaces, plays a crucial role in ensuring a comfortable living environment during cold winters (Sabory et al. 2021; Cao et al. 2022). Traditional heating systems face challenges in adjusting temperatures flexibly, providing suboptimal heating effects for users in high-rise buildings, and lacking comprehensive user management (Aldossari and Sidorova 2020). The rapid development of Internet of Things (IoT) technology enables the interconnection of various smart devices and sensors, facilitating remote communication and establishing intelligent home ecosystems (Liu et al. 2021). In heating systems, IoT technology allows sensors and smart devices to collaborate, achieving intelligent temperature regulation, optimizing energy consumption, and providing users with remote control and customized comfort experiences (Mao et al. 2020). The evolving IoT technology opens up possibilities for home automation and the intelligence of heating systems. However, current research on combining IoT technology with heating systems is still relatively immature, and the overall intelligence level of heating systems remains modest. In this context, this study designs an intelligent heating system based on the IoT and STM32 microcontroller, and constructs an optimization control model for heating system output temperature based on the Dynamic Matrix Control (DMC) algorithm. The innovation in this study mainly consists of two points. The first point involves choosing ZigBee technology as the method for constructing the wireless sensor network of the system. The second point involves utilizing the DMC algorithm to optimize control over the output temperature of the heating system. The main structure of the research is categorized as six parts. The first part is the introduction. The second part is an overview of the current research status on the Internet of Things and intelligent heating systems. The third part is to design an intelligent heating system based on the Internet of Things and STM32 microcontroller, and build a heating system output temperature optimization control model based on the DMC algorithm. The fourth part is to analyze the application effect of the proposed intelligent heating system and output temperature optimization control model. The fifth part is the discussion. The final part is a summary of the entire research.

This research designed an intelligent heating system and optimized indoor temperature control using DMC algorithm, which can promote the deep connection between Internet of Things technology and heating systems, strengthen the application of intelligent algorithms in temperature control of heating systems, and provide users with more convenient temperature control services. Beneficial for improving user experience, promoting the intelligent development and energy-saving optimization of heating systems, and providing certain technical support for intelligent heating systems.

Related works

IoT refers to a network that connects objects to the internet through agreed-upon protocols using information sensing devices, facilitating the intelligent transformation of life, production, and societal management. Nguyen et al. state that 6G aims to fundamentally change customer services and applications through IoT, making fully autonomous and intelligent systems. They conduct a comprehensive investigation into the fusion of 6G and IoT, exploring chances for 6G technology in IoT (Nguyen et al. 2021). Li et al. address IoT security issues. They explore the possibilities of incorporating deep learning for IoT security architecture enhancement. They discuss IoT design for identifying and responding to net attack and encrypted edge data transfer. This linkage of high-risk network activities with entities is seen as a means to promote the industrial development of IoT (Li et al. 2021). Serror et al. observe a natural trend of IoT-connected devices in industrial environments, referred to as Industrial IoT or Industry 4.0. They conduct a comprehensive survey of research on the security of Industrial IoT, discussing their applicability and analyzing their security benefits (Serror et al. 2020). Xing aimings to help IoT achieve an intelligent, convenient, and efficient transformation of human society, establishes a layered IoT architecture. They identify reliability challenges brought by specific enabling technologies at each layer, conduct a systematic synthesis for challenging IoT research problems and opportunities (Xing 2020). Tran-Dang et al. propose an IoT ecosystem to explore opportunities for IoT technology in the vision of the Physical Internet. The ecosystem includes key IoT technologies, building blocks, and a service-oriented architecture, serving as a potential component to accelerate the realization of the Physical Internet (Tran-Dang et al. 2020). Hansen and Bøgh focus on the importance of small and medium-sized enterprises gaining access to IoT and artificial intelligence technologies. They conduct a comprehensive survey and investigation on the prevalence of artificial intelligence and IoT in small manufacturing enterprises, discussing the current limitations and opportunities for implementing predictive analytics (Hansen and Bøgh 2021).

The intelligent heating system, under the influence of the IoT, embodies the trend towards IoTification. It not only encompasses the functionalities of traditional home systems but also provides comprehensive information interaction capabilities. Cvitićet al. have pointed out that the communication traffic generated by IoT devices exhibits specific characteristics and differences compared to traditional devices. To leverage these features for classifying IoT devices in smart homes, they employed a supervised machine learning approach with enhanced logistic regression, establishing a classification model based on network traffic features generated by IoT devices (Cvitić et al. 2021). Paul et al. developed a multi-objective optimization framework for real-time energy management in smart homes. They designed the entire optimization set as a time-averaged stochastic problem, simplifying it through the integration of queuing theory and Lyapunov optimization methods. Results indicate that the proposed optimization framework exhibits certain advantages over a popular real-time energy management greedy algorithm (Paul and Padhy 2020). Soliyevich and Olimjon ogli stated that with the advancement of science and technology, modern technology has reached a new level, and the advent of smart homes has further improved people's lives and lifestyles (Soliyevich and Olimjon ogli K Z. 2021). Sun C et al. proposed a comprehensive control algorithm based on load prediction and indoor temperature measurement correction to address the potential imbalance between indoor temperature fluctuations and energy waste caused by heating system regulation. The results indicate that the proposed control algorithm can effectively improve the thermal comfort of users and reduce energy consumption (Sun et al. 2022). He et al. addressed the problem of balancing economic benefits and environmental protection in heating systems with single objective optimization, and conducted multi-objective optimization of heating systems through a combination of TRNSYS simulation, machine learning, and genetic algorithms (He et al. 2022). Wang et al. proposed a model predictive control algorithm for air source heat pump heating systems to address the issue of limited operational energy performance under actual conditions. This algorithm helps to provide real-time optimized compressor frequency and water mass flow rate, optimizing its overall operational performance (Wang et al. 2022).

In summary, despite extensive research by previous experts and scholars on IoT and intelligent heating systems, the current heating system still faces the problem of poor flexibility in temperature regulation, leading to serious waste of resources and unfavorable management. Therefore, this research proposes an intelligent heating system based on the IoT and STM32 microcontroller, aiming to provide users with more flexible and convenient temperature control operations, which has important practical application value and prospects.

Intelligent heating system based on IoT and STM32 microcontroller

The smartification of heating systems is of significant importance for enhancing residents' quality of life and reducing energy consumption. Addressing the inefficiencies, high energy consumption, and inflexible temperature control of traditional heating systems, this study aims to design an intelligent heating system based on IoT and STM32 microcontrollers. Additionally, an optimization control model for heating system output temperature will be established using the DMC algorithm.

Design of IoT-based intelligent heating system

The processor is located at the core of the gateway system in the intelligent heating system. It not only needs to read the temperature data of the temperature measurement circuit, but also needs to process and feedback the temperature data, and finally display it on the user's terminal device. At present, mainstream microprocessors are mainly divided into 32-bit, 16 bit, and 8-bit. Considering that 8-bit microcontrollers may have an impact on subsequent system upgrades, this study chose low-power 32-bit processors. The STM32 series microcontroller can operate in low-power mode and greatly reduce the amount of electricity consumed when using intelligent heating systems while meeting design requirements, thereby saving costs. The intelligent heating system designed in this study, based on IoT and STM32 microcontrollers, features remote control, wireless communication, and temperature and humidity data collection capabilities. The embedded processor module, with the STM32 microcontroller at its core. Currently, wireless network communication technologies mainly include infrared technology, Bluetooth technology, ZigBee technology, as well as WiFi and mobile communication technology. ZigBee technology has the advantages of simplicity, low power consumption, multiple nodes, and low cost, with a wider transmission range and faster transmission speed. Therefore, in this study, ZigBee technology was used for networking in the internal network of the intelligent heating system, and WiFi and 4G technology were used for networking in the external network. The gateway of the intelligent heating system serves as a central hub connecting various smart devices and sensors. It is responsible for data integration, communication management, device coordination, and provides capabilities for remote control and monitoring of the system (Lv 2021). The system proposed in this research offers advantages such as easy installation, simple operation, low power consumption, and ease of maintenance. The specific hardware architecture of the gateway is illustrated in Fig. 1.

Fig. 1
figure 1

Hardware structure diagram

The energy consumption characteristics of the heating system can significantly influence the overall building energy profile. Therefore, reducing the energy consumption of the heating system holds considerable importance for overall energy utilization (Usman and Abdullah 2023). In this study, the STM32F103C8T6 is chosen as the embedded processor for the intelligent heating system. By combining the peripheral circuits of the system, sensor-collected information is converted into processable data, facilitating the monitoring of environmental temperature and humidity and controlling the system accordingly. To perform the cyclic redundancy check (CRC) without consuming processor resources, an embedded CRC32 calculation unit is incorporated within the STM32 microcontroller. CRC is a commonly used checksum in the field of computer network communication, which uses polynomials to calculate the bits of data and compares them with the expected bits to detect any errors during data transmission. It has the advantages of clear principles and simple implementation. To ensure data integrity when handling large volumes of data, direct memory access (DMA) is primarily employed for data transmission and reception. For local display functionality, the STM32 microcontroller's Serial Peripheral Interface (SPI) controls the OLED display. Given that the STM32F103C8T6 requires a stable 3.3 V power supply, a step-down chip, MIC5205-3.3, is utilized to convert the voltage from 5 V to 3.3 V. As the processor's reset circuit operates at a low level, a classic RC series reset mechanism is employed for low-level reset of the processor. The layout diagrams for MIC5205 and the microcontroller are depicted in Fig. 2.

Fig. 2
figure 2

Wiring diagram for MIC5205 and microcontroller

The clock circuit of the heating system employs an 8 MHz passive crystal oscillator CSTCE8M00G55-R0. This passive crystal oscillator has a simple design and only requires a few resistors and capacitors to work normally, which can greatly reduce the design cost of the system. For humidity detection, the study utilizes a DHT11 digital sensor connected to an 8-bit microcontroller. The DHT11 sensor contains a resistive humidity sensing element, allowing for straightforward humidity data collection through simple circuit connections to the microprocessor. It exhibits a fast response time and strong resistance to interference. For humidity detection, the research employs the highly integrated DS18B20 digital temperature sensor with a single-wire interface. The DS18B20 sensor requires no additional peripheral circuitry, offering advantages such as a wide measurement range, compact size, and strong resistance to interference. To minimize costs, the study selects the CC2530 chip as the ZigBee wireless communication module, which can build strong network nodes at a very low design cost. Network formation using the ZigBee module follows the process outlined in Fig. 3. Among them, the operation process of sensor nodes is to transmit the data information collected by various sensor nodes through the network constructed by ZigBee nodes to the ZigBee coordinator, which then transmits it to the main control center through serial communication. The operation process of device status is that each device transmits status information to the ZigBee coordinator through a network constructed by ZigBee nodes, and then transmits it to the main control center through serial communication. The main control center also sends control instructions to the ZigBee coordinator through serial communication, and forwards the control instructions to the terminal node through the network constructed by the ZigBee node. After receiving the control instructions, each sensor will perform relevant operations.

Fig. 3
figure 3

ZigBee module operation flowchart

The research adopts the Hall effect principle to detect the motor's speed. Initially, a disk with six equally spaced magnets on its edge is placed on the motor shaft. Two Hall sensors are then positioned at 90-degree intervals, generating two orthogonal signals. By detecting these signals, the motor's speed can be determined, facilitating motor control. The XRT115 precision current output converter serves as the system's transducer module, which can provide precise current scaling and output current limiting functions. For the electric actuator, a signal of 4 mA and 1 V corresponds to a valve opening of 0, while a signal of 20 mA and 5 V corresponds to a valve opening of 100. Any position's opening value can be calculated, enabling remote control of the valve. The ATK-ESP8266 module is chosen as the external network module, featuring LVTTL serial communication that can interface with other serial ports or MCUs. It includes a TCP/IP protocol stack, enabling seamless conversion between WiFi and serial communication with simple configuration of traditional serial ports. The display module uses a monochrome OLED module with the SSD1306 controller chip, set in four-line SPI mode and directly grounded. Keil MDK 5 is employed as the development tool for the heating system design, utilizing the HAL library for program development. Initialization is performed for the STM32 microcontroller's clock, delay functions, keypad, and serial port modules. The ESP-8266 wireless WiFi module is selected, establishing communication between WiFi and the STM32 microcontroller via TCP/IP protocol. In summary, the overall structure of the intelligent heating system is illustrated in Fig. 4.

Fig. 4
figure 4

The overall structure diagram of the intelligent heating system

In conclusion, to enhance the flexibility and intelligence of the heating system, this study, based on IoT and STM32 microcontroller technology, designs an intelligent heating system with features such as remote control, wireless communication, and temperature-humidity data collection.

Optimization control model for intelligent heating system output temperature

After the design of the hardware and software for the intelligent heating system, further research was conducted to optimize the control of the system's output temperature. Output temperature control directly impacts user comfort and energy consumption. PID control is a common method for controlling the output temperature of electric heating devices. The PID controller consists of proportional, integral, and derivative components, with the calculation of the error value given by Formula (1).

$$e(t) = r(t) - y(t)$$

In Formula (1), \(r(t)\) represents the setpoint, and \(y(t)\) represents the feedback value. PID control processes the error value to determine the control quantity, and the PID control rules are as shown in Formula (2).

$$u(t) = K_p\left[ {e(t) + \frac{1}{K_i}\smallint_{0}^{t} e(t)dt + K_d\frac{de}{{dt}}} \right]$$

In Formula (2), \(u(t)\) represents the control output, \(K_p\) represents the proportional coefficient, \(e(t)\) represents the control input, \(K_i\) represents the integral coefficient, and \(K_d\) represents the derivative coefficient. The structural diagram of the PID control strategy is illustrated in Fig. 5.

Fig. 5
figure 5

Structural diagram of PID control strategy

However, traditional PID control systems cannot adjust parameters online, affecting the precision of the control system. Therefore, this study proposes an indoor temperature control method based on the Model Predictive Control (MPC) algorithm. The MPC algorithm consists mainly of a predictive model, feedback correction, and rolling optimization. It is a predictive control algorithm that calculates the optimal control quantity for the next moment by predicting the error between the indoor temperature and the set temperature (Zhang et al. 2020). The DMC algorithm first calculates the deviation between indoor temperature and the set value in advance through the prediction model, then calculates the optimal control quantity for the next moment through rolling optimization, and finally calibrates the prediction model through feedback correction. Therefore, by transmitting the user's indoor temperature to the DMC algorithm control program at each moment, the temperature for the next moment can be calculated, thereby achieving temperature control. The predictive model first needs to obtain the unit step response curve of the object and provide the values at each specified sampling point according to the specified sampling period. The predicted output is given by Formula (3).

$$y_pm(k) = y_p0(k) + A_m\Delta u_m(k)$$

In Formula (3), \(p\) represents the prediction time domain, \(m\) represents the control time domain. \(y_pm(k)\) represents the predicted output for the next \(p\) moments under the action of \(m\) control increments at time \(kT\). \(y_p0(k)\) represents the predicted output for the next \(p\) moments at time \(kT\) without the action of control increments. \(A_m\) represents the dynamic matrix of the algorithm. \(\Delta u_m(k)\) represents the control increment matrix starting from time \(kT\). In this study, the input to the predictive model is the valve opening degree, and the output is the indoor temperature. The MPC algorithm calculates the optimal control quantity for the next moment through rolling optimization. At time \(kT\), the optimization performance index is given by Formula (4).

$$\min J(k) = \min \left\{ {\sum\limits_{i = 1}^{p} {q_i\left[ {w(k + i) - y_m(\left. {k + i} \right|k)} \right]^{2} + \sum\limits_{j = 1}^{m} {r_j\Delta u^{2} (k + j - 1)} } } \right\}$$

In Formula (4), \(J(k)\) represents the optimization index, \(q_i\) represents the error weight coefficient, \(w(k + i)\) represents the desired value, \(y_m(\left. {k + i} \right|k)\) represents the predicted values of the future \(p\) outputs, and \(r_j\) represents the control weight coefficient. Without considering constraints on the control quantity and the controlled variable, the control increment sequence that minimizes \(J(k)\) can be obtained by solving the necessary conditions for extremum. This set of optimal control increment sequences is the open-loop optimal solution, as shown in Formula (5).

$$\left\{ {\begin{array}{*{20}c} {\Delta u_m(k) = (A_{m}^{T} QA_m + R)^{ - 1} A_{m}^{T} Q[w_p(k) - y_p0(k)]} \\ {Q = diag(q_1,q_2,...,q_p)} \\ {R = diag(r_1,r_2,...,r_p)} \\ \end{array} } \right.$$

In Formula (5), the control is represented, where \(Q\) stands for the error matrix, and \(R\) represents the control matrix. \(w_p(k)\) denotes the matrix of expected future outputs for the next \(p\) time steps when \(kT\) is considered, as shown in Formula (6).

$$w_p(k) = \left\{ {\begin{array}{*{20}c} {w(k + 1)} \\ {w(k + 2)} \\ {...} \\ {w(k + p)} \\ \end{array} } \right\}$$

To correct errors between the prediction model and reality, it is necessary to promptly adjust output predictions using the error information of the process. For this purpose, the first control increment \(\Delta u(k)\) from the \(\Delta u_m(k)\) should be implemented at \(kT\), as indicated in Formula (7).

$$\left\{ {\begin{array}{*{20}c} {\Delta u(k) = c\Delta u_m(k) = d[w_p(k) - y_p0(k)]} \\ {c = (1,0,...,0)_{1 \times m}} \\ {d = c(A_{m}^{T} QA_m + R)^{ - 1} A_{m}^{T} Q} \\ \end{array} } \right.$$

In Formula (7), \(c\) and \(d\) represent intermediate transformation matrices. The calculation of prediction errors is defined in Formula (8).

$$e(k + 1) = y(k + 1) - y1(\left. {k + 1} \right|k)$$

In Formula (8), \(y(k + 1)\) represents the prediction error at \((k + 1)T\), \(y(k + 1)\) is the actual output of the control system at \((k + 1)T\), and \(y1(\left. {k + 1} \right|k)\) is the output of the prediction model at \((k + 1)T\). The correction of control system output predictions can be achieved by weighting the errors. The corrected prediction of the control system output at \((k + 1)T\), \(y_{cor}(k + 1)\), is expressed in Formula (9).

$$y_{cor}(k + 1) = y_p1(k) + h_e(k + 1)$$

In Formula (9), \(h\) represents the error correction vector. Since the predicted future time points will shift with changes in the time base, \(y_{cor}(k + 1)\) needs to be shifted to become the initial prediction at \((k + 1)T\), as demonstrated in Formula (10).

$$y_p0(k + 1) = sy_cor(k + 1)$$

In Formula (10), S denotes the shift transformation matrix, as given in Formula (11).

$$s = \left\{ {\begin{array}{*{20}c} {0,1,0,...,0} \\ {0,0,1,...,0} \\ {...} \\ {0,0,0,...,1} \\ {0,0,0,...,1} \\ \end{array} } \right\}p \times p$$

Additionally, this study introduces the temperature control error index to evaluate the effectiveness of the output temperature control. A larger value of this index indicates poorer control performance of the DMC algorithm. The calculation of the temperaturx is outlined in Formula (12).

$$\left\{ {\sigma comf = \begin{array}{*{20}c} {\frac{{\sqrt {\frac{1}{N}\sum\limits_{k = 1}^{N} {[y(k) - yset(k)]^{2} } } }}{{\left| {\max yset(k)} \right|}}} \\ {N = \frac{tN}{T}} \\ \end{array} } \right.$$

In formula (12), \(y(k)\) represents the actual indoor temperature, \(yset(k)\) is the set indoor temperature, \(N\) is the sample quantity, and \(tN\) is the simulation time. In summary, the specific process of the output temperature control optimization model based on the DMC algorithm is illustrated in Fig. 6.

Fig. 6
figure 6

Flowchart of optimization model for output temperature control based on DMC algorithm

The DMC algorithm is a method for calculating control increments that can stabilize the output of the control system near the desired value, regardless of whether the model has errors. Even in the presence of disturbances, it can restore the controlled variable of the control system to the set value. In addition, this study simulated the actual heat transfer process of buildings using TRNSYS software, and transmitted the user's indoor temperature to the DMC algorithm control program at each simulation time. Using Sketch Up software to establish a 3D model of the building, with a total of 3 floors and 3 rooms on each floor. The length x width x height of each room is 5.0 m × 3.5 m × 3.0 m. Each room is set as a separate hot zone, and to reduce the impact of heat transfer between households, insulation layers are added to the inner walls and floors.

The effectiveness of the intelligent heating system and temperature optimization control model

A smart heating system was designed, and an output temperature optimization control model was constructed to contribute to the intelligent development of heating systems. However, further validation is needed to assess its practical application. The analysis focuses on two aspects: simulation testing of the smart heating system based on IoT and STM32 microcontroller and an evaluation of the effectiveness of the output temperature optimization control model.

Results of intelligent heating system testing

To validate the application effectiveness of the designed intelligent heating system, experiments were conducted using the STM32 as the hardware platform, coupled with an IoT platform to simulate indoor and outdoor temperature variations and user temperature adjustment needs in a laboratory environment. The intelligent heating system underwent experimental testing. For the hardware components, a meticulous check was performed on the polarity and type of each element. Subsequently, a multimeter was used to inspect all pins on the circuit board, ensuring there were no connection errors. After checking the post-soldering circuit board for any missed or virtual soldering of components, it was ensured that the chip's soldering direction was correct and free of short circuits. The circuit board was then subjected to a powered test to ensure that no components overheated or burned, and that the module met the design specifications with correct functionality. The hardware, having undergone prototyping and debugging, successfully implemented the data monitoring function, as depicted in Fig. 7, which illustrates the physical appearance of the intelligent heating system hardware. It can be observed from Fig. 7 that the hardware dimensions meet the requirements, and after multiple tests, the sensors function correctly, the circuit connections are accurate, and the early design criteria are satisfied.

Fig. 7
figure 7

Physical diagram of hardware equipment for intelligent heating system

Subsequently, testing was conducted on the server component of the intelligent heating system. The real-time temperature variation curve displayed on the webpage is illustrated in Fig. 8. Figure 8 demonstrates that the designed intelligent heating system can provide a real-time curve of temperature changes, with a more gradual variation in indoor temperature compared to the significant fluctuations in outdoor temperature. Additionally, as the outdoor temperature decreases, there is a slow upward trend in indoor temperature, and remains at 25–27 °C, which can meet the suitable temperature environment for the human body in practical situations. The results indicate that the webpage of the intelligent heating system can effectively generate temperature curves, and can achieve the expected effect on indoor temperature control, showing promising feasibility and effectiveness.

Fig. 8
figure 8

Real time variation curve of indoor and outdoor temperature

The temperature and humidity trends recorded by the intelligent heating system are illustrated in Fig. 9. From Fig. 9a, it can be seen that as the testing environment changes, the temperature value also changes, and the cloud platform receives data normally. From Fig. 9b, it can be seen that the humidity value can also change with the changes in the testing environment, which is in line with the actual situation and has achieved the expected effect. The results show that the intelligent heating system can not only clearly display the detected temperature and humidity data, but also display the overall change curve of various parameters, with good accuracy and authenticity, achieving the expected effect.

Fig. 9
figure 9

Trends in temperature and humidity changes

To further verify the adaptability of the proposed system, simulations were conducted on high temperature environments in summer and low temperature environments in winter. The result is shown in Fig. 10. From Figs. 10a, b, it can be seen that the indoor temperature of the proposed intelligent heating system is relatively stable and always within the range that meets the user's temperature requirements, regardless of whether it is in high or low temperature environments. The results indicate that the proposed intelligent heating system can achieve the expected results in both high and low temperature environments, and has good applicability.

Fig. 10
figure 10

Test results in high and low temperature environments

The experimental results show that the intelligent heating system proposed in the study can provide users with good temperature control and humidity and temperature monitoring services, and has good performance. Not only can it provide certain technical support for the deep integration of Internet of Things technology and intelligent heating systems, but it can also improve the modernization level of intelligent heating systems. It can also provide some reference for future research on smart home systems that combine IoT technology, promote the application of IoT technology in daily life, and promote the development of smart home fields.

Analysis of the effect of output temperature optimization control model

To assess the effectiveness of the heating system's output temperature optimization control model based on the DMC algorithm, a study was conducted with the supply water temperature set at 60 °C. During the initial 10 h of heating, the indoor temperature was set to 23 °C, followed by a subsequent period where the indoor temperature was maintained at 20 °C. In the mid-heating phase, the indoor temperature was set to 22 °C for the first 10 h, and then adjusted to 17 °C for the remaining time. The variations in actual indoor temperature and the relative valve opening over time during the initial and mid-heating phases are illustrated in Fig. 11. From Fig. 11a, it can be observed that during the initial heating phase, when the relative valve opening approached 0, the actual indoor temperature exhibited a significant jump of 2 °C, with a temperature control error index of 0.0543. Figure 11b indicates that during the mid-heating phase, outdoor temperature became the predominant factor influencing the actual indoor temperature, with the valve playing a regulatory role, resulting in a temperature control error index of 0.0353. The results suggest that the heating system's output temperature optimization control model based on the DMC algorithm demonstrated good temperature control performance during different heating periods and exhibited robustness.

Fig. 11
figure 11

The variation of actual indoor temperature and relative opening of regulating valves over time

To evaluate the temperature control performance of the model under different supply water temperatures, the initial temperature was set to 18 °C, with the indoor temperature set to 22 °C for the first 10 h and then adjusted to 17 °C. The temperature control error index is used as the evaluation index, and its calculation is shown in formula (12). The larger the value, the worse the control effect of the algorithm, while the smaller the value, the better the temperature control effect. Experiments were conducted at supply water temperatures of 55 °C, 60 °C, and 65 °C, as illustrated in Fig. 12. Figure 12a shows that at a supply water temperature of 55 °C, the actual indoor temperature exhibited significant fluctuations but remained near the set temperature of 22 °C and 17 °C, with an acceptable error range and a temperature control error index of 0.0384. Figure 12b demonstrates that at a supply water temperature of 60 °C, there was no apparent indoor temperature overshooting, and the temperature control effect is good. In the first 10 h, the temperature was relatively close to the set 22 °C, and in the following period, it was also relatively close to the set 17 °C. The temperature control error index was the smallest, with a value of 0.0353. Finally, Fig. 12c reveals that at a supply water temperature of 65 °C, the actual indoor temperature remained close to the set temperature, and there is no obvious indoor temperature overshoot phenomenon, with a temperature control error index of 0.0368. The results indicate that the heating system's output temperature optimization control model based on the DMC algorithm exhibited good temperature control performance at different supply water temperatures, demonstrating feasibility and effectiveness.

Fig. 12
figure 12

The temperature control effect of the model under different water supply temperatures

To validate the superiority of the proposed temperature optimization control model, indoor temperature was set at 18 °C, and the supply water temperature was set at 60 °C for controlling the indoor temperature. The indoor temperature was set at 22 °C for the first 10 h and then maintained at 17 °C for the remaining time. And compared with traditional PID control, fuzzy PID control, PID control based on genetic algorithm (GA), and predictive feedback predictive control, these four temperature control methods have been widely used in temperature control and achieved good application results. Therefore, this study will use these four temperature control methods as comparative methods to further verify the feasibility and superiority of the research model. The control effects of these five methods on the indoor temperature are depicted in Fig. 13. From the graph, it can be seen that among the five temperature control methods, the DMC algorithm has the best performance, followed by predictive feedback predictive control and GA-PID control, with no significant indoor temperature overshoot observed, indicating a better temperature control effect. In contrast, the effect of PID control performed the poorest, exhibiting significant temperature overshoot between 10–13 h. The results indicate that the temperature optimization control model for the heating system output, based on the DMC algorithm, yields superior temperature control.

Fig. 13
figure 13

Five methods for controlling indoor temperature

In conclusion, the temperature optimization control model for the heating system output, based on the DMC algorithm, exhibits robust and effective temperature control across various heating periods and supply water temperatures. Furthermore, compared to PID control, the DMC algorithm showcases superior temperature control effectiveness. The experimental results show that the intelligent heating system and temperature optimization control model proposed in the study have good performance. In future research, it should be considered to upgrade to servers with faster CPUs or increased storage capacity to further improve the scalability of the system, enrich the operation functions of the user interface, and integrate with smart home technology to provide users with more comprehensive smart home services.


With rapid technological advancements, IoT technology has gradually permeated various aspects of daily life. Addressing the limited flexibility in temperature regulation of traditional heating systems, a smart heating system based on IoT and STM32 microcontrollers was designed and implemented. Additionally, a temperature optimization control model based on the DMC algorithm was established. In the process of designing intelligent heating systems, research ignores the heat that rooms receive from sunlight and daily life, as well as the heat transfer between different residences. It is assumed that the heated room is a closed unit, and each heating user only uses one room for heating. However, the proposed intelligent heating system based on STM32 microcontroller and ZigBee technology requires certain hardware and software technical support, and has certain requirements for user related skills. Additionally, there may be signal interference issues during wireless data transmission. The application of Internet of Things technology in home systems is conducive to promoting its intelligent development, improving the quality of life and user experience. However, the integration of IoT technology and heating systems also puts users at risk of privacy leakage, and the demand for data and privacy protection is also increasing. In addition, due to the DMC algorithm's need to model the system, calculations and parameter adjustments are more complex. In practical situations, indoor temperature is usually affected by various environmental and human factors, which further increases the complexity of the system.


The results demonstrate that the web interface of the smart heating system effectively generates temperature curves, displaying clear temperature and humidity data, showcasing feasibility and effectiveness. The temperature optimization control model, based on the DMC algorithm, consistently achieves good temperature control across different heating periods, exhibiting robustness. In the initial heating phase, when the relative opening of the regulating valve was close to 0, a substantial jump in actual indoor temperature occurred, with a leap of 2 °C and a temperature control error index of 0.0543. In the mid-heating phase, outdoor temperature became the primary factor influencing actual indoor temperature, with the regulating valve playing its adjusting role, resulting in a temperature control error index of 0.0353. The model maintains good temperature control effectiveness across various supply water temperatures. Compared to PID control, the DMC algorithm demonstrates superior temperature control effectiveness. In summary, the constructed model shows a certain level of validity, providing users with more convenient temperature control services, improving their experience, reducing energy waste, and promoting the intelligent and energy-saving development of heating systems. However, the operational functionality of the designed system is still somewhat limited, and further research is needed on how to enable users to operate the heating system more conveniently. Additionally, there may be signal interference issues during wireless data transmission. Therefore, in the following research, more convenient operation functions should be provided to users, and the stability of wireless data transmission should be further enhanced, thereby improving the practical application effect of the system.

Availability of data and materials

The data will be made available on reasonable request.



Internet of Things




Proportion integration differentiation


Dynamic matrix control


Cyclic redundancy check


Direct memory access


Serial peripheral interface


Model predictive control


Genetic algorithm


  • Aldossari MQ, Sidorova A (2020) Consumer acceptance of Internet of Things (IoT): Smart home context. J Comp Inf Syst 60(6):507–517

    Google Scholar 

  • Cao Y, Xu Y, Li Q, Rose RS (2022) Corrosion inhibition and disinfection of central heating and cooling water systems using in situ generated hydrogen peroxide. New J Chem 46(37):17880–17888

    Article  Google Scholar 

  • Cvitić I, Peraković D, Periša M, Gupta B (2021) Ensemble machine learning approach for classification of IoT devices in smart home. Int J Mach Learn Cybern 12(11):3179–3202

    Article  Google Scholar 

  • Hansen EB, Bøgh S (2021) Artificial intelligence and internet of things in small and medium-sized enterprises: A survey. J Manuf Syst 58(8):362–372

    Article  Google Scholar 

  • He Z, Farooq AS, Guo W, Zhang P (2022) Optimization of the solar space heating system with thermal energy storage using data-driven approach. Renewable Energy 190(3):764–776

    Article  Google Scholar 

  • Li Y, Zuo Y, Song H, Lv Z (2021) Deep learning in security of internet of things. IEEE Internet Things J 9(22):22133–22146

    Article  Google Scholar 

  • Liu L, Zhang H, Liu Y (2021) A smart and transparent district heating mode based on industrial Internet of things. Int J Energy Res 45(1):824–840

    Article  Google Scholar 

  • Lv Z (2021) Security of internet of things edge devices. Softw Pract Exp 51(12):2446–2456

    Article  Google Scholar 

  • Mao B, Kawamoto Y, Kato N (2020) AI-based joint optimization of QoS and security for 6G energy harvesting Internet of Things. IEEE Internet Things J 7(8):7032–7042

    Article  Google Scholar 

  • Nguyen DC, Ding M, Pathirana PN, Seneviratne A, Li J, Niyato D, Dobre O, Vincent PH (2021) 6G Internet of Things: A comprehensive survey. IEEE Internet Things J 9(1):359–383

    Article  Google Scholar 

  • Paul S, Padhy NP (2020) Real-time energy management for smart homes. IEEE Syst J 15(3):4177–4188

    Article  Google Scholar 

  • Sabory NR, Zaheb H, Waseel AK (2021) Central heating by seasonal sensible heat storage of solar thermal energy. Int J Innov Res Sci Stud 4(2):100–110

    Google Scholar 

  • Serror M, Hack S, Henze M, Schuba M, Wehrle K (2020) Challenges and opportunities in securing the industrial internet of things. IEEE Trans Industr Inf 17(5):2985–2996

    Article  Google Scholar 

  • Soliyevich ZM, Olimjon ogli KZ (2021) The formation processes of smart cities. Central Asian J Arts Design 2(12):38–43

    Google Scholar 

  • Sun C, Liu Y, Cao S, Gao X, Xia G, Qi C, Wu X (2022) Integrated control strategy of district heating system based on load forecasting and indoor temperature measurement. Energy Rep 8(6):8124–8139

    Article  Google Scholar 

  • Tran-Dang H, Krommenacker N, Charpentier P, Seong KD (2020) Toward the internet of things for physical internet: Perspectives and challenges. IEEE Internet Things J 7(6):4711–4736

    Article  Google Scholar 

  • Usman AM, Abdullah MK (2023) An assessment of building energy consumption characteristics using analytical energy and carbon footprint assessment model. Green Low-Carbon Econ 1(1):28–40

    Article  Google Scholar 

  • Wang W, Hu B, Wang RZ et al (2022) Model predictive control for the performance improvement of air source heat pump heating system via variable water temperature difference. Int J Refrig 138(3):169–179

    Article  Google Scholar 

  • Xing L (2020) Reliability in Internet of Things: Current status and future perspectives. IEEE Internet Things J 7(8):6704–6721

    Article  Google Scholar 

  • Zhang K, Zhang H, Mu Y, Liu C (2020) Decentralized tracking optimization control for partially unknown fuzzy interconnected systems via reinforcement learning method. IEEE Trans Fuzzy Syst 29(4):917–926

    Article  Google Scholar 

Download references


Not applicable.


Not applicable.

Author information

Authors and Affiliations



From the first draft to the final draft is completed by Yan Su.

Corresponding author

Correspondence to Yan Su.

Ethics declarations

Ethics approval and consent to participate

Not Applicable.

Consent for publication

Not Applicable.

Competing interests

The author declares that no conflict interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Su, Y. An intelligent heating system based on the Internet of Things and STM32 microcontroller. Energy Inform 7, 22 (2024).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: