# Design of Wireless Sensor Body Measurement Information Acquisition System for College Students’ Physical Health Management

Authors: Haishan Liu; Mingjiang Zhu; Yuanjing Li; Chengyun Zhang; Yejun Bie; Hui Zhang
Journal: Journal of Sensors
 (2021)

---

## Abstract

With the improvement of the quality of national life, the physical health problem is gradually placed in the same important position as the basic problems such as education, people’s livelihood, and safety. Improving the physical quality of college students and promoting the healthy growth of students are major events in the future of the country and the nation. Therefore, each school will conduct a physical test every year. The use of wireless sensors for data acquisition has played an important role in various fields. Therefore, for the physical health management of college students, this paper proposes to design a sensor system to collect physical measurement data. The measured data is collected through the sensor, such as the XGZP6847 gas pressure sensor to collect students’ vital capacity. Then, the sensor node and the coordinator are connected to the PC through the serial port, respectively, and the CC2530 chip transmits the data to the coordinator through the ZigBee module, establishes communication with the PC through the 2.4G wireless communication module, adopts the strategy of the thread pool to save resources, improves the response speed, and obtains students’ body test data in real time. Taking the data acquisition and transmission of vital capacity and body weight subjects as an example, the system realizes the accurate transmission of the collected test data from the sensor to the terminal, greatly improves the accuracy and real-time body test data acquisition, and reduces the probability of errors in the recording process, and the collected data can be used directly or for secondary development, and it promotes the establishment of college students’ physical health management system.


---

## Body

## 1. Introduction

With the application and development of the Internet of things and data mining technology, the real-time performance of the data acquisition process is particularly important. It can help users monitor data in real time and further mine effective information. Colleges and universities carry out students’ physical fitness tests every year. There are more and more historical data related to students’ physical health. Each region and school will produce a large number of real-time data. In the work of improving students’ physical health, it is necessary to make full use of the value of a large amount of test data of students’ physical health in previous years. With the development of emerging technologies, the work of improving students’ health is gradually moving towards the era of big data [1]. Students’ physical health test data are collected through the database. The test data is huge. Using the traditional data collection methods, it is impossible to record, capture, and manage the data quickly.At present, the characteristics of sensor information acquisition systems are many kinds of sensors, large amount of data, high modularization of data acquisition, and fixed storage process, and the collected data can be used directly or for secondary development. The sensor technology with multiple functions and low energy consumption has developed rapidly under the strong promotion of the technological progress of microelectronics, technology, and wireless communication, so that a variety of functions such as information collection, data processing, and wireless communication can be integrated into a very small volume [2]. Due to the rapid development of microelectromechanical systems (MEMS), wireless communication systems, and digital electronic technology, there is a new way of information acquisition and processing, that is, wireless sensor network, which is an important research branch of the wireless ad hoc network. Wireless sensor networks are composed of many sensor nodes [3], which can monitor and collect the data information of the surrounding environment. The sensor network processes this information and gives it to the observer [4].The system is used to collect some data of college students’ physical measurement data. According to its measurement principle, the subjects involved in the new standard can be classified as follows: sit-ups and pull-up are counting subjects; sitting forward flexion and standing long jump are distance measurement subjects; 50-meter run, 800-meter run, and 1000-meter run are timing subjects; and height, weight, and vital capacity were measured subjects. The sensor node module is mainly composed of the sensor module, data processing module, and ZigBee wireless communication module. The sensor module is a variety of sensors that can collect the required data, while the data processing module and ZigBee wireless transmission module are composed of a CC2530 chip and its auxiliary circuits to jointly complete the purposes of data acquisition and short-distance data transmission. Because the test area is small, ordinary wireless sensor nodes do not need to establish communication with each other. The wireless transmission module of the external network adopts the AS01-ML01DP5 wireless transmission module, its working frequency band is 2.4 GHz, and it adopts double in-line, SMA output interface and built-in LNA and integrates RFX2401C power amplifier chip and NRF24L01 RF chip. The module can not only have a transmission distance of 2 km but also ensure its transmission speed. Since PC cannot be directly connected with SPI interfaces of all modules, a microprocessor is used to complete the function of interface switching. In order to facilitate the test, the system adopts the as06-vtb07 module produced by the same manufacturer as the wireless module to realize the serial port conversion function. The module uses the STM8L101F3P6 minimum system board leading out all I/O ports to realize the interface conversion function through the CH340 virtual serial port chip. In the design, according to the requirements of register configuration, the data reception and transmission are controlled according to the communication timing. The system analyzes and processes the received information and submits it to the teacher for viewing. At the same time, the system feeds back the relevant information to each network node, which greatly improves the work efficiency of the system. The purpose is to obtain the status of the monitoring node in real time, enable the host computer to obtain the relevant information through the wireless network, and adopt certain processing methods. Using the platform to collect physical test data and develop the college students’ physical health management system can reduce repetitive work on the one hand and reduce the probability of human errors in the programming process on the other hand.


## 2. Related Work

