# Improved Smart Pillow for Remote Health Care System
## 2 Materials and Methods
### Proactive Monitoring Practice  
In general, the pillow reports the raw data in BT host storage mode, this real-time mode asks the pillow's MCU to report real-time data for emergency concerns. The healthcare management platform is designed for nursing homes or caregivers who are concerned about the user's health. With the received data and analyzed system result, they can also control and request data in real time if required. For instance, if the observer finds that the body temperature of the observed user is unavailable or comparably low, but the status of occupancy is positive, it is possible that something uncertain has happened, such that the observer may want to double check the real-time condition to see if an immediate visit is urgent--such that real-time mode is available for use. As it is shown in Figure 8, the only way to access data from the pillow is the agent, which connects to pillow by BT and reports data to cloud by Wi-Fi, but since it usually  
Figure 9: Interaction between the monitor and daemon. connected via a home router, it cannot be directly accessed externally via the Internet. There are several proven methods to enable direct access, such as port forwarding [23], KeepAlive [24] in TCP/IP, ngrok [25], and so forth. The strength and weakness of these technologies are listed in Table 1.  
Many IoT platforms provide communication services for such devices, so generally they employ standard lightweight protocols such as MQTT (Message Queuing Telemetry Transport) [26] to define devices as the publisher or subscriber to exchange messages, achieving the goals of monitoring and control. The unified interface is convenient, but it could potentially complicate the processes. The system employs a polling method different to those mentioned before, as it builds from the MQTT protocol and adapts it to fit the system's need. The workflow on \"Order\" and \"Data\" can be seen in Figure 9, where the administrator logins into a monitoring page hosted on a cloud server (fixed or mobile infrastructure) and gives an order to retrieve real-time data from a specified device. The order will set the flag \"Order\" to \"True\" in the database attached to the cloud server, this monitor works as a publisher. The agent in Figure 9 connects to the daemon process running in the cloud server on a regular basis. In every connection, the daemon saves new data in existence and checks the same database if any order for the device exists and notifies the device accordingly, with the workflow of the daemon shown in Figure 10.  
The daemon is like the subscriber for \"Order\". The frequency that the agent connects to the daemon is based on the near-real-time expectations, too frequent connections will become a burden on the cloud server. Our alternative polling approach avoids the weaknesses of the abovementioned technologies, as it does not compromise the local home network, not dependent on a third-party service and does not occupy resources for a long time, but its weakness is notably that of potential delay. This real-time mode should just be used in an emergency, as the communication between pillow and agent is on hold, and as the BT host keeps detecting data from sensors, \begin{table}
\begin{tabular}{c c c} \hline \hline
**Name** & **Strength** & **Weakness** \\ \hline Port Forwarding & Common in routers & Security concerns, Use of public IP \\ \hline KeepAlive & Persistent connection & Occupation of system resources \\ \hline ngrok & Security tunnel, Inherent safer & Reliance on third party technology \\ \hline Polling & Avoids most weaknesses & Persistent delay, Risk of potential race conditions \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Proven technologies that can meet direct connectivity. Figure 10: The data flow of the daemon responding to agent call. such behavior will cause rapid battery drain. If such a feature is necessary in exceptional circumstances, changing the pillow's power supply from a lithium cell battery to DC power is an option.