Design of Home Environment Monitoring System Based on a Cloud Platform for the Elderly Living Alone

The phenomenon of elderly people living alone was becoming increasingly common in the new era, so the demand for monitoring the living environment of elderly people living alone was becoming increasingly strong. The design of home environment monitoring for elderly people living alone was designed based on a cloud platform. The system mainly consists of an STM32 main control module, a temperature and humidity detection module, an Internet of Things module, a security module, a relay control module, and a user App terminal. Then the fuzzy PID algorithm was designed to remotely control indoor temperature and humidity. After practical operation verification, the system can perform local and remote monitoring of the living environment of elderly people living alone and has the characteristics of reliability and stability.


Introduction
The trend of global aging is becoming increasingly evident.According to survey data, the elderly population aged 65 and above accounted for 15.7% of China's total population in 2030, and the "empty nest" rate of elderly people in China was as high as 26.4%.Due to physical reasons, elderly people living alone have higher requirements for the stability, humidity, and safety of their home environment [1] .However, there are issues such as a lack of responsiveness and poor coordination ability, making it difficult to monitor the home environment in a timely manner.Therefore, it is of great significance to develop an intelligent remote home monitoring system using information technology [2][3] .

System Overview
The system for elderly people living alone based on cloud platform-based home environment monitoring adopts the three-end architecture model that integrates cloud, user, and device ends.The main principle is shown in Figure 1.The device side can achieve the collection and control functions of local home device data while sending data and control information to the user and cloud through the Internet of Things module.The user end achieves remote display and control of device functions through the App [4]   .The cloud platform can communicate with the device end and user App mobile end, receive and send instruction messages, and achieve control over the device end [5][6] .Figure 1.System structure and schematic.
The system hardware consists of an STM32 minimum system module, DHT11 temperature, and humidity detection module, ESP8266 Wi-Fi Internet of Things module, security module, relay control module, user App terminal, and other modules.The hardware circuit diagram is shown in Figure 2. In order to improve the accuracy of control, the fuzzy PID algorithm [7] is used to design the controller.

Design of the software part of the system
The overall program design process of the system is shown in Figure 3.The system needs to undergo initialization processing during its first use, mainly including independent initialization of each module and linking to the cloud platform.After successful initialization, the system officially enters the function execution phase.Sensors collect parameters such as home environment temperature and humidity, as well as temperature and humidity at the smart home expansion end.After internal verification and data filtering, they are sent to the MCU main controller.At this point, the main controller loops to determine whether it has received the user or cloud control instructions for the node device.If it receives the instructions, it will be sent to the node for corresponding control.At the same time, the main controller displays the received sensor data and node device status on the OLED screen and uploads these data to the cloud platform through the MQTT protocol.You can view environmental data or send corresponding instructions in real time through the Alibaba Cloud Internet of Things platform website or user App [8- 10] .

Fuzzy PID algorithm
In response to the problem of various nonlinear, time-varying, and other uncertain factors in the smart home control system, as well as environmental parameter changes caused by various external disturbances, resulting in a decrease in system performance, this system combines fuzzy controllers with traditional PID control and proposes a control strategy for designing controllers using fuzzy PID algorithm.By borrowing the membership function and fuzzifying the input and output variables, the PID controller parameters can be adjusted online.PID is short for Proportional, Integral, and Derivative regulation.It is mainly composed of a PID controller and a controlled object [11] .
It is expressed in transfer function form (1): where r(t) is the given amount, y(t) is the actual output, e(t) is the deviation, U(t) is the output of the controller, Kp is the proportional amplification factor, Ki is the integration time factor, and Kd is the differential time factor [12] .
To address the problem of system performance degradation due to various non-linear, time-varying, and other uncertainties in the smart home control system as well as changes in environmental parameters caused by various external disturbances, the system incorporates a fuzzy PID algorithm, which complements the traditional PID control by using a simple form of affiliation function to fuzzify the input and output variables.The PID controller parameters are adjusted online [13] .The fuzzy PID control structure is shown in Figure 5.The temperature and humidity value is given from Input, Output is the temperature and humidity value output from the system, E is the error value, Ec is the error rate of change, and Kp, Ki, and Kd are the parameters of PID [14] .
The controller process based on the fuzzy PID controller is shown in the following Figure 6.
membershipErrorRate [2] = errorRate; } When the collected temperature is too high, the controller turns on the ventilation system to work; when the collected temperature is too low, the controller turns off the ventilation system and turns on the thermostat to work, so that the temperature can be stabilized within a certain range.According to the deviation between the given value and the actual value, a fuzzy PID algorithm is added to make it meet the control requirements [15] .

Experimentation and analysis
The experiment mainly focuses on the following purposes for inspection and analysis: (1) Synchronization and consistency of information between device, user, and cloud; (2) The collected home environment data is accurate; (3) The user can achieve remote home environment data control; (4) The cloud can achieve remote home environment data control; (5) Remote monitoring efficiency meets experimental requirements.
The experimental results of the system conducted in a closed room show that the synchronization of information between the device end, user end, and cloud end is consistent.The time for remote control of the elderly living alone in the home environment data on the user end is 0.6 seconds, and the time for remote control of the elderly living alone in the home environment data on the cloud end is 0.8 seconds.By recording environmental data over a period of time and comparing it with official data, the design objectives are achieved; The average error of temperature and humidity detection is 2.19%, achieving design objectives within the accuracy error range.The following figure 7 shows the display of a certain data collection.

Conclusion
In the context of the rapid development of Internet of Things technology and the pursuit of high quality of life and "Internet+" demand for intelligent interaction, this paper designs a smart home security control system based on a cloud platform.Through testing, it is proved that the system operates normally, the collected data error is within the normal experimental error range, and the fuzzy PID algorithm used achieves substantial results, which can be deployed to the real-life smart home ecosystem and expand the security control range, which has some value in real-life applications.

Figure 2 .
Figure 2. Part of the circuit diagram of the system hardware.

Figure 3 .
Figure 3. Flow chart of the program design.The header file of each module is referenced in the main.c.The initialization of various hardware devices is then carried out, including serial port initialization, timer initialization, relay initialization, DHT11 program initialization, and Wi-Fi module initialization, as shown in Figure 4.

Figure 4 .
Figure 4. Header files for each module.

Figure 7 .
Figure 7. Sensor detection and collection of the partial humidity data curve.