Because wireless sensor networks have many advantages, they are widely used in transportation, medical, and other fields [5]. It can help us obtain data faster, more efficiently, and more economically. Now, with the in-depth research of WSN in the direction of obtaining information, wireless sensor networks have applications in various fields.In the 1970s, there were professional health management organizations in the United States to study various factors affecting human health, such as the health maintenance organization in California. American scholars have done a wide range of research on physical fitness, ranging from the construction of theoretical models to the experimental operation of specific physical fitness contents. As early as 1954, Kraus et al. designed six test methods including the lowest level of low back muscle strength and body flexibility, which were widely used in the United States and some European countries. After being supplemented and adjusted, the test contents include 50-meter run, 600-meter run, standing long jump, softball throw, round-trip run, pull-up, and sit-ups. In 1987, the fitnessgram project was officially launched. At present, it has become an important physical fitness evaluation and reporting software and comprehensive evaluation and intervention system in the United States, including physical promotion and nutrition. In 2011, the Centers for Disease Control and Prevention released the American school health guide aimed at promoting healthy diet and physical activity in schools based on the research on the development of students’ physical quality.In the physical fitness test process, the technologies applied in the perception layer are mainly wireless sensor network technology and radio frequency identification technology [6]. The use of wireless sensor radio frequency identification technology can integrate RFID technology and WSN technology [7] to achieve physical fitness test results and the purpose of reading student information. There are also many researches of this kind. These studies focus on optimization algorithms for node deployment. For example, AeroScout and NTT laboratories have invented an electronic tag equipped with sensor nodes [8]. In fact, radio frequency identification technology has been widely used in the physical fitness test of college students, which is mainly reflected in campus cards. There are also papers directly designing a sports test system based on RFID technology [9].Sensor network nodes transmit sensing information through a certain communication protocol. Remote users need to access external networks such as the Internet, local area network, or corporate intranet through gateway devices to realize real-time monitoring and query of wireless sensor network information. Literature [10] designed a wearable arm-ECG sensor system for comfortable cardiac electrical activity and heart rhythm recording and monitoring. Literature [11] used WSN as the sensing part of the system and quickly checked the health of trees through information such as the Nitrate Balance Index (NBI) provided by the fluorescence sensor. Literature [12] proposed a new feature extraction technology in WSN. Literature [13] used the B/S (browser/server) mode to express a method for remote data monitoring of wireless sensor networks. When a remote user issues a query upon request, the gateway sends a query request to each node of the sensor network through the sink node. After receiving the query request, the sensor node sends back confirmation information to the sink node and the gateway and then uploads the collected sensor data information to the sink node and then uploads it through the sink node. After corresponding processing to the gateway, it is returned to the remote inquiring user. This design has the disadvantage of serious lag in query time and is not suitable for monitoring systems with strong real-time performance and large data volume.


## 3. Design of Wireless Sensor Body Measurement Information Collection System

### 3.1. Design and Implementation of Wireless Sensor Node

In the whole system, the wireless sensor node is the most basic component. A wireless sensor node includes a microprocessor, a sensor unit, a transceiver unit, and a power supply unit [14]. After the sensor draws the data conclusion, it will transmit the conclusion data to each terminal application device, and the terminal application device will automatically execute the corresponding instructions and operations according to these data, as shown in Figure 1.Figure 1
Basic composition block diagram of the wireless sensor node.In this system, the wireless network layer bears the multisensor data collection terminal. The main task is to collect data at the monitoring site and periodically transmit the collected data to the system server via GPRS.Image data is collected through image sensor nodes, and environmental data is collected through environmental sensor nodes. A summarize of the main work of this layer in one sentence is the following: this layer mainly uses eight types of environmental data sensors plus an image sensor, forming a wireless sensor network through the ZigBee local area network protocol for data collection [15] and fusion of data through aggregation nodes. After the data fusion is completed, the gateway will be ready to send data to the IoT gateway. In this system, the image sensor node uses a traditional USB camera. The image acquisition program framework uses V4L2 (Video4Linux2), a programming framework for uvc drive-free USB devices [16]. Video4Linux2 is a kernel driver framework for video devices in the Linux kernel, which provides a unified interface for the upper layer to access the lower video devices. All subsystems in the kernel have the advantages of abstracting the differences of the underlying hardware, providing a unified interface for the upper layer, and extracting the common code to avoid code redundancy. The overall video image monitoring system framework is shown in Figure 2.Figure 2
Framework of video image monitoring system.Environmental data sensors perform their duties, monitoring the corresponding environmental values in the surrounding environment. Because of the various data formats (units, numerical ranges) collected, a “command headquarters” is needed to manage it, which derives a convergence node, that is, a coordinated management node. From the derived purpose, it can be seen that the coordination management node mainly aggregates the data of eight environmental data sensors, formats them, and transmits data with the TQ6410 gateway.For pull-ups, after fixing the infrared sensor at the upper end of the horizontal bar, if the student can reach the height that the infrared sensor can detect, the infrared sensor returns a high level to the CC2530, and the CC2530 passes through the signal. After the treatment, its internal counter will count once, so as to achieve the purpose of measuring the number of pull-ups. In the same way, when measuring sit-ups, an infrared sensor is set at the position of the student’s head under the posture where the elbows and knees are expected to touch, which can also achieve the purpose of counting sit-ups.For timing subjects, infrared transceiver sensors are also used for measurement. The transmitter of the infrared sensor will continue to emit infrared signals, and when the infrared touches an object, it will produce a reflected signal. After receiving the signal, the receiving end performs a series of operations on the signal, such as amplifying, detecting, and shaping, and finally obtains the TTL level coded signal and sends it to the CC2530 chip for decoding and subsequent operations.For the distance test, the ultrasonic distance measuring module is selected to realize noncontact measurement. The working principle is to start the timer while triggering the ranging, the transmitting module will automatically send a square wave, and the receiving module will detect if there is a signal returned; if there is a return signal, it will output a high level, and the high level will last for a long time. It is the time from transmission to return of the ultrasound, and the distance to the measured object can be calculated according to the time difference between transmission and reception. For example, when measuring height, the ultrasonic module probe is placed at a distance of 2.5 m from the ground, and the distance between the probe and the height measuring platform measured by the ultrasonic module ish; then, h=highleveltime∗soundspeed/2, and then, get height H=250‐h. In the same way, in standing long jump and sitting forward bending subjects, the ultrasonic distance measurement module can also be used to measure student performance.


