# Design of Student Bedding Management System Based on Intelligent Monitoring Bed

Authors: Shaohua Fu; Youwei Xiong; Linfeng Yi
Journal: Mobile Information Systems
 (2022)

---

## Abstract

In order to solve the problems related to the management of students’ bedtime in vocational colleges and improve the efficiency of students’ bedtime management, an intelligent bed for students’ bedtime management is designed, which is composed of bed and sensor unit, signal processing unit, and ZigBee transmission unit. The algorithm of the collected pressure sensor data is improved, and an improved amplitude limiting lag average filtering algorithm is proposed. The management system uses the methods of composite collection of information, intelligent processing, big data analysis, etc. to upload the data to the cloud server, through the mobile phone app and other terminals to timely grasp the sleeping situation of students at night. The experiment shows that the system improves the efficiency of students’ bedtime management by 10%.


---

## Body

## 1. Introduction

With the growing number of the students in vocational colleges, the problem of whether the students go to bed normally becomes increasingly obvious. At present, the traditional management method is to inspect the student’s sleeping situation before turning off the lights at night; school dormitory administrators and student cadres inspect the sleeping situation of students at the scene and check and register each dormitory in turn. If a student is not in the dormitory, it is necessary to notify the class teacher or school counselor by telephone or text message. However, there are defects in this management method and security risks that cannot be effectively controlled, such as some students stringing into other dormitories after checking. In addition, some students spend night out and are signed in by others.


## 2. Research Status

In order to improve inspection efficiency of dormitory administrators and students’ security control ability, Chen Hanhao, Zheng Shengzhong, Huang Chenghui, etc. came up with a mobile terminal face recognition access control management system for student apartments [1], which realized an easy-to-operate student apartment face recognition access control management system based on APP mobile terminal. Dormitory administrators can effectively identify students’ identities by operating the system on mobile phones and other mobile devices. At the same time, the system also realized the function of entrance guard management for students staying out late, but whether students are sleeping in their own dorms cannot be confirmed. On this basis, Jiangsu Maritime Vocational and Technical College proposed an intelligent monitoring data acquisition system for students [2], which included a data acquisition unit containing multiple data acquisition cards connected with a PC, and pressure sensors, temperature alarm sensors, and counters are connected on the data bus. The disadvantage of this method is the installation position of the pressure sensor which cannot completely monitor whether the students are sleeping on the bed and also cannot accurately identify and monitor the actual sleepers in the dormitory. To monitor the accuracy, Dongguan Cool Software Technology Co., Ltd., put forward a kind of intelligent bed and management methods [3] by testing whether the pressure value applied to the smart bed is greater than the preset pressure threshold, in the meanwhile, judging whether the variation trend of parameter value of intelligent bed under pressure is the specified variation trend and sending control instructions to bound associated devices. This scheme assumes that students are already in bed, which does not meet the requirements of dormitory management.There are other units and individuals who have also carried out relevant studies on smart beds, such as the electric smart bed and health monitoring system for home care based on Internet [4] and an intelligent bed containing mattress, control module, sensor module, and display device [5]. Preventing users from sleeping in and measuring users’ weight [6], an intelligent bed containing bed body, alarm clock, vibration device, and pressure sensor [7], as well as a movable intelligent bed are used [8]. However, they are not suitable for student management requirements.Chongqing Institute of Mechanical and Electronic Technology proposed intelligent dormitory monitoring bed [9], which avoids the problem of inaccurate measurement caused by setting pressure sensor on the bed surface, ensures the accuracy of the pressure measurement, monitors the quality of the weight of the upper and lower bed, respectively, and guarantees the accurate bedtime status monitoring for students; it is conducive to students’ personal safety management and so on, but it lacks the software management system.In view of this, this paper proposed a management of dormitory bed intelligent monitoring system based on Internet of things technology; the system consists of bed unit, fingerprint recognition unit, transmission unit, the server unit, and terminal unit [8]. Among them, the bed sensing unit and the student intelligent monitoring bed realized the intelligent management of students’ sleeping situation in vocational colleges through the real-time detection of the system.


## 3. Intelligent Management System for Students’ Bedtime

The intelligent management system for students’ bedtime consists of five parts: bed unit, fingerprint identification unit, signal processor, pressure sensor, pyroelectric sensor, etc., which are set in each bed to collect various parameters required; each bed sensor is output to the signal processing unit for related calculation; the signal processor is stm32L053 chip and related circuit based on ARM technology, which can judge whether there is a student bed in real time. Fingerprint identification unit mainly collects and identifies students’ fingerprints. The transmission unit is ZigBee and gateway, and the signal processing unit connects the gateway system through ZigBee. Each gateway system enters the switch and then enters the central station server unit. The server unit is the school central server and the cloud server. The data of the central server is processed and then uploaded to the cloud server for the smartphone APP, computer client, or LED display through WiFi or 5G communication. The terminal unit is terminal display, LED large screen, and mobile smart phone.The intelligent management system of students’ bedtime first registers attendance through fingerprint identification unit, indicating that the student has records of entering the dormitory on time; when the light is off, it detects whether the student is in bed by installing pressure sensor and pyroelectric sensor on the student’s bed every 30 minutes; the detected signal is transmitted to the signal processing board and then uploaded on the cloud or school server; relevant administrators, such as school head teacher, student section chief, principal, and student parents, allocate corresponding permissions and timely master the students’ sleeping conditions at night through corresponding terminals, such as mobile APP. If the student is not in their place at bedtime, they can be dealt with in time, as shown in Figure1.Figure 1
Overall diagram of system principle.


## 4. Intelligent Monitoring Bed

