## 5 Devices
### The HDC Device  
This device was specifically designed for the HealthTracker project with the goal of building a working prototype of a wearable multi-sensor device able to interact with an app to collect and send information such as movement, breathing patterns, and temperature. In Figure 2, we show how the device is worn (left photo), how it looks from the front (top right photo), and how it looks from the back (bottom right photo).  
The device was designed to comply with two sets of requirements: it had to be able to detect and measure movement, coughing, respiratory rate and depth, tremors and hyperkinesia, sweating, and temperature while also being light, easy to wear on the chest, and water-resistant.  
Concerning the hardware (see Figure 3), the HDC device is based on an IoT node multi-channel communication named B-L475E-IOT01A [18] produced by STMicroelectronics. In particular, the device is composed of two boards connected via the Arduino Header, both housed in a custom-made PA12 case. The main one (master) is the B-L475E-IOT01A IoT node by STMicroelectronics featuring an ARM Cortex-M4-based STM32L4 low-power MCU with a 1 MB Flash memory and a 128 KB SRAM, a 64-Mbit Flash memory, a Bluetooth 4.1 module, 2 microphones, a barometer, a magnetometer (LIS3 MDL), an accelerometer and a gyroscope (LSM6 DSL). The power supply to the integrated ST-link module has been disabled to save power. The other one (slave), also called HealthTracker Shield, is a custom-made board containing two rechargeable Li-ion batteries, which make up the 3.7 v 4000 mAh power supply. The batteries have been sized to guarantee at least 8 h of operation with all sensors turned on. Our tests confirmed this duration of device operability. Other hardware components included in the HDC device are an LED, a magnetic buzzer, a signal conditioning unit, and a humidity and temperature sensor. The LED is used to notify the user about the device's functioning: blinking green LED means the device is up and running, blinking yellow LED means the battery is under 15% of its power capacity, and, finally, blinking red LED means the battery under 5% of its capacity. There is a specific pin in the device where it is possible to obtain the residual battery capacity. The device can be charged wirelessly according to the _Qi standard_ (an interface for wireless power transfer using inductive charging). In particular, HDC is powered by a rechargeable battery with swap architecture in order to be replaced and allow the continuous device to work with two accumulators by putting one in recharging.  
Figure 2: The HDC device. On the **left** how it is worn, while on the **right**, we show the front of the device (figure on the **top right**) and the back of the device (figure on the **bottom right**).  
Concerning the software, we developed the firmware of the HDC device. In particular, we implemented the GATT interface used by the device to send data through a BLE connection. The interface can supply the following information: accelerometer, gyroscope, and magnetometer values for each axis, temperature, humidity, pressure, and battery status. It uses three services, but each of them only has one characteristic and employs bytes instead, using 16 bits for each value and representing the same information on the same range in a more compact though less readable way. For example, the acceleration on the x-axis can be found in the first two bytes of the array received by subscribing to the characteristic 02055000-0000-0000-0001-000000000001 on the service 02055000-0000-0000-0001-0000000000000.  
An example of the real-time data retrieval procedure is shown in Figure 4, where a BLE client, after establishing a connection with the HDC device, subscribes itself to the periodic reception of real-time data.