### 3.2. Physical Test Thread Pool Working Model

When receiving a request from TQ6410 in the central data center of the college student’s physical examination, the task manager will fork the corresponding subprocess to process the request if it follows the simple processing steps. However, if multiple physical sensor devices make requests at the same time, the manager will continue to fork the process [17], and it also needs to manage the subprocesses that have processed the request. At this time, the servers in the central data center will face excessive resource occupation, which may cause service downtime. Therefore, in order to solve this kind of situation, the concept of “thread pool” is introduced in this data collection system.The working model of the thread pool is shown in Figure3. The workflow is roughly as follows: First, create a specified number of task processor threads during the initialization phase of the physical measurement data collection system. All threads are initially in the idle queue. Once a sink node sends data to the monitoring server, it only needs to be taken from the idle list. One thread is enough. If the free list is empty, the user cannot send data temporarily. When the client suspends sending data, the thread is released, and the thread returns to the free list. After using this thread pool technology, the system’s CPU occupancy will not change drastically with the increase of requests, which can be maintained in a stable state, and the service of the entire system is maintained in a serviceable state [18]. At the same time, the manager is also in an orderly rhythm for operations such as creating new requests and destroying child processes, which is beneficial to improve the efficiency of the entire system.Figure 3
Working model of thread pool.


### 3.3. The Framework of College Students’ Physical Health Management System

This article adopts the MVC design mode and realizes the automatic generation of source files for the display layer, control layer, persistence layer, and data collection terminal through template technology. The overall structure of the platform is shown in Figure4.Figure 4
System architecture diagram.In Figure4, the entire system uses Spring MVC as the core, the page controls of the presentation layer use jQuery-based components, and the page technology uses JSP, JSTL, and HTML technologies; page messages are distributed in the background through Spring MVC’s Dispatcher and finally by the background program processing; the background uses JPA technology to map the database to the entity class; in order to improve database performance and concurrent query capabilities, the platform integrates MemCached [19]. The front-end data acquisition equipment can be selected according to needs, and the corresponding template can be configured according to the controller and sensor used. This article uses the Arduino open-source platform as the front end of data acquisition. Arduino is a software and hardware platform based on an open-source code, built on the open-source code simple I/O interface, and has a processing/wiring development environment similar to Java and C. According to the overall structure of the platform, the workflow of the generated business data collection platform is front-end datacollection⟶encapsulateddata⟶datatransmissionusingnetworkmodules⟶backgroundprocessingrequest⟶storagedata⟶pagedisplay.The system generated by the platform adopts the MVC model, and the server is based on Spring [20]. The generated classes should include the control layer, the service layer, and the persistence layer. The persistence layer includes database operation classes and entity class files. The control layer adopts Spring MVC and realizes the mapping from URL to class based on annotations. The platform uses native Spring MVC, and the architecture group provides development standards and specification sample documents in various scenarios.The control layer implements a base class, which encapsulates the functions of server validity verification, adding new messages, adding flash messages, initializing data binding, etc. When the platform generates the user-level control layer class, it needs to inherit this class, and the program can directly call the parent class method when running, which is more convenient to use the simplified template to generate code and reduce repetitive work. The service layer takes spring IoC as the core and manages all business service classes. The parent class of the service layer should encapsulate the functions of data range filtering and permission filtering. The user service layer class generated by the platform inherits this parent class to realize the functions of adding, finding, deleting, and updating. Spring JPA is adopted for persistence, and the underlying layer depends on hibernate implementation [21]. The architecture level considers the realization of separation of read and write and distinguishes based on the spring transaction mark, and the architecture is unified encapsulated to reduce the judgment of development [22]. Arduino can use developed electronic components such as switches or sensors or other control devices, LEDs, stepper motors, or other output devices or operate independently as an interface that can communicate with software. The platform persistence layer realizes the functions of paging query, obtaining entities, saving entities, updating entities, logical deletion, and physical deletion. The persistence layer class generated by the platform based on the template inherits the persistence layer base class of the platform, eliminating the need for users to manually add, delete, modify, and check data. Hibernate is an object relational mapping solution under the Java language. Hibernate is not only responsible for the mapping from Java classes to database tables but also includes the mapping from Java data types to SQL data types. It also provides an object-oriented data query and retrieval mechanism, which greatly shortens the development time of manually processing SQL and JDBC.


## 3.1. Design and Implementation of Wireless Sensor Node