The hardware of intelligent monitoring bed mainly includes signal processor unit, bed sensor unit, display alarm unit, storage power conversion circuit, etc. It integrates sensor measuring circuit, data processing, and data communication interface. The bed sensor unit of the intelligent monitoring bed is fixed in the sensor detection and data processor device. The sensor detection and data processor device is a hardware design based on STM32L053 chip of ARM Cortex M0 core, and a series of peripheral circuit interfaces are designed. The upper computer part adopts the upper computer software development of C#.NET technology. The hardware of the intelligent monitoring bed mainly includes a high-performance controller based on STM32L053 of ARM technology. The digital controller has the advantages of strong computing ability, low power consumption, strong anti-interference ability, etc. The digital processor unit, power module unit, communication unit, alarm unit, display unit, and other structures. The hardware design circuit of the intelligent monitoring bed is shown in Figure2.Figure 2
Schematic diagram of hardware circuit of intelligent monitoring bed.


### 4.1. Hardware Design

#### 4.1.1. Sensor Monitoring Principle

The monitoring principle of the intelligent monitoring bed sensor is the primary factor to be considered in the hardware design. Sensors include pressure sensor group, pyroelectric sensor, etc.(1)
Pressure sensor group: the pressure sensor includes 8 sensors, namely, 4 upper pressure sensors and 4 lower pressure sensors. Among them, the upper pressure sensor is mainly used to detect the pressure of the bed to the lower bed, and the lower pressure sensor is mainly used to detect the pressure of the lower bed to the ground. The upper pressure sensor and the lower pressure sensor are both semiconductor piezoresistor type. The gravity of the sleeping body and the sleeping students is the sum of the pressure measured by the four upper pressure sensors, while the gravity of the sleeping body and the corresponding sleeping students is equal to the sum of the pressure measured by the four lower pressure sensors minus the sum of the pressure measured by the four upper pressure sensors.(2)
Pyroelectric sensor: pyroelectric sensor generates an alternating blind area and high sensitivity area. When the human body is in the detection range of the sensor, the infrared ray sent by the human body causes the sensor to receive the pulse high level signal, so as to judge someone. When the human body leaves the detection range, the sensor inputs the low level signal. During the installation of the module, the Fresnel lens on the surface of the module shall be kept away from the interference source such as light, so as to avoid the introduction of interference signals to cause misoperation; at the same time, the direction of the probe dual element shall be parallel to the direction with the most contact area of the human body as far as possible to ensure that the human body is sensed by the probe dual element when it is in existence.


#### 4.1.2. Power Conversion Circuit

The intelligent monitoring bed is connected with a stable DC power supply, which adopts the design of the adaptive power supply with the former stage of 220 V voltage and outputs 12 V/1 A power supply after proper processing to supply power to the data acquisition and processing circuit of the bed in the dormitory, so as to ensure that the power supply can be connected to at least 8 beds or 6 beds for power supply, so as to improve the stability and reliability of the power supply. After the power supply enters into the intelligent monitoring bed, a 5 V/1 A regulated power supply is output through the switch regulated integrated chip MP1593 to supply power to the pressure sensor and pyroelectric sensor. The advantages of the chip MP1593 are simple peripheral circuit, small size, safety, and reliability, and it can output a range of 4.75–28 V. Chip MP1593 is connected to voltage stabilizing integrated chip LM117-3.3, which outputs 3.3 V/1 A voltage stabilizing power supply to supply STM32L053 and ZigBee CC2630. The peripheral circuit of chip LM117-3.3 is simple, safe, and reliable. Because the hardware of the intelligent monitoring bed needs to communicate with the external equipment, the power supply and the ground should be isolated [10].


#### 4.1.3. Parameter Acquisition Circuit

The intelligent monitoring bed system collects the information of pressure sensor and pyroelectric sensor in real time.(1)
Pressure sensor data acquisition: adopt Taiwan Mavin NA8-200 kg pressure sensor. The sensor has a rated output voltage of 2.0 mV/V ± 5%, a hysteresis of 0.02% F.S, and a creep (20 minutes) of 0.02% F.S. When the sensor is installed, the pressure of the upper and lower beds is transmitted to the pressure sensor head through the four supports of the bed, and the voltage signal is output by the pressure sensor. Because the output signal does not match the processor, in order to improve the accuracy, it is no longer necessary to carry out operational amplification, and it directly enters the external high-precision A/D conversion chip HX710, which is then input into STM32L053 for processing. The A/D conversion chip HX710 is integrated with the package. The peripheral circuits needed by other chips of the same type, such as stabilized voltage power supply and on-chip clock oscillator, have the advantages of high integration, fast response speed, strong anti-interference, etc., reduce the cost, and improve the reliability of the intelligent bed.(2)
Pyroelectric sensor acquisition: HC-SR501 human body infrared induction module is used. The characteristic of the module is that its output voltage is 3.3 V, static current is 65μA, its maximum induction angle is 100°, and HC-SR501 human body infrared induction module collects signals and inputs them to the pyroelectric sensor processor BISS001 for processing. LDO chip HT7133-1 outputs 3.3 V to supply power to pyroelectric sensor module unit.


#### 4.1.4. Data Processing Circuit

In this design, STM32L053 processor with low power consumption is used, which integrates SPI, I2C, serial port, and other signal communication. When collecting the pressure signal, the 5th and 6th pins of the 24-bit A/D conversion chip HX710 are clock signal and data output signal, respectively, the 6th pin DOUT is connected to the IO port of the processor, and the processor processes the data; when collecting the infrared temperature signal, the pyroelectric sensor processor BISS001 collects the signal and directly inputs it to the IO port of the processor for data processing.


#### 4.1.5. Communication Networking Circuit

