# Energy-Efficient and Real-Time Wearable for Wellbeing-Monitoring IoT System Based on SoC-FPGA
## 6 HW/SW Implementation
### Prototype Concept  
To build an operational prototype, besides the PPG and EEG IP cores, it is necessary to develop an additional block that processes raw EEG signals and obtains EEG features. This block, called \"EEG preprocessing\", works as a digital signal processor (DSP) integrated in the PS, for instance. Taking into account that EEG signals are collected by analog sensors, an analog-to-digital converter is also required. Moreover, a connection to the sensors and a connection to a Bluetooth module to support wireless communication must be established.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Processing Stage**} & \multicolumn{2}{c}{SW} & \multicolumn{2}{c}{HW/SW (Speedup)} \\ \cline{2-5}  & 00 & 03 & 00 & 03 \\ \hline Distances calculation & 24,130 & 8593 & 235.4 & 217.9 \\ \cline{2-5} Distances sort & 896.6 & 309.6 & (100) & (41) \\ \hline Classification & 1.67 & 0.51 & 14.67 (0.11) & 4.23 (0.12) \\ \hline Total & 25,028 & 8903.3 & 250.03 (100) & 222.22 (40) \\ \hline \hline \end{tabular}
\end{table}
Table 4: Execution times (us) obtained by software-only and hardware/software implementations of the EEG sub-system.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Processing Stage**} & \multicolumn{2}{c}{SW} & \multicolumn{2}{c}{HW/SW (Speedup)} \\ \cline{2-5}  & 00 & 03 & 00 & 03 \\ \hline Preprocessing & 451 & 99 & 61 (7.4) & 48 (2.1) \\ Periodicity search & 1709 & 340 & 722 (2.4) & 645 (0.53) \\ \hline Total & 2160 & 439 & 783 (2.8) & 693 (0.63) \\ \hline \hline \end{tabular}
\end{table}
Table 3: Execution times (us) obtained by software-only and HW/SW implementations of the PPG sub-system.  
This technology presents low power consumption, being advantageous for transferring reduced data buffers in the proximity of a host computer or mobile phone. Assuming that a user's heart rate is computed each second and their emotional state is assessed every five seconds, it means that, per second, the following are sent:  
* 1 byte representing a 8-bit heart rate value;
* \(\frac{3}{5}\) bytes corresponding to emotion classes of 3 bits.  
In this example, the prototype throughput is 1.6 bytes per second.  
The biometric sensors recommended to be used are the Maxim Integrated MAX3010x (MAX3010x webpage: [[https://www.maximintegrated.com/en/design/technical-documents/userguides-and-manuals/6/6409.html](https://www.maximintegrated.com/en/design/technical-documents/userguides-and-manuals/6/6409.html)]([https://www.maximintegrated.com/en/design/technical-documents/userguides-and-manuals/6/6409.html](https://www.maximintegrated.com/en/design/technical-documents/userguides-and-manuals/6/6409.html)); accessed on 5 January 2023.) and Olimecx's passive EEG electrodes (EEG-PE webpage: [[https://www.olimex.com/Products/EEG/Electrodes/EEG-PE/](https://www.olimex.com/Products/EEG/Electrodes/EEG-PE/)]([https://www.olimex.com/Products/EEG/Electrodes/EEG-PE/](https://www.olimex.com/Products/EEG/Electrodes/EEG-PE/)); accessed on 5 January 2023). MAX3010x is a low-cost pulse oximeter operated by light reflection, thus enabling PPG digital signal acquisition.