In the whole system, the wireless sensor node is the most basic component. A wireless sensor node includes a microprocessor, a sensor unit, a transceiver unit, and a power supply unit [14]. After the sensor draws the data conclusion, it will transmit the conclusion data to each terminal application device, and the terminal application device will automatically execute the corresponding instructions and operations according to these data, as shown in Figure 1.Figure 1
Basic composition block diagram of the wireless sensor node.In this system, the wireless network layer bears the multisensor data collection terminal. The main task is to collect data at the monitoring site and periodically transmit the collected data to the system server via GPRS.Image data is collected through image sensor nodes, and environmental data is collected through environmental sensor nodes. A summarize of the main work of this layer in one sentence is the following: this layer mainly uses eight types of environmental data sensors plus an image sensor, forming a wireless sensor network through the ZigBee local area network protocol for data collection [15] and fusion of data through aggregation nodes. After the data fusion is completed, the gateway will be ready to send data to the IoT gateway. In this system, the image sensor node uses a traditional USB camera. The image acquisition program framework uses V4L2 (Video4Linux2), a programming framework for uvc drive-free USB devices [16]. Video4Linux2 is a kernel driver framework for video devices in the Linux kernel, which provides a unified interface for the upper layer to access the lower video devices. All subsystems in the kernel have the advantages of abstracting the differences of the underlying hardware, providing a unified interface for the upper layer, and extracting the common code to avoid code redundancy. The overall video image monitoring system framework is shown in Figure 2.Figure 2
Framework of video image monitoring system.Environmental data sensors perform their duties, monitoring the corresponding environmental values in the surrounding environment. Because of the various data formats (units, numerical ranges) collected, a “command headquarters” is needed to manage it, which derives a convergence node, that is, a coordinated management node. From the derived purpose, it can be seen that the coordination management node mainly aggregates the data of eight environmental data sensors, formats them, and transmits data with the TQ6410 gateway.For pull-ups, after fixing the infrared sensor at the upper end of the horizontal bar, if the student can reach the height that the infrared sensor can detect, the infrared sensor returns a high level to the CC2530, and the CC2530 passes through the signal. After the treatment, its internal counter will count once, so as to achieve the purpose of measuring the number of pull-ups. In the same way, when measuring sit-ups, an infrared sensor is set at the position of the student’s head under the posture where the elbows and knees are expected to touch, which can also achieve the purpose of counting sit-ups.For timing subjects, infrared transceiver sensors are also used for measurement. The transmitter of the infrared sensor will continue to emit infrared signals, and when the infrared touches an object, it will produce a reflected signal. After receiving the signal, the receiving end performs a series of operations on the signal, such as amplifying, detecting, and shaping, and finally obtains the TTL level coded signal and sends it to the CC2530 chip for decoding and subsequent operations.For the distance test, the ultrasonic distance measuring module is selected to realize noncontact measurement. The working principle is to start the timer while triggering the ranging, the transmitting module will automatically send a square wave, and the receiving module will detect if there is a signal returned; if there is a return signal, it will output a high level, and the high level will last for a long time. It is the time from transmission to return of the ultrasound, and the distance to the measured object can be calculated according to the time difference between transmission and reception. For example, when measuring height, the ultrasonic module probe is placed at a distance of 2.5 m from the ground, and the distance between the probe and the height measuring platform measured by the ultrasonic module ish; then, h=highleveltime∗soundspeed/2, and then, get height H=250‐h. In the same way, in standing long jump and sitting forward bending subjects, the ultrasonic distance measurement module can also be used to measure student performance.


## 3.2. Physical Test Thread Pool Working Model

When receiving a request from TQ6410 in the central data center of the college student’s physical examination, the task manager will fork the corresponding subprocess to process the request if it follows the simple processing steps. However, if multiple physical sensor devices make requests at the same time, the manager will continue to fork the process [17], and it also needs to manage the subprocesses that have processed the request. At this time, the servers in the central data center will face excessive resource occupation, which may cause service downtime. Therefore, in order to solve this kind of situation, the concept of “thread pool” is introduced in this data collection system.The working model of the thread pool is shown in Figure3. The workflow is roughly as follows: First, create a specified number of task processor threads during the initialization phase of the physical measurement data collection system. All threads are initially in the idle queue. Once a sink node sends data to the monitoring server, it only needs to be taken from the idle list. One thread is enough. If the free list is empty, the user cannot send data temporarily. When the client suspends sending data, the thread is released, and the thread returns to the free list. After using this thread pool technology, the system’s CPU occupancy will not change drastically with the increase of requests, which can be maintained in a stable state, and the service of the entire system is maintained in a serviceable state [18]. At the same time, the manager is also in an orderly rhythm for operations such as creating new requests and destroying child processes, which is beneficial to improve the efficiency of the entire system.Figure 3
Working model of thread pool.


## 3.3. The Framework of College Students’ Physical Health Management System

This article adopts the MVC design mode and realizes the automatic generation of source files for the display layer, control layer, persistence layer, and data collection terminal through template technology. The overall structure of the platform is shown in Figure4.Figure 4
System architecture diagram.In Figure4, the entire system uses Spring MVC as the core, the page controls of the presentation layer use jQuery-based components, and the page technology uses JSP, JSTL, and HTML technologies; page messages are distributed in the background through Spring MVC’s Dispatcher and finally by the background program processing; the background uses JPA technology to map the database to the entity class; in order to improve database performance and concurrent query capabilities, the platform integrates MemCached [19]. The front-end data acquisition equipment can be selected according to needs, and the corresponding template can be configured according to the controller and sensor used. This article uses the Arduino open-source platform as the front end of data acquisition. Arduino is a software and hardware platform based on an open-source code, built on the open-source code simple I/O interface, and has a processing/wiring development environment similar to Java and C. According to the overall structure of the platform, the workflow of the generated business data collection platform is front-end datacollection⟶encapsulateddata⟶datatransmissionusingnetworkmodules⟶backgroundprocessingrequest⟶storagedata⟶pagedisplay.The system generated by the platform adopts the MVC model, and the server is based on Spring [20]. The generated classes should include the control layer, the service layer, and the persistence layer. The persistence layer includes database operation classes and entity class files. The control layer adopts Spring MVC and realizes the mapping from URL to class based on annotations. The platform uses native Spring MVC, and the architecture group provides development standards and specification sample documents in various scenarios.The control layer implements a base class, which encapsulates the functions of server validity verification, adding new messages, adding flash messages, initializing data binding, etc. When the platform generates the user-level control layer class, it needs to inherit this class, and the program can directly call the parent class method when running, which is more convenient to use the simplified template to generate code and reduce repetitive work. The service layer takes spring IoC as the core and manages all business service classes. The parent class of the service layer should encapsulate the functions of data range filtering and permission filtering. The user service layer class generated by the platform inherits this parent class to realize the functions of adding, finding, deleting, and updating. Spring JPA is adopted for persistence, and the underlying layer depends on hibernate implementation [21]. The architecture level considers the realization of separation of read and write and distinguishes based on the spring transaction mark, and the architecture is unified encapsulated to reduce the judgment of development [22]. Arduino can use developed electronic components such as switches or sensors or other control devices, LEDs, stepper motors, or other output devices or operate independently as an interface that can communicate with software. The platform persistence layer realizes the functions of paging query, obtaining entities, saving entities, updating entities, logical deletion, and physical deletion. The persistence layer class generated by the platform based on the template inherits the persistence layer base class of the platform, eliminating the need for users to manually add, delete, modify, and check data. Hibernate is an object relational mapping solution under the Java language. Hibernate is not only responsible for the mapping from Java classes to database tables but also includes the mapping from Java data types to SQL data types. It also provides an object-oriented data query and retrieval mechanism, which greatly shortens the development time of manually processing SQL and JDBC.


## 4. Experiment and Analysis

### 4.1. Physical Information Collection Data Center Programming Architecture

First, the programming architecture of the central data center is shown in Figure5. After the client makes a request and connects, the task processor allocates the corresponding ClientEventHandler for transaction processing, and the handler mainly performs data receiving functions. In order to solve the above problems, ACE middleware technology, message distributor technology, and thread pool technology are used in the design and development of the central data center of this system.Figure 5
Programming logic of central data center.The message is transmitted in the form of a byte stream through the TCP/IP protocol in the network. It is very important to know when the transmission of a message ends. Therefore, some necessary record information is transmitted at the beginning of each message. In order to reduce the excessive occupation of byte stream and improve transmission efficiency, the following message structure is designed:Message format{Int TYPE; //The beginning of the messageint ID; //device number{//Circular receiving partlong size; //message length…… //The content of the real message, the length of this part is the same as that specified by size}}All messages must use the above structure. When TYPE is 1, it means that the data sent from the video image is received; when TYPE is 2, it means that the data is received from environmental sensors. The distinction between different sensors is obtained by analyzing the content of the received text information, such as The received is: “humidity: 34.6”, use “:” to divide it, the received is the data sent by the humidity sensor, the value is 34.6; when the TYPE is other values, it means that the data format is wrong. At this time, the error log information should be written in the system.


### 4.2. System Initialization and Driver Implementation

The startup code of ARM7 microprocessor LPC2138 is mainly composed of five parts: startup.s (assembly file), IRQ.s (assembly file), target.e (C file), target.h (header file), and config.h (header file).The serial communication between LPC2138 and CC2530 adopts the interrupt processing mode. When the interrupt service subroutine receives an interrupt, the first thing it needs to do is to find the interrupt type in the interrupt flag register (U0IIR), because it only knows that UART has an interrupt, but cannot judge what type of interrupt it is, and carry out corresponding processing according to the query results. After processing, you need to read U0IIR to clear the interrupt and then exit the interrupt service program. The interrupt vector table is shown in Table1.Table 1
UART interrupt vector table.
U0IIRPriorityInterrupt typeInterrupt sourceInterrupt reset0010ThirdTHRETHREU0IIR read or THR write1100SecondCharacter timeout indicationRXFIFO has at least one character and no character is input or removed in a short timeU0RBR read0100SecondRX data is available or reach the trigger point in FIFO modeU0RBR read or UART0 FIFO reaches the trigger pointRead data from receive buffer register and insert it into receive queue0110FirstRX state errorOE, PE, FE, BIU0LSR readThe wireless communication transceiver chip we choose is CC2530, which is the hardware guarantee of the ZigBee network. The API interface that the ZigBee protocol must exist is provided by the CC2530 driver. The driver of CC2530 contains a total of five interfaces: CC2530 initialization interface (CC2530_init), CC2530 data sending interface (CC2530_SendData), CC2530 receiving data interface (CC2530_ReceiveData), setting CC2530 parameter interface (CC2530_set), and reading CC2530 parameter interface (CC2530_get).The first step is to first pull down the nRESET pin level, then set the VREG_EN pin to a high level, and finally restore the nRESET pin level to reset the CC2530. The second step is to trigger the start-up command (SXOSCON) and check the crystal oscillator flag to ensure that the crystal oscillator is indeed in the start-up state. The third step is to further set up its control register. Finally, clear the sending buffer register and the receiving buffer register to prepare for the correct sending and receiving of data. In this way, the initialization process is completed.In this paper, the feasibility of the system is tested with two subjects of vital capacity and body weight. In the experiment, two CC2530 ZigBee modules and one STM32FI03ZWETT6 chip are used for data transmission and processing.


### 4.3. Body Weight and Vital Capacity Test

The weight measurement adopts a resistance strain pressure sensor with a maximum range of 200 kg, which has the characteristics of high precision and simple structure. Equipped with a load-bearing plate and a mounting base, the human body can stand on the load-bearing platform for testing, avoiding the shortcomings of weighing errors caused by changes in the working plane. Its working principle is that the external elastic body will be deformed when weighing, and the resistance strain gauge will also deform, which will affect its resistance and generate a corresponding differential signal. Therefore, in actual measurement, the sensor converts the weight into a voltage signal and then processes the voltage signal after ADC conversion to obtain the weight data. The technical parameters of the sensor are shown in Table2.Table 2
Technical parameters of pressure sensor.
ParameterParameter descriptionParameterParameter descriptionPower supply voltage5-12 VNonlinearity0.2% of full scaleWorking temperature-20-60°CReliability0.2% of full scaleOutput voltage5 mVOutput signalRS485Measuring range0-300 kgStart time<5 s (after power on)The lung capacity sensor uses the XGZP6847 gas pressure sensor for measurement. The strain sensor is a good combination of resistance strain effect and system inertia force principle, which has a good application in the actual test work. The sensor consists of an elastic membrane and four resistors integrated into the membrane. The four piezoresistors form a Wheatstone bridge structure. When pressure is applied to the elastic membrane, the bridge will generate a linear proportional to the applied pressure. The related voltage output signal and its technical parameters are shown in Table3.Table 3
Technical parameters of XGZP6847 gas pressure sensor.
ParameterParameter descriptionParameterParameter descriptionPower supply voltage±12 VNonlinearity0.2% of full scaleWorking temperature-20-60°COverload pressure1.5 times of rated pressureOutput voltage0.1-5 VSupply voltage9-36VDCMeasuring range0-20 kPaStart time<5 s (after power on)The traditional vital capacity tester uses a gas flow sensor to measure the gas flow of the subject to obtain the vital capacity score. In this paper, the XGZP6847 gas pressure sensor is used to collect the breath pressure of the subject. Connect the 4, 5, and 6 pins of the sensor to the J10 interface of CC2530, respectively, and connect to the high level, P06 and GND. After each module is powered on, the two CC2530s will conduct a self-organizing network according to the set software to achieve communication, and STM32 will also establish communication with the PC through the 2.4G wireless communication module. When the subject exhales through the trachea to the sensor input, the voltage value output by the sensor will change. Since the sensor outputs an analog signal, analog-to-digital conversion is required, and the CC2530 itself has ADC analog-to-digital conversion. Select the ADCCON3 register to control the reference voltage and decimation rate of a single conversion channel and store the conversion result, that is, set ADCCOM3 to 0Xb0, which is composed of two registers, ADCH and ADCL, and the conversion result is in the form of two’s complement, and its high two bits are zero, need to be shifted, and ADCL stores the low six bits of the result, and ADCH stores the high eight bits of the result. The channel is selected as AIN0, the reference voltage is selected as 5 V, and the decimation rate is 256. At this time, the CC2530 chip of the wireless sensor node is directly connected to the PC through the serial port. From the data displayed on the PC, it can be known that the sensor has collected the output voltage change caused by the test; the data obtained by the sensor is shown in Figure6.Figure 6
Measurement results of vital capacity of college students.Then, the CC2530 chip transmits the data to the coordinator through the ZigBee module. At this time, the sensor node and the coordinator are, respectively, connected to the PC through the serial port. At this time, the measured data is collected through the sensor. According to the results observed by the port detection tool, the network between the sensor node and the coordinator has been successfully established and can transmit data. On the basis of building the above modules, STM32 and 2.4G wireless communication modules of the main control module are added, and the obtained data are numerically converted in STM32 according to formula (1) to obtain the gas pressure collected during the test:
(1)P¯=1.01n∑measure‐initial.The results displayed on the PC side are shown in Figure7. From the results displayed on the PC side, the server can receive the simply processed data transmitted through the 2.4G wireless communication module. Therefore, the expected results were achieved.Figure 7
Vital capacity data on PC.In the vital capacity test, after the wireless sensor obtains the gas pressure exhaled by the subject, the gas flow rate can be calculated according to the cross-sectional area of the cylinder in the vital capacity meter used in the vital capacity subject, and then, the specific vital capacity value can be obtained according to the test time. Therefore, it shows that this method can be used for the detection of vital capacity.The resistance strain type pressure sensor is adopted for weight subjects. The resistance strain gauge in the sensor has the strain effect of metal; that is, it produces mechanical deformation under the action of external force, so that the resistance value changes accordingly. Resistance strain gauges mainly include metal and semiconductor. Metal strain gauges can be divided into the wire type, foil type, and film type. Semiconductor strain gauge has the advantages of high sensitivity (usually dozens of times of wire type and foil type) and small transverse effect. Other modules are similar to those in the vital capacity test, the data obtained by the sensor is shown in Figure8, and the yellow area is a valid value.Figure 8
Weight measurement results of college students.The numerical conversion formula between output voltage and weight test results is shown in(2)g¯=10n∑measure−1.30.The results displayed on the PC side are shown in Figure9.Figure 9
Weight measurement data on PC.From the results, it is feasible to apply the wireless sensor network technology to the physical fitness test environment, take all kinds of physical fitness tests as wireless sensor nodes, and build a wireless sensor network to transmit the data collected by the physical fitness tester to the server, so as to build a system that can realize stable and unified wireless transmission.


## 4.1. Physical Information Collection Data Center Programming Architecture

First, the programming architecture of the central data center is shown in Figure5. After the client makes a request and connects, the task processor allocates the corresponding ClientEventHandler for transaction processing, and the handler mainly performs data receiving functions. In order to solve the above problems, ACE middleware technology, message distributor technology, and thread pool technology are used in the design and development of the central data center of this system.Figure 5
Programming logic of central data center.The message is transmitted in the form of a byte stream through the TCP/IP protocol in the network. It is very important to know when the transmission of a message ends. Therefore, some necessary record information is transmitted at the beginning of each message. In order to reduce the excessive occupation of byte stream and improve transmission efficiency, the following message structure is designed:Message format{Int TYPE; //The beginning of the messageint ID; //device number{//Circular receiving partlong size; //message length…… //The content of the real message, the length of this part is the same as that specified by size}}All messages must use the above structure. When TYPE is 1, it means that the data sent from the video image is received; when TYPE is 2, it means that the data is received from environmental sensors. The distinction between different sensors is obtained by analyzing the content of the received text information, such as The received is: “humidity: 34.6”, use “:” to divide it, the received is the data sent by the humidity sensor, the value is 34.6; when the TYPE is other values, it means that the data format is wrong. At this time, the error log information should be written in the system.


## 4.2. System Initialization and Driver Implementation

The startup code of ARM7 microprocessor LPC2138 is mainly composed of five parts: startup.s (assembly file), IRQ.s (assembly file), target.e (C file), target.h (header file), and config.h (header file).The serial communication between LPC2138 and CC2530 adopts the interrupt processing mode. When the interrupt service subroutine receives an interrupt, the first thing it needs to do is to find the interrupt type in the interrupt flag register (U0IIR), because it only knows that UART has an interrupt, but cannot judge what type of interrupt it is, and carry out corresponding processing according to the query results. After processing, you need to read U0IIR to clear the interrupt and then exit the interrupt service program. The interrupt vector table is shown in Table1.Table 1
UART interrupt vector table.
U0IIRPriorityInterrupt typeInterrupt sourceInterrupt reset0010ThirdTHRETHREU0IIR read or THR write1100SecondCharacter timeout indicationRXFIFO has at least one character and no character is input or removed in a short timeU0RBR read0100SecondRX data is available or reach the trigger point in FIFO modeU0RBR read or UART0 FIFO reaches the trigger pointRead data from receive buffer register and insert it into receive queue0110FirstRX state errorOE, PE, FE, BIU0LSR readThe wireless communication transceiver chip we choose is CC2530, which is the hardware guarantee of the ZigBee network. The API interface that the ZigBee protocol must exist is provided by the CC2530 driver. The driver of CC2530 contains a total of five interfaces: CC2530 initialization interface (CC2530_init), CC2530 data sending interface (CC2530_SendData), CC2530 receiving data interface (CC2530_ReceiveData), setting CC2530 parameter interface (CC2530_set), and reading CC2530 parameter interface (CC2530_get).The first step is to first pull down the nRESET pin level, then set the VREG_EN pin to a high level, and finally restore the nRESET pin level to reset the CC2530. The second step is to trigger the start-up command (SXOSCON) and check the crystal oscillator flag to ensure that the crystal oscillator is indeed in the start-up state. The third step is to further set up its control register. Finally, clear the sending buffer register and the receiving buffer register to prepare for the correct sending and receiving of data. In this way, the initialization process is completed.In this paper, the feasibility of the system is tested with two subjects of vital capacity and body weight. In the experiment, two CC2530 ZigBee modules and one STM32FI03ZWETT6 chip are used for data transmission and processing.


## 4.3. Body Weight and Vital Capacity Test

The weight measurement adopts a resistance strain pressure sensor with a maximum range of 200 kg, which has the characteristics of high precision and simple structure. Equipped with a load-bearing plate and a mounting base, the human body can stand on the load-bearing platform for testing, avoiding the shortcomings of weighing errors caused by changes in the working plane. Its working principle is that the external elastic body will be deformed when weighing, and the resistance strain gauge will also deform, which will affect its resistance and generate a corresponding differential signal. Therefore, in actual measurement, the sensor converts the weight into a voltage signal and then processes the voltage signal after ADC conversion to obtain the weight data. The technical parameters of the sensor are shown in Table2.Table 2
Technical parameters of pressure sensor.
ParameterParameter descriptionParameterParameter descriptionPower supply voltage5-12 VNonlinearity0.2% of full scaleWorking temperature-20-60°CReliability0.2% of full scaleOutput voltage5 mVOutput signalRS485Measuring range0-300 kgStart time<5 s (after power on)The lung capacity sensor uses the XGZP6847 gas pressure sensor for measurement. The strain sensor is a good combination of resistance strain effect and system inertia force principle, which has a good application in the actual test work. The sensor consists of an elastic membrane and four resistors integrated into the membrane. The four piezoresistors form a Wheatstone bridge structure. When pressure is applied to the elastic membrane, the bridge will generate a linear proportional to the applied pressure. The related voltage output signal and its technical parameters are shown in Table3.Table 3
Technical parameters of XGZP6847 gas pressure sensor.
ParameterParameter descriptionParameterParameter descriptionPower supply voltage±12 VNonlinearity0.2% of full scaleWorking temperature-20-60°COverload pressure1.5 times of rated pressureOutput voltage0.1-5 VSupply voltage9-36VDCMeasuring range0-20 kPaStart time<5 s (after power on)The traditional vital capacity tester uses a gas flow sensor to measure the gas flow of the subject to obtain the vital capacity score. In this paper, the XGZP6847 gas pressure sensor is used to collect the breath pressure of the subject. Connect the 4, 5, and 6 pins of the sensor to the J10 interface of CC2530, respectively, and connect to the high level, P06 and GND. After each module is powered on, the two CC2530s will conduct a self-organizing network according to the set software to achieve communication, and STM32 will also establish communication with the PC through the 2.4G wireless communication module. When the subject exhales through the trachea to the sensor input, the voltage value output by the sensor will change. Since the sensor outputs an analog signal, analog-to-digital conversion is required, and the CC2530 itself has ADC analog-to-digital conversion. Select the ADCCON3 register to control the reference voltage and decimation rate of a single conversion channel and store the conversion result, that is, set ADCCOM3 to 0Xb0, which is composed of two registers, ADCH and ADCL, and the conversion result is in the form of two’s complement, and its high two bits are zero, need to be shifted, and ADCL stores the low six bits of the result, and ADCH stores the high eight bits of the result. The channel is selected as AIN0, the reference voltage is selected as 5 V, and the decimation rate is 256. At this time, the CC2530 chip of the wireless sensor node is directly connected to the PC through the serial port. From the data displayed on the PC, it can be known that the sensor has collected the output voltage change caused by the test; the data obtained by the sensor is shown in Figure6.Figure 6
Measurement results of vital capacity of college students.Then, the CC2530 chip transmits the data to the coordinator through the ZigBee module. At this time, the sensor node and the coordinator are, respectively, connected to the PC through the serial port. At this time, the measured data is collected through the sensor. According to the results observed by the port detection tool, the network between the sensor node and the coordinator has been successfully established and can transmit data. On the basis of building the above modules, STM32 and 2.4G wireless communication modules of the main control module are added, and the obtained data are numerically converted in STM32 according to formula (1) to obtain the gas pressure collected during the test:
(1)P¯=1.01n∑measure‐initial.The results displayed on the PC side are shown in Figure7. From the results displayed on the PC side, the server can receive the simply processed data transmitted through the 2.4G wireless communication module. Therefore, the expected results were achieved.Figure 7
Vital capacity data on PC.In the vital capacity test, after the wireless sensor obtains the gas pressure exhaled by the subject, the gas flow rate can be calculated according to the cross-sectional area of the cylinder in the vital capacity meter used in the vital capacity subject, and then, the specific vital capacity value can be obtained according to the test time. Therefore, it shows that this method can be used for the detection of vital capacity.The resistance strain type pressure sensor is adopted for weight subjects. The resistance strain gauge in the sensor has the strain effect of metal; that is, it produces mechanical deformation under the action of external force, so that the resistance value changes accordingly. Resistance strain gauges mainly include metal and semiconductor. Metal strain gauges can be divided into the wire type, foil type, and film type. Semiconductor strain gauge has the advantages of high sensitivity (usually dozens of times of wire type and foil type) and small transverse effect. Other modules are similar to those in the vital capacity test, the data obtained by the sensor is shown in Figure8, and the yellow area is a valid value.Figure 8
Weight measurement results of college students.The numerical conversion formula between output voltage and weight test results is shown in(2)g¯=10n∑measure−1.30.The results displayed on the PC side are shown in Figure9.Figure 9
Weight measurement data on PC.From the results, it is feasible to apply the wireless sensor network technology to the physical fitness test environment, take all kinds of physical fitness tests as wireless sensor nodes, and build a wireless sensor network to transmit the data collected by the physical fitness tester to the server, so as to build a system that can realize stable and unified wireless transmission.


## 5. Conclusion

This paper first designs the CC2530 driver with LPC2138, then designs the network establishment and the program of wireless sensor node accessing the network. Finally, the overall work of the whole system is described and debugged. In the experimental stage, firstly, the overall framework of the physical fitness test system is analyzed. Then, taking the data acquisition and transmission of vital capacity and weight subjects as an example, the corresponding sensors and chips are selected as hardware. The WSN node program and STM32 control program are developed on the air development platform and mdk5 development platform, respectively, to control the 2.4G wireless communication module to send data to the server. Finally, the detection of vital capacity and body weight is realized. Wireless sensor networks have simple wiring and clear network structure. Sensor nodes are small, easy to deploy, and easy to install and maintain. The introduction of the wireless network into college students’ body measurement information management system improves the system efficiency to a great extent.



---

*Source: 1675258-2021-10-05.xml*