(1)
ZigBee communication: intelligent monitoring bed and gateway need data communication. In order to overcome the defects of complex wired transmission line wiring that is easy to be damaged, each bed communicates with dormitory gateway through wireless signal. The commonly used wireless signals are 433 MHz, WiFi, and ZigBee. ZigBee communication is adopted in the design of the system. The ZigBee module model is E72-2G4M23S1A. The module is a small-size chip ZigBee and 6LoWPAN wireless module with the maximum transmission power of 100 mW, which is independently developed with CC2630 produced by TI as the core. The 24 MHz industrial grade high-precision low-temperature drift active crystal oscillator has a measured transmission distance of 500–1500 meters. It overcomes the shortcomings of low data transmission rate, poor reliability, high power consumption, and low reliability of 433 MHz wireless signal. ZigBee communication network is easy. Each dormitory generally has 4 to 8 intelligent monitoring beds. The upper and lower beds of each bed share the same ZigBee communication module and processor STM32L053 chip. Meanwhile, the information of the two beds is uploaded to the gateway arranged in the dormitory.(2)
Other communication: the gateway enters the switch through wired mode and then enters the central station server unit. The server unit is the school central server and the cloud server. The data of the central server is processed and then uploaded to the cloud server, which is not detailed.


### 4.2. Software Design

#### 4.2.1. Overall Software Design

STM32L053 processor is written in C language and Keil uVisn5 editor; the sensor uses the data of A/D sampling real-time monitoring and carries out corresponding processing according to the sampling data. If the parameter exceeds the normal range, the intelligent bed will give an alarm and display the alarm information on the LCD and upload the alarm information to the gateway and then to the Internet of things management platform for management personnel to analyze. If it is in the normal range, the system will not give an alarm, LCD displays the normal information on the display and uploads the normal information to the gateway and then to the Internet of things management platform for analysis.In the software design, it is mainly the software design of the bed collection system. First, the sensor is hardware initialized; then the data is collected, processed in the processor, and then communicated through CC2630 to transmit the data to the gateway. The main flowchart is shown in Figure3. For the overall system, the bed monitoring flowchart is shown in Figure 3(a) and the gateway flowchart is shown in Figure 3(b).Figure 3
Main flowchart: (a) bed monitoring flowchart and (b) gateway flowchart.
(a)(b)


#### 4.2.2. Software Design of Detection Unit

The detection unit is mainly designed to process the data collected by the sensor. At different times, it packs the collected data and then detects whether ZigBee communication is busy. If it is not busy, it sends the data through ZigBee; if it is busy, it returns to the data packaging place and waits. The flowchart of the core unit is shown in Figure4.Figure 4
Flowchart of core unit.


#### 4.2.3. Data Filtering Algorithm

When the human body lies on the bed or sleeps, it will cause pressure fluctuation in the process of turning over, which may be periodic interference signal or nonperiodic irregular random signal. These two kinds of signals have different characteristics, but they are interference signals. Because of different characteristics, the filtering methods used are different. In the existing algorithm, the limited amplitude filtering method can effectively overcome the pulse interference caused by accidental factors but cannot suppress the periodic interference, and the smoothness of the filter is poor. The first-order lag filtering method has the advantages of phase lag and low sensitivity, but it has a good restraining effect on periodic interference and high frequency fluctuation. When students lie in bed, the intelligent system needs not only occasional pulse interference, but also periodic interference.Through the above analysis, this design combines the limit filtering method, the first-order lag filtering method, and the median average filtering method and proposes an improved limit lag average filtering method. The algorithm flowchart is shown in Figure5, after STM32L053 reads the N sampling value output by the A/D conversion chip HX710. Each time the sample reaches a new value, you need to judge: if the result of subtracting the historical sampling average value Xc from the current sampling value Xn is less than the maximum sampling deviation value A set by the system, the current sampling value is valid; if the result of subtracting the historical sampling average value from the current sampling value is greater than the maximum sampling deviation value, the current sampling value is invalid; discard the current sampling value, and select the historical sampling average value as the current sampling value. In [11–14], therefore, the sampling output value of the first limiting filter is Y,(1)Yn=XnXcXn−Xc≤AXn−XC>AFigure 5
Effect diagram of pressure collection test. (a) Pressure test diagram of upper bed. (b) Pressure test diagram of lower bed.
(a)(b)In the above equation,Yn is the current sampling value; Xc is the historical sampling average value; A is the maximum sampling deviation value set by the system; Xn is the current sampling value.The sampling output value of the limited amplitude filtering algorithm is sent to the queue for the improved first-order lag low-pass filtering. Thenth obtained value is multiplied by the filtering coefficient a/2, and the n − 1 obtained value is multiplied by the filtering coefficient 1−a/2. The final value Y1n after the result processing is(2)Y1n=a2Yn+1−a2Xn−1The above equation,Y1n is the value obtained for the nth time, Yn is the value measured for the nth time, Xn − 1 is the value obtained for the n − 1 time, and α is the filtering coefficient. The low-pass filtering algorithm α adopted in this design is 0.1.After the improved first-order lag low-pass filtering, the data are filtered by median value average; that is,N1 measured values are collected continuously, the N1 values are regarded as a one-dimensional array, a minimum value and a maximum value are removed from the array, and then the arithmetic average value of the remaining (N − 2) data is calculated as the latest filtering output and updated to the historical sampling average value at the same time. The sample value after median average filtering is the final output value Y2n(3)Y2n=1N1−2∑I=0NI−1Yn−i−Yn−imax−Yn−iminIn the above equation,Yn−i is the output value of the (n − i) th sampling after the first-order low-pass filtering, Yn−imin and Yn−imin are the maximum and minimum values of the sampling values in the array, respectively, and Y2n is the final output value of the sample value after median average filtering [15–18].The flowchart of the improved amplitude-limited delay average filtering algorithm is shown in Figure6. The improved algorithm combines the advantages of limiting filtering, first-order lagging filtering, and median average filtering. It can not only eliminate the pulse interference caused by human body turning over in bed or getting up and other related actions, but also suppress the data error caused by periodic interference and improve the accuracy of sampling pressure value test.Figure 6
Flowchart of improved amplitude limiting lag average filtering algorithm.


#### 4.2.4. Data Complexity Analysis

