## 6 Keystroke Recognition
### Experimental Results on Keys' Gap and Count
#### 6.5.2 Effect on Number of Keys Counted  
For the second set of experiments, we obtained a plot of keystroke recognition accuracy changes with the number of keys from which we extracted CSI and used it with the data processing and machine learning framework. We created a plot that perfectly described the relationship between accuracy and test group size, shown in Figure 16. The blue curve shows the trend in accuracy according to the number of keys being tested, and again, results for each test are marked using the red point. We found that the accuracy had a significant inverse correlation with the group size. The overall accuracy for five keys was 83%, which indicated that under the smallest gap distance, even if the tested keys were the same, the system's ability was still reduced by around 5%. There was a massive drop in the accuracy when the group size was between 5 and 12 keys, with 66% for 7 keys, 54% for 9 keys, and another 15% drop for 12 keys (53% to 38%). This circumstance improved after 12 keys, as the accuracy dropped much slower and still achieved 14% for full alphabetic keys.  
This result can be illustrated using spatial resolution. Since the spatial resolution was the same in that case, the shape feature between each adjacent key pair was similar and more challenging to distinguish when we compared two keys far from each other. We initially tested keys \"Q\", \"W\", \"E\", \"A\", and \"S\", and we found that \"W\" had more errors since all other keys were around it, and the features were roughly the same, which provided more uncertainty. For additional keys, such a phenomenon also occurred. When we used 26 keys, each key, except those on the outer area, interacted with others. Thus, it became harder for the machine learning classifier to draw the decision boundary for these keys, making it harder to distinguish classes from each other. In Figures 17 and 18, we present the Voronoi diagram for five- and nine-key keystroke detection derived using the KNN classifier. The \(x\)-axis and \(y\)-axis represent the DWT distance between the first and third components of the shape feature. Figure 17 clearly illustrates that the elements corresponding to each individual key form distinct clusters. This separation makes it straightforward to define decision boundaries between the keys. However, when examining Figure 18, the addition of four more keys to the test group results in a more cluttered diagram. The elements begin to overlap, causing the clusters to blend and making the decision boundaries less distinct and more difficult to define.  
The findings from the spatial resolution tests underscore a key constraint for real-world deployment of CSI-based keystroke detection systems. Specifically, the system's accuracy drops significantly when the average gap between keys approaches or falls below the 5-6 cm range, which is common on standard compact keyboards. This limits the system's effectiveness for realistic typing tasks involving densely packed keys or rapid key transitions. Furthermore, the classifier's reduced performance as the number of detectable  
Figure 16: Accuracy change with number of keyboard keys evaluated.  
keys increases highlights a scalability issue, wherein distinguishing between many adjacent keys becomes infeasible due to overlapping CSI features. These limitations must be considered when applying this technology to scenarios such as password theft prevention, user behaviour analysis, or gesture-based interaction in commercial IoT environments.  
These findings reinforce that spatial resolution and the number of keys significantly impact system performance. The recognition accuracy sharply drops when key spacing is below 6 cm or when the number of keys increases beyond nine, highlighting the limits of WiFi-based keystroke sensing granularity.