## 4 System Implementation and Experimental Results  
### Motion Sensors  
The implemented device, shown in Figure 2, consists of inertial sensors that capture the node's motion with respect to the inertial frame and a microcontroller with Wi-Fi capabilities. Specifically, the device consists of an IMU, a microcontroller and a removable and rechargeable small-size battery. The IMU that was used is a 9 DoF Micro-Electro-Mechanical System (MEMS) IMU. It is the single unit chip MPU-9150, produced by InvenSense Inc. The microcontroller that was used is a low-cost WiFi chip with full TCP/IP stack. It is the ESP8266 and it is produced by Espressif Systems [48]. The purpose of this device is to retrieve and transmit the sensor data through WiFi to a base station. At the base station, the data is processed, stored and visualized. At last, the battery, which was used, is a removable RCR123A Lithium, high current, rechargeable battery that allows for a long-life and easy replacement. Through an Inter Integrated Circuit (I\({}^{2}\)C) protocol [49], the data received from the IMU sensors are used to estimate the orientation of the IMU chip. The ESP8266 microcontroller serves every device that requests data from the sensor node. The fact that HTTP protocol [50] applies large headers, while it also lacks full duplex communication, makes this protocol not suitable for the designed application. Moreover, the time-restrictions and the requirement for transferring a great amount of data from the sensor to the base station, in a request-response messaging protocol, imposed the use of a more appropriate protocol. Thus, a websockets [51] protocol was adopted. This protocol offers a persistent  
Figure 2: The wearable motion sensors. TCP/IP connection, while client and server can exchange packets, avoiding to burden the communication channel with a large volume of irrelevant data. Each sensor node requires a calibration process before the first use. There are 3 sensors in the node and there is a different procedure for each sensor. For the magnetometer we should rotate the sensor multiple times at different directions. We store only the minimum and the maximum value on each axis. Having rotated for a while, we find the offset of each axis by taking the mean value of the maximum and minimum values for that axis. Then, we subtract this offset by the measurements. For the gyroscope, letting the device on a surface for a few seconds can produce the mean value of the sensor, which is supposed to be zero. Thus, we subtract this mean value from each measurement, in order to get the correct angular rotation of the device. The accelerometer calibration needs to lay the sensor with all its faces down. Hence, the gravity vector can be identified on each axis, and the values are saved on the microcontroller. During the experimental sessions, a motion capturing sensor node is mounted on the outer side of the selected upper limb segment with the \(Y\) axis of the sensor being aligned with the longitudinal axis of the segment. The right placement of the sensor is ensured using a special designed fabric case, which is strapped in the circumference of the limb segment. Then, the sensor is switched on and the communication with the base station is established. The objectives are the acquisition, storing and concurrent visualization of the node's IMU measurements during the subject's exercise session. Concurrently, a Shimmer3 sensor node [26] has been aligned with the custom-made sensor, proposed in this work, and both were attached to the human's upper limb segments. A custom-made piece with two sockets was used to successfully align these two sensors. The measurements form Shimmer3 sensor node were captured directly into Matlab(r) using the Shimmer Matlab Instrument Driver. This driver is provided by the corresponding company and establishes the communication with the device via the Bluetooth protocol.