We analyze the computation complexity of method proposed above. Given N samples, the time complexity to compute the data filtering algorithm is O(N2).Among them, the output value of the first limiting filter sampling isYn, and the output Yn is improved with first-order lag low-pass filtering. The nth obtained value is multiplied by the filtering coefficient a/2, and the n − 1 obtained value is multiplied by the filtering coefficient 1−a/2. The result of processing is Y1n. And the sample value after Y1n median average filtering is the final output value Y2n. Finally, the latest filtering output was fed back and compared with the sample value Xn and updated to the historical sampling average value at the same time.Figure 7
Structure of intelligent monitoring bed in dormitory.


### 4.3. Structural Design

(1)
Arrangement of pressure sensor: the four upper pressure sensors of the intelligent monitoring bed are, respectively, set at the bottom of four legs of the bed body, and the four lower pressure sensors are, respectively, set at the bottom of four legs of the bed body. At the same time, upper bed body and lower bed body both include the transverse bearing body and the vertical support column set at the four corners of the transverse bearing body; the upper end face of the vertical support column of the bed body is concave downward in the middle. The middle of the lower end face of the vertical support column of the bed body protrudes downward to form a plug-in pin which is inserted into the plug-in slot and pressed against the bottom of the plug-in slot. The upper pressure sensor is set at the bottom of the plug slot and pressed down by the plug pin. The intelligent monitoring bed structure of the dormitory is shown in Figure7. The bed body 1 and the lower bed body 2 both include a transverse bearing body and a vertical support column arranged at four corners of the transverse bearing body 5; the middle of the upper end surface of the vertical support column 6 of the lower bed body 2 is sunken downward to form a socket 8; the middle of the lower end surface of the vertical support column 7 of the bed body 1 is protruded downward to form a socket 9 inserted into the socket and pressed against the bottom of the socket; the upper pressure sensor 3 is arranged at the bottom of the socket and it is pressed down by the plug pin to ensure that the bed body 1 is fixed and stable to avoid falling off of the bed body 1.(2)
Pyroelectric sensor arrangement: the intelligent monitoring bed is equipped with two pyroelectric sensors, which are, respectively, installed on the head of the bed of the intelligent monitoring bed and the next two beds, directly facing the sleeping students. The signals of two pyroelectric sensors are processed by the same processor STM32L053 chip, which can identify whether the corresponding bed is occupied [19, 20].


## 4.1. Hardware Design

### 4.1.1. Sensor Monitoring Principle

The monitoring principle of the intelligent monitoring bed sensor is the primary factor to be considered in the hardware design. Sensors include pressure sensor group, pyroelectric sensor, etc.(1)
Pressure sensor group: the pressure sensor includes 8 sensors, namely, 4 upper pressure sensors and 4 lower pressure sensors. Among them, the upper pressure sensor is mainly used to detect the pressure of the bed to the lower bed, and the lower pressure sensor is mainly used to detect the pressure of the lower bed to the ground. The upper pressure sensor and the lower pressure sensor are both semiconductor piezoresistor type. The gravity of the sleeping body and the sleeping students is the sum of the pressure measured by the four upper pressure sensors, while the gravity of the sleeping body and the corresponding sleeping students is equal to the sum of the pressure measured by the four lower pressure sensors minus the sum of the pressure measured by the four upper pressure sensors.(2)
Pyroelectric sensor: pyroelectric sensor generates an alternating blind area and high sensitivity area. When the human body is in the detection range of the sensor, the infrared ray sent by the human body causes the sensor to receive the pulse high level signal, so as to judge someone. When the human body leaves the detection range, the sensor inputs the low level signal. During the installation of the module, the Fresnel lens on the surface of the module shall be kept away from the interference source such as light, so as to avoid the introduction of interference signals to cause misoperation; at the same time, the direction of the probe dual element shall be parallel to the direction with the most contact area of the human body as far as possible to ensure that the human body is sensed by the probe dual element when it is in existence.


### 4.1.2. Power Conversion Circuit

The intelligent monitoring bed is connected with a stable DC power supply, which adopts the design of the adaptive power supply with the former stage of 220 V voltage and outputs 12 V/1 A power supply after proper processing to supply power to the data acquisition and processing circuit of the bed in the dormitory, so as to ensure that the power supply can be connected to at least 8 beds or 6 beds for power supply, so as to improve the stability and reliability of the power supply. After the power supply enters into the intelligent monitoring bed, a 5 V/1 A regulated power supply is output through the switch regulated integrated chip MP1593 to supply power to the pressure sensor and pyroelectric sensor. The advantages of the chip MP1593 are simple peripheral circuit, small size, safety, and reliability, and it can output a range of 4.75–28 V. Chip MP1593 is connected to voltage stabilizing integrated chip LM117-3.3, which outputs 3.3 V/1 A voltage stabilizing power supply to supply STM32L053 and ZigBee CC2630. The peripheral circuit of chip LM117-3.3 is simple, safe, and reliable. Because the hardware of the intelligent monitoring bed needs to communicate with the external equipment, the power supply and the ground should be isolated [10].


### 4.1.3. Parameter Acquisition Circuit

The intelligent monitoring bed system collects the information of pressure sensor and pyroelectric sensor in real time.(1)
Pressure sensor data acquisition: adopt Taiwan Mavin NA8-200 kg pressure sensor. The sensor has a rated output voltage of 2.0 mV/V ± 5%, a hysteresis of 0.02% F.S, and a creep (20 minutes) of 0.02% F.S. When the sensor is installed, the pressure of the upper and lower beds is transmitted to the pressure sensor head through the four supports of the bed, and the voltage signal is output by the pressure sensor. Because the output signal does not match the processor, in order to improve the accuracy, it is no longer necessary to carry out operational amplification, and it directly enters the external high-precision A/D conversion chip HX710, which is then input into STM32L053 for processing. The A/D conversion chip HX710 is integrated with the package. The peripheral circuits needed by other chips of the same type, such as stabilized voltage power supply and on-chip clock oscillator, have the advantages of high integration, fast response speed, strong anti-interference, etc., reduce the cost, and improve the reliability of the intelligent bed.(2)
Pyroelectric sensor acquisition: HC-SR501 human body infrared induction module is used. The characteristic of the module is that its output voltage is 3.3 V, static current is 65μA, its maximum induction angle is 100°, and HC-SR501 human body infrared induction module collects signals and inputs them to the pyroelectric sensor processor BISS001 for processing. LDO chip HT7133-1 outputs 3.3 V to supply power to pyroelectric sensor module unit.


### 4.1.4. Data Processing Circuit

In this design, STM32L053 processor with low power consumption is used, which integrates SPI, I2C, serial port, and other signal communication. When collecting the pressure signal, the 5th and 6th pins of the 24-bit A/D conversion chip HX710 are clock signal and data output signal, respectively, the 6th pin DOUT is connected to the IO port of the processor, and the processor processes the data; when collecting the infrared temperature signal, the pyroelectric sensor processor BISS001 collects the signal and directly inputs it to the IO port of the processor for data processing.


### 4.1.5. Communication Networking Circuit

(1)
ZigBee communication: intelligent monitoring bed and gateway need data communication. In order to overcome the defects of complex wired transmission line wiring that is easy to be damaged, each bed communicates with dormitory gateway through wireless signal. The commonly used wireless signals are 433 MHz, WiFi, and ZigBee. ZigBee communication is adopted in the design of the system. The ZigBee module model is E72-2G4M23S1A. The module is a small-size chip ZigBee and 6LoWPAN wireless module with the maximum transmission power of 100 mW, which is independently developed with CC2630 produced by TI as the core. The 24 MHz industrial grade high-precision low-temperature drift active crystal oscillator has a measured transmission distance of 500–1500 meters. It overcomes the shortcomings of low data transmission rate, poor reliability, high power consumption, and low reliability of 433 MHz wireless signal. ZigBee communication network is easy. Each dormitory generally has 4 to 8 intelligent monitoring beds. The upper and lower beds of each bed share the same ZigBee communication module and processor STM32L053 chip. Meanwhile, the information of the two beds is uploaded to the gateway arranged in the dormitory.(2)
Other communication: the gateway enters the switch through wired mode and then enters the central station server unit. The server unit is the school central server and the cloud server. The data of the central server is processed and then uploaded to the cloud server, which is not detailed.


## 4.1.1. Sensor Monitoring Principle

The monitoring principle of the intelligent monitoring bed sensor is the primary factor to be considered in the hardware design. Sensors include pressure sensor group, pyroelectric sensor, etc.(1)
Pressure sensor group: the pressure sensor includes 8 sensors, namely, 4 upper pressure sensors and 4 lower pressure sensors. Among them, the upper pressure sensor is mainly used to detect the pressure of the bed to the lower bed, and the lower pressure sensor is mainly used to detect the pressure of the lower bed to the ground. The upper pressure sensor and the lower pressure sensor are both semiconductor piezoresistor type. The gravity of the sleeping body and the sleeping students is the sum of the pressure measured by the four upper pressure sensors, while the gravity of the sleeping body and the corresponding sleeping students is equal to the sum of the pressure measured by the four lower pressure sensors minus the sum of the pressure measured by the four upper pressure sensors.(2)
Pyroelectric sensor: pyroelectric sensor generates an alternating blind area and high sensitivity area. When the human body is in the detection range of the sensor, the infrared ray sent by the human body causes the sensor to receive the pulse high level signal, so as to judge someone. When the human body leaves the detection range, the sensor inputs the low level signal. During the installation of the module, the Fresnel lens on the surface of the module shall be kept away from the interference source such as light, so as to avoid the introduction of interference signals to cause misoperation; at the same time, the direction of the probe dual element shall be parallel to the direction with the most contact area of the human body as far as possible to ensure that the human body is sensed by the probe dual element when it is in existence.


## 4.1.2. Power Conversion Circuit

The intelligent monitoring bed is connected with a stable DC power supply, which adopts the design of the adaptive power supply with the former stage of 220 V voltage and outputs 12 V/1 A power supply after proper processing to supply power to the data acquisition and processing circuit of the bed in the dormitory, so as to ensure that the power supply can be connected to at least 8 beds or 6 beds for power supply, so as to improve the stability and reliability of the power supply. After the power supply enters into the intelligent monitoring bed, a 5 V/1 A regulated power supply is output through the switch regulated integrated chip MP1593 to supply power to the pressure sensor and pyroelectric sensor. The advantages of the chip MP1593 are simple peripheral circuit, small size, safety, and reliability, and it can output a range of 4.75–28 V. Chip MP1593 is connected to voltage stabilizing integrated chip LM117-3.3, which outputs 3.3 V/1 A voltage stabilizing power supply to supply STM32L053 and ZigBee CC2630. The peripheral circuit of chip LM117-3.3 is simple, safe, and reliable. Because the hardware of the intelligent monitoring bed needs to communicate with the external equipment, the power supply and the ground should be isolated [10].


## 4.1.3. Parameter Acquisition Circuit

The intelligent monitoring bed system collects the information of pressure sensor and pyroelectric sensor in real time.(1)
Pressure sensor data acquisition: adopt Taiwan Mavin NA8-200 kg pressure sensor. The sensor has a rated output voltage of 2.0 mV/V ± 5%, a hysteresis of 0.02% F.S, and a creep (20 minutes) of 0.02% F.S. When the sensor is installed, the pressure of the upper and lower beds is transmitted to the pressure sensor head through the four supports of the bed, and the voltage signal is output by the pressure sensor. Because the output signal does not match the processor, in order to improve the accuracy, it is no longer necessary to carry out operational amplification, and it directly enters the external high-precision A/D conversion chip HX710, which is then input into STM32L053 for processing. The A/D conversion chip HX710 is integrated with the package. The peripheral circuits needed by other chips of the same type, such as stabilized voltage power supply and on-chip clock oscillator, have the advantages of high integration, fast response speed, strong anti-interference, etc., reduce the cost, and improve the reliability of the intelligent bed.(2)
Pyroelectric sensor acquisition: HC-SR501 human body infrared induction module is used. The characteristic of the module is that its output voltage is 3.3 V, static current is 65μA, its maximum induction angle is 100°, and HC-SR501 human body infrared induction module collects signals and inputs them to the pyroelectric sensor processor BISS001 for processing. LDO chip HT7133-1 outputs 3.3 V to supply power to pyroelectric sensor module unit.


