# A Smart Motor Rehabilitation System Based on the Internet of Things and Humanoid Robotics
## 5 Performance Evaluation
### Data Collection Methodology  
The goal of this section is to describe the experimental setup and procedures used, detailing the exercises performed, and the technical aspects of data acquisition, as well as the type of the hardware and the data recorded. Starting from the experimental design, two different exercises were designed to represent the movements:  
* **A**: shoulder flexion; participants are expected to move their arm reaching 180 degrees, as illustrated in Figure 3a. * **B**: shoulder abduction; participants are expected to move their arm reaching 90 degrees, as shown in Figure 3b. Then, given the need to perform the exercises with both arms, they were further divided into two subcategories:  
* **L**: left arm. * **R**: right arm. From this, we derived four specific-side exercises: **AR**, **AL**, **BL**, **BR**. To collect data and ensure that the results could be generalized across individuals, the study involved six volunteers, called \"subjects 1 to 6\" to protect their privacy: two women and four men, aged 25 to 35 and healthy. No particular characteristics of any of them are noteworthy; all subjects were in a comparable physical condition for the purposes of the study. Each participant was instructed by watching an explanatory video with all the methods of performing the exercises, to allow everyone to execute the exercises in the same way and as similarly as possible. Each volunteer spent approximately 10 min on each exercise, for a total of 40 min, to ensure balanced and comparable data collection across individuals. Data were collected using four ESP32 devices, two on each arm (one above and one below the elbow). In particular, the microcontroller, formally designated as ESP32-S3-Touch-LCD-1.28 and visible in Figure 2(a), is a high-performance MCU board developed by Waveshare. It features an onboard 1.28-inch capacitive touch display, a Li-ion battery, and a six-axis sensor, comprising a three-axis accelerometer and a three-axis gyroscope. The device is equipped with a 32-bit Xtensa LX7 dual-core processor, with a maximum main frequency of 240 MHz, and supports both 2.4 GHz Wi-Fi (802.11 b/g/n) and Bluetooth 5 (LE). We collected accelerometer and gyroscope data, representing the movements made by an user during the exercises, with a fixed frequency of 50 Hz. To provide a visual representation of the motion patterns captured by the sensors, Figures 4 and 5 show the raw signals recorded by the ESP32 units, for exercise A performed with the right arm and exercise B performed with the left arm, respectively. A frequency image of the accelerometer and gyroscope data gives some key insights into the patterns and characteristics of the motion, or vibrations, captured by the sensor. Transforming time-domain signals into a frequency-domain representation helps identify dominant frequencies which, in turn, provide guidance to distinguish between different types of movement or detect specific vibration patterns. Indeed, since motion is three-dimensional in space and distributed across all axes, from the figures provided, it seem evident that some axes are more influenced than others. Figure 4 shows how, for the accelerometer sensor, the X and Z axes are most affected, which reflects motion along the corresponding body axes. Similarly, in Figure 5, the most affected axes are Y and Z, which reflects motion along the corresponding body axes, confirming the direction of the movement. During the exercise, participants were asked to wear a smart ring, the COLMI R02, visible in Figure 2(a), which allowed us to monitor their biometric data, including blood oxygen (SpO2) and heart rate (HR). The ring build by COLMI is equipped with heart rate and blood oxygen sensors, capable of transmitting data every 30 s.  
After data collection, the raw values were processed and resampled to create six separate datasets, one for each subject. Since we collect data from four devices, recording two types of signals, and each signal is recorded along three axes (X, Y, Z), we collected 24 features per device.