## 4.1.4. Data Processing Circuit

In this design, STM32L053 processor with low power consumption is used, which integrates SPI, I2C, serial port, and other signal communication. When collecting the pressure signal, the 5th and 6th pins of the 24-bit A/D conversion chip HX710 are clock signal and data output signal, respectively, the 6th pin DOUT is connected to the IO port of the processor, and the processor processes the data; when collecting the infrared temperature signal, the pyroelectric sensor processor BISS001 collects the signal and directly inputs it to the IO port of the processor for data processing.


## 4.1.5. Communication Networking Circuit

(1)
ZigBee communication: intelligent monitoring bed and gateway need data communication. In order to overcome the defects of complex wired transmission line wiring that is easy to be damaged, each bed communicates with dormitory gateway through wireless signal. The commonly used wireless signals are 433 MHz, WiFi, and ZigBee. ZigBee communication is adopted in the design of the system. The ZigBee module model is E72-2G4M23S1A. The module is a small-size chip ZigBee and 6LoWPAN wireless module with the maximum transmission power of 100 mW, which is independently developed with CC2630 produced by TI as the core. The 24 MHz industrial grade high-precision low-temperature drift active crystal oscillator has a measured transmission distance of 500–1500 meters. It overcomes the shortcomings of low data transmission rate, poor reliability, high power consumption, and low reliability of 433 MHz wireless signal. ZigBee communication network is easy. Each dormitory generally has 4 to 8 intelligent monitoring beds. The upper and lower beds of each bed share the same ZigBee communication module and processor STM32L053 chip. Meanwhile, the information of the two beds is uploaded to the gateway arranged in the dormitory.(2)
Other communication: the gateway enters the switch through wired mode and then enters the central station server unit. The server unit is the school central server and the cloud server. The data of the central server is processed and then uploaded to the cloud server, which is not detailed.


## 4.2. Software Design

### 4.2.1. Overall Software Design

STM32L053 processor is written in C language and Keil uVisn5 editor; the sensor uses the data of A/D sampling real-time monitoring and carries out corresponding processing according to the sampling data. If the parameter exceeds the normal range, the intelligent bed will give an alarm and display the alarm information on the LCD and upload the alarm information to the gateway and then to the Internet of things management platform for management personnel to analyze. If it is in the normal range, the system will not give an alarm, LCD displays the normal information on the display and uploads the normal information to the gateway and then to the Internet of things management platform for analysis.In the software design, it is mainly the software design of the bed collection system. First, the sensor is hardware initialized; then the data is collected, processed in the processor, and then communicated through CC2630 to transmit the data to the gateway. The main flowchart is shown in Figure3. For the overall system, the bed monitoring flowchart is shown in Figure 3(a) and the gateway flowchart is shown in Figure 3(b).Figure 3
Main flowchart: (a) bed monitoring flowchart and (b) gateway flowchart.
(a)(b)


### 4.2.2. Software Design of Detection Unit

The detection unit is mainly designed to process the data collected by the sensor. At different times, it packs the collected data and then detects whether ZigBee communication is busy. If it is not busy, it sends the data through ZigBee; if it is busy, it returns to the data packaging place and waits. The flowchart of the core unit is shown in Figure4.Figure 4
Flowchart of core unit.


### 4.2.3. Data Filtering Algorithm

When the human body lies on the bed or sleeps, it will cause pressure fluctuation in the process of turning over, which may be periodic interference signal or nonperiodic irregular random signal. These two kinds of signals have different characteristics, but they are interference signals. Because of different characteristics, the filtering methods used are different. In the existing algorithm, the limited amplitude filtering method can effectively overcome the pulse interference caused by accidental factors but cannot suppress the periodic interference, and the smoothness of the filter is poor. The first-order lag filtering method has the advantages of phase lag and low sensitivity, but it has a good restraining effect on periodic interference and high frequency fluctuation. When students lie in bed, the intelligent system needs not only occasional pulse interference, but also periodic interference.Through the above analysis, this design combines the limit filtering method, the first-order lag filtering method, and the median average filtering method and proposes an improved limit lag average filtering method. The algorithm flowchart is shown in Figure5, after STM32L053 reads the N sampling value output by the A/D conversion chip HX710. Each time the sample reaches a new value, you need to judge: if the result of subtracting the historical sampling average value Xc from the current sampling value Xn is less than the maximum sampling deviation value A set by the system, the current sampling value is valid; if the result of subtracting the historical sampling average value from the current sampling value is greater than the maximum sampling deviation value, the current sampling value is invalid; discard the current sampling value, and select the historical sampling average value as the current sampling value. In [11–14], therefore, the sampling output value of the first limiting filter is Y,(1)Yn=XnXcXn−Xc≤AXn−XC>AFigure 5
Effect diagram of pressure collection test. (a) Pressure test diagram of upper bed. (b) Pressure test diagram of lower bed.
(a)(b)In the above equation,Yn is the current sampling value; Xc is the historical sampling average value; A is the maximum sampling deviation value set by the system; Xn is the current sampling value.The sampling output value of the limited amplitude filtering algorithm is sent to the queue for the improved first-order lag low-pass filtering. Thenth obtained value is multiplied by the filtering coefficient a/2, and the n − 1 obtained value is multiplied by the filtering coefficient 1−a/2. The final value Y1n after the result processing is(2)Y1n=a2Yn+1−a2Xn−1The above equation,Y1n is the value obtained for the nth time, Yn is the value measured for the nth time, Xn − 1 is the value obtained for the n − 1 time, and α is the filtering coefficient. The low-pass filtering algorithm α adopted in this design is 0.1.After the improved first-order lag low-pass filtering, the data are filtered by median value average; that is,N1 measured values are collected continuously, the N1 values are regarded as a one-dimensional array, a minimum value and a maximum value are removed from the array, and then the arithmetic average value of the remaining (N − 2) data is calculated as the latest filtering output and updated to the historical sampling average value at the same time. The sample value after median average filtering is the final output value Y2n(3)Y2n=1N1−2∑I=0NI−1Yn−i−Yn−imax−Yn−iminIn the above equation,Yn−i is the output value of the (n − i) th sampling after the first-order low-pass filtering, Yn−imin and Yn−imin are the maximum and minimum values of the sampling values in the array, respectively, and Y2n is the final output value of the sample value after median average filtering [15–18].The flowchart of the improved amplitude-limited delay average filtering algorithm is shown in Figure6. The improved algorithm combines the advantages of limiting filtering, first-order lagging filtering, and median average filtering. It can not only eliminate the pulse interference caused by human body turning over in bed or getting up and other related actions, but also suppress the data error caused by periodic interference and improve the accuracy of sampling pressure value test.Figure 6
Flowchart of improved amplitude limiting lag average filtering algorithm.


### 4.2.4. Data Complexity Analysis

We analyze the computation complexity of method proposed above. Given N samples, the time complexity to compute the data filtering algorithm is O(N2).Among them, the output value of the first limiting filter sampling isYn, and the output Yn is improved with first-order lag low-pass filtering. The nth obtained value is multiplied by the filtering coefficient a/2, and the n − 1 obtained value is multiplied by the filtering coefficient 1−a/2. The result of processing is Y1n. And the sample value after Y1n median average filtering is the final output value Y2n. Finally, the latest filtering output was fed back and compared with the sample value Xn and updated to the historical sampling average value at the same time.Figure 7
Structure of intelligent monitoring bed in dormitory.


## 4.2.1. Overall Software Design

STM32L053 processor is written in C language and Keil uVisn5 editor; the sensor uses the data of A/D sampling real-time monitoring and carries out corresponding processing according to the sampling data. If the parameter exceeds the normal range, the intelligent bed will give an alarm and display the alarm information on the LCD and upload the alarm information to the gateway and then to the Internet of things management platform for management personnel to analyze. If it is in the normal range, the system will not give an alarm, LCD displays the normal information on the display and uploads the normal information to the gateway and then to the Internet of things management platform for analysis.In the software design, it is mainly the software design of the bed collection system. First, the sensor is hardware initialized; then the data is collected, processed in the processor, and then communicated through CC2630 to transmit the data to the gateway. The main flowchart is shown in Figure3. For the overall system, the bed monitoring flowchart is shown in Figure 3(a) and the gateway flowchart is shown in Figure 3(b).Figure 3
Main flowchart: (a) bed monitoring flowchart and (b) gateway flowchart.
(a)(b)


## 4.2.2. Software Design of Detection Unit

The detection unit is mainly designed to process the data collected by the sensor. At different times, it packs the collected data and then detects whether ZigBee communication is busy. If it is not busy, it sends the data through ZigBee; if it is busy, it returns to the data packaging place and waits. The flowchart of the core unit is shown in Figure4.Figure 4
Flowchart of core unit.


## 4.2.3. Data Filtering Algorithm

When the human body lies on the bed or sleeps, it will cause pressure fluctuation in the process of turning over, which may be periodic interference signal or nonperiodic irregular random signal. These two kinds of signals have different characteristics, but they are interference signals. Because of different characteristics, the filtering methods used are different. In the existing algorithm, the limited amplitude filtering method can effectively overcome the pulse interference caused by accidental factors but cannot suppress the periodic interference, and the smoothness of the filter is poor. The first-order lag filtering method has the advantages of phase lag and low sensitivity, but it has a good restraining effect on periodic interference and high frequency fluctuation. When students lie in bed, the intelligent system needs not only occasional pulse interference, but also periodic interference.Through the above analysis, this design combines the limit filtering method, the first-order lag filtering method, and the median average filtering method and proposes an improved limit lag average filtering method. The algorithm flowchart is shown in Figure5, after STM32L053 reads the N sampling value output by the A/D conversion chip HX710. Each time the sample reaches a new value, you need to judge: if the result of subtracting the historical sampling average value Xc from the current sampling value Xn is less than the maximum sampling deviation value A set by the system, the current sampling value is valid; if the result of subtracting the historical sampling average value from the current sampling value is greater than the maximum sampling deviation value, the current sampling value is invalid; discard the current sampling value, and select the historical sampling average value as the current sampling value. In [11–14], therefore, the sampling output value of the first limiting filter is Y,(1)Yn=XnXcXn−Xc≤AXn−XC>AFigure 5
Effect diagram of pressure collection test. (a) Pressure test diagram of upper bed. (b) Pressure test diagram of lower bed.
(a)(b)In the above equation,Yn is the current sampling value; Xc is the historical sampling average value; A is the maximum sampling deviation value set by the system; Xn is the current sampling value.The sampling output value of the limited amplitude filtering algorithm is sent to the queue for the improved first-order lag low-pass filtering. Thenth obtained value is multiplied by the filtering coefficient a/2, and the n − 1 obtained value is multiplied by the filtering coefficient 1−a/2. The final value Y1n after the result processing is(2)Y1n=a2Yn+1−a2Xn−1The above equation,Y1n is the value obtained for the nth time, Yn is the value measured for the nth time, Xn − 1 is the value obtained for the n − 1 time, and α is the filtering coefficient. The low-pass filtering algorithm α adopted in this design is 0.1.After the improved first-order lag low-pass filtering, the data are filtered by median value average; that is,N1 measured values are collected continuously, the N1 values are regarded as a one-dimensional array, a minimum value and a maximum value are removed from the array, and then the arithmetic average value of the remaining (N − 2) data is calculated as the latest filtering output and updated to the historical sampling average value at the same time. The sample value after median average filtering is the final output value Y2n(3)Y2n=1N1−2∑I=0NI−1Yn−i−Yn−imax−Yn−iminIn the above equation,Yn−i is the output value of the (n − i) th sampling after the first-order low-pass filtering, Yn−imin and Yn−imin are the maximum and minimum values of the sampling values in the array, respectively, and Y2n is the final output value of the sample value after median average filtering [15–18].The flowchart of the improved amplitude-limited delay average filtering algorithm is shown in Figure6. The improved algorithm combines the advantages of limiting filtering, first-order lagging filtering, and median average filtering. It can not only eliminate the pulse interference caused by human body turning over in bed or getting up and other related actions, but also suppress the data error caused by periodic interference and improve the accuracy of sampling pressure value test.Figure 6
Flowchart of improved amplitude limiting lag average filtering algorithm.


## 4.2.4. Data Complexity Analysis

We analyze the computation complexity of method proposed above. Given N samples, the time complexity to compute the data filtering algorithm is O(N2).Among them, the output value of the first limiting filter sampling isYn, and the output Yn is improved with first-order lag low-pass filtering. The nth obtained value is multiplied by the filtering coefficient a/2, and the n − 1 obtained value is multiplied by the filtering coefficient 1−a/2. The result of processing is Y1n. And the sample value after Y1n median average filtering is the final output value Y2n. Finally, the latest filtering output was fed back and compared with the sample value Xn and updated to the historical sampling average value at the same time.Figure 7
Structure of intelligent monitoring bed in dormitory.


## 4.3. Structural Design

(1)
Arrangement of pressure sensor: the four upper pressure sensors of the intelligent monitoring bed are, respectively, set at the bottom of four legs of the bed body, and the four lower pressure sensors are, respectively, set at the bottom of four legs of the bed body. At the same time, upper bed body and lower bed body both include the transverse bearing body and the vertical support column set at the four corners of the transverse bearing body; the upper end face of the vertical support column of the bed body is concave downward in the middle. The middle of the lower end face of the vertical support column of the bed body protrudes downward to form a plug-in pin which is inserted into the plug-in slot and pressed against the bottom of the plug-in slot. The upper pressure sensor is set at the bottom of the plug slot and pressed down by the plug pin. The intelligent monitoring bed structure of the dormitory is shown in Figure7. The bed body 1 and the lower bed body 2 both include a transverse bearing body and a vertical support column arranged at four corners of the transverse bearing body 5; the middle of the upper end surface of the vertical support column 6 of the lower bed body 2 is sunken downward to form a socket 8; the middle of the lower end surface of the vertical support column 7 of the bed body 1 is protruded downward to form a socket 9 inserted into the socket and pressed against the bottom of the socket; the upper pressure sensor 3 is arranged at the bottom of the socket and it is pressed down by the plug pin to ensure that the bed body 1 is fixed and stable to avoid falling off of the bed body 1.(2)
Pyroelectric sensor arrangement: the intelligent monitoring bed is equipped with two pyroelectric sensors, which are, respectively, installed on the head of the bed of the intelligent monitoring bed and the next two beds, directly facing the sleeping students. The signals of two pyroelectric sensors are processed by the same processor STM32L053 chip, which can identify whether the corresponding bed is occupied [19, 20].


## 5. Test Analysis

### 5.1. Verification of Pressure Test Effect

The human body, respectively, wades on the surface of the bed body and the bed body of the intelligent monitoring bed and finally displays the measured pressure value on the terminal display through relevant processing. By comparing the total weight of human body with the displayed pressure value, we can judge whether the pressure collection is normal and effective. The effect of pressure test is shown in Figure7.It can be seen from Figure7 that the pressure value of the upper and lower beds of the intelligent monitoring bed can be collected normally, and the accuracy error of the test is less than 3%.


### 5.2. Personnel Identification and Verification

The software design interface is shown in Figure8, and the verification results fully meet the requirements.Figure 8
System software design interface.The test shows that the system works reliably, has excellent performance, good stability, and high accuracy, and greatly improves the efficiency of students’ bedtime management.


## 5.1. Verification of Pressure Test Effect

The human body, respectively, wades on the surface of the bed body and the bed body of the intelligent monitoring bed and finally displays the measured pressure value on the terminal display through relevant processing. By comparing the total weight of human body with the displayed pressure value, we can judge whether the pressure collection is normal and effective. The effect of pressure test is shown in Figure7.It can be seen from Figure7 that the pressure value of the upper and lower beds of the intelligent monitoring bed can be collected normally, and the accuracy error of the test is less than 3%.


## 5.2. Personnel Identification and Verification

The software design interface is shown in Figure8, and the verification results fully meet the requirements.Figure 8
System software design interface.The test shows that the system works reliably, has excellent performance, good stability, and high accuracy, and greatly improves the efficiency of students’ bedtime management.


## 6. Conclusion and Prospect

Through the experimental analysis, the sleeping management system based on intelligent monitoring bed has achieved the effect of monitoring students’ sleeping at night.This paper puts forward a management system which is suitable for vocational college students to monitor their bedtime remotely. The system monitors weight by pressure sensor, body temperature by pyroelectric sensor, fingerprint sensor, etc., links with gateway by wireless ZigBee, and uploads to central server through switch. The system can overcome the defects in the existing management and technology, ensure the strict supervision of students’ sleeping conditions, reduce the workload of dormitory administrators, improve the efficiency of students’ sleeping management, effectively supervise the situation that students do not go home at night, avoid the unsafe hidden dangers caused by students going out without permission, and provide better protection for students’ safety, and parents can also timely master the students’ sleeping conditions in school which has a positive effect in all aspects. The next step is to optimize the management system of students’ bedtime by increasing the number of students calling for help and alarming, monitoring the physical characteristics of students, etc.



---

*Source: 5174410-2022-02-22.xml*