1. Introduction
Occupancy monitoring (OM) solutions are becoming integral to developing smart control and Internet of Things (IoT) systems. In this field of study, occupancy behavior (OB), including both occupancy presence/absence and occupancy interaction with an environment, are key [
1]. The representation of OB is necessary in the modeling and development of OM methods.
Measuring active occupancy interaction in IoT applications requires a special design and can provide information about the environment, such as behavior and tasks performed by occupants, type of space, date, and time [
2,
3]. To measure or estimate parameters from an environment with a certain occupancy behavior, the resolution of an OM system is usually grouped into three different types of interactions: (1) occupancy status, (2) temporal information, and (3) spatial information, as presented in
Figure 1a. Many hardware (sensing) systems are available in the literature, and they can produce different occupancy resolutions within the taxonomy shown in
Figure 1b, which is based on the quality of sensed data as well as the cost of the OM system. Within them, camera-based systems are exceptionally popular in IoT applications due to their ability to provide high-precision information about occupancy activity in every processed camera frame. Depending on the software deployed and the number of units used in camera-based OM systems, not only can occupancy interaction monitoring be realized, but also the exact location of occupants [
4,
5]. Compared to others, OM systems using cameras offer relatively high data quality in occupancy detections/estimations. However, these systems have some drawbacks, such as higher computational complexity, privacy concerns, high cost, or vision occlusion. PIR and ultrasonic sensors are other electronic sensing devices that are utilized in occupancy estimation models. They provide lower occupancy information and can detect any motion by using infra-red radiation information, which is emitted by the heat energy of objects, and the wavelength of infra-red radiation changes from moving objects [
5]. The ultrasonic sensor-based solutions work based on three physical principles: Time of Flight (TOF), Doppler effect, and attenuation of sound waves [
6]. However, even though PIR and ultrasonic sensors offer a low-cost and easy-to-deploy solution in some related applications (
Figure 1b), they also have drawbacks, such as the possibility of missing occupants who are stationary, narrow sensing cone, low tracking accuracy when the number of occupants in the environment increases, and “False-on” detection errors due to environmental effects such as air turbulence from the HVAC system [
5]. Another sensing methodology that is used for occupancy detection and estimation systems is WIFI technology. WIFI-based systems can be an efficient tool to detect the number and ID of occupants in indoor environments with a high degree of data accuracy (
Figure 1b). However, WIFI-based solutions have limitations, such as the cost of required infrastructure and the likelihood of generating multiple occupancy detection signals for occupants who carry more than one WIFI-powered device (multiple phones, tablets, etc.) [
7,
8].
The most used technology to supply OB in state-of-the-art smart control and IoT systems is Bluetooth low energy (BLE). BLE has gained much attention in these applications because of its low power consumption and cost efficiency. When compared to classical Bluetooth technology, which utilizes multi-advertising channels, a major improvement in BLE includes a fast and energy-efficient neighbor discovery process (NDP) design, which uses only three special advertising channels for neighbor discovery [
9]. Compared to other sensor technologies, BLE devices have significant advantages in terms of size, cost, energy consumption, ease of deployment, and long operating life, which, for some applications, can span several years [
10].
The main sensory readout for BLE devices is the Received Signal Strength Indicator (RSSI). The loss of RSSI signal propagation in space, known as path loss, is utilized in the path-loss distance formula to model the estimated distance between advertising and receiving devices of localization and monitoring systems. However, the RSSI signal depends on the propagation of radio frequency (RF) waves, which are affected by fading, shadowing, and multi-path effects [
11]. Chapre et al. studied the factors that influence RSSI fluctuations/variations, which include antenna direction/type, the distance between transmitter and receiver, measurement time/period, other RF operations nearby, human user presence/absence/mobility, and building types/materials [
12]. Hence, in mobile applications, the received signal strength (RSS) quality of BLE devices is easily impacted by these factors and will likely become attenuated rapidly as the distance between transmitter and receiver increases.
Algorithms for BLE technology-based indoor positioning systems in the literature mainly use indoor localization and fingerprinting methods [
13,
14]. These methods are special positioning solutions that track the position information of people or objects within an indoor environment by using a network of sensing devices. They have been sufficiently studied for the development of BLE-based positioning systems with accuracies between 1 and 3 m. Indoor localization methods offer different levels of positioning accuracy, which are directly affected by RF propagation. They consist of two key approaches: (a) range-based and (b) angle-based. The range-based approach uses a path-loss formula to determine the relationship between RSSI and distance, which is used in indoor localization systems for distance calculation or triangulation. This approach presents a challenge in terms of the ability to define a suitable estimation model because of RF propagation [
11]. Svecko et al. investigated the effects of antenna design (circle and parallel types) on range-based distance estimation. This study found that different types of antenna placements directly affect the quality of distance estimation due to RF propagation [
11]. The angle-based approach can improve localization accuracy by conducting geometric calculations using known beacon nodes and measured angle of arrival (AOA) [
15]. Fingerprinting methods provide better positioning accuracy results than indoor localization methods, and their estimation accuracy relies on the number of beacon nodes deployed in application environments. However, to achieve sufficient localization accuracy, a certain number of source nodes, capturing enough signals, and/or an estimation algorithm with a huge amount of RSSI data are needed [
16].
Contrary to the reported accuracy levels used in positioning systems in the literature, some IoT applications require more precise position estimation in complex and dynamic environments. Even though increasing the number of beacon nodes can be an alternative solution to improve localization accuracy in BLE-based positioning systems, it can trigger discovery latency in communication and can increase the overall system deployment cost. Due to the drawbacks of recent positioning systems, such as inconsistency, low accuracy, high computational cost, higher system cost, or need for prior environmental knowledge, utilizing OM systems with high resolution can be an attractive and efficient solution to localize human occupants in various IoT applications such as health monitoring [
17], HVAC [
18] or smart buildings [
19].
OM systems are developed to utilize information from the environment that falls into one or more of the following three classes: analytical, data-driven, and knowledge-based [
20]. Analytical methods in OM focus on the physical interaction between occupants and the environments. These methods directly utilize information that relates sensed variables from the environment to occupants’ presence/absence [
20]. Data-driven methods for OM systems use ML models that are designed to reveal hidden patterns in sensed data with the purpose of providing occupancy information without the need for an analytical model [
20]. Several data-driven techniques have been developed and used to detect occupants in indoor environments. The data-driven techniques use ML tools such as Artificial Neural Networks (ANNs) [
21], Convolutional Neural Network (CNN) [
22], Long Short-term Memory (LSTM) [
23], Support Vector Machines (SVMs) [
24], and Hidden Markov Models (HMMs) [
25]. Knowledge-based approaches utilize specialized information encoded in production IF-THEN rules to develop OM solutions. Some knowledge-based approaches introduced in the literature include rule, thresholding, and occupancy/environmental knowledge-based [
26].
Even though some solutions for OM problems in the literature are intelligent [
1,
10,
11,
12,
13], they do not combine BLE technology and ML methods, and/or they often require knowledge of the environment in which the system is deployed [
27]. The use of ML models in OM problems can provide more robust accuracy without having to deal with the effects of hardware-related drawbacks. This is because ML models have the ability to model complex signal feature relationships between the environment and the sensing device. Unlike data-driven ML approaches, analytical and knowledge approaches can perform poorly under the aforementioned drawbacks without additional system maintenance or model optimization. Therefore, specific ML models can be utilized to improve the performance of BLE-based OM systems by eliminating the effects of RSSI fluctuation that exist due to RF propagation in BLE technology. Furthermore, because of the ability to extract patterns in preceding data, ML-based models offer the versatility that allows the generalization of OM solutions, which can be easily adapted to new and previously unseen data.
In this paper, an Intelligent Bluetooth Virtual Door (IBVD) system that provides an intelligent OM solution with high-quality OB data using low-cost BLE technology and ML methods is proposed. The IBVD system utilizes long short-term memory (LSTM), Gated recurrent unit (GRU), and hybrid (LSTM+GRU) ML models, all special versions of recurrent neural networks (RNNs). Performance evaluations through comparative studies are conducted for all these models to show the effectiveness of each ML method when integrated into the proposed IBVD system, which is validated for a pilot office application. In terms of occupancy, temporal, and spatial information metrics, the proposed system offers high OM resolution with unique ID tracking, which is utilized in the proposed machine learning (ML) models instead of low OM resolution data such as event counting. The novel and comprehensive OM approach presented here can be deployed to detect the flow of human movement through strategic pathways, such as entrance and exit points of rooms, hallways, and stairs, without any prior knowledge of the indoor environment and/or floor plan and with fewer BLE beacon nodes. It also provides high OM resolution through unique and anonymous device ID tracking that can be easily used for one or multiple occupant cases. Multi-occupant algorithms can be advantageous in complex applications such as health monitoring and smart home/office management.
4. Results and Discussion
In this section, the output results of the three different RNN-based ML models, namely LSTM, GRU, and hybrid, applied to the IBVD system for predicting occupancy indoor/outdoor activities in the proposed pilot room are presented, compared, and discussed. All training processes are implemented on a computer equipped with a GeForce RTX 3080 GPU. MATLAB (Version R2022a) was used to build, train, and test all the presented models.
To provide a better performance evaluation, each learning model is designed using the same architectural structure illustrated in
Figure 4. Each model has the following hyperparameters: Adam optimizer, a learning rate of 0.001, a batch size of 25, a validation frequency of five, and a maximum epoch size of 200, while training and testing by using the same dataset protocol presented in
Table 1. In the RNN architectures, a dropout layer with a similar layer size is also utilized after each RNN layer to reduce overfitting and enhance the generalization ability of models.
In the confusion matrix-based evaluation, overall accuracies and F1 scores are considered the best evaluation metrics to study the classification accuracy of each of the three ML models utilized. It can be seen in
Figure 6 and
Table 2 that all three learning models (trained using the datasets for 48 different scenarios, with five trials for each) have achieved exceptional indoor and outdoor classification performances with over 96% accuracy in tracking a single occupant in the pilot room. As expected, overall accuracies and F1 scores show that the hybrid model gives a slightly better classification performance by comparison to the GRU and LSTM models, as seen in
Table 2. Since the theoretical structure of LSTM networks allows for recalling long-term dependencies, LSTM and hybrid models both show noticeable improvement in prediction performances by comparison to the GRU model when larger datasets are used in training. The hybrid model also provides better generalization performance based on its overall precision, recall, and F1 scores, as seen in
Table 2.
In addition to the confusion matrix, occupancy monitoring delay (OMD) is evaluated as another metric. OMD occurs at transition regions (indoor-to-outdoor and outdoor-to-indoor) as illustrated in
Figure 7. OMD is evaluated since all misclassifications observed from the confusion matrices in
Figure 6 occur at critical transition times, and a delay in the prediction of occupancy levels (indoor and outdoor) can be crucial in a real-time application. When considering the total number of misclassifications from the confusion matrices in
Figure 6 and critical transitions for 48 different scenarios, the OMD performances of three learning models are 1.65 s for GRU, 1.37 s for LSTM, and 1.3 s for the hybrid models. In other words, LSTM and the hybrid models outperform GRU for the OMD metric. The performance of an ML model on the OMD metric depends on the RSSI signal’s data frequency. Hence, it is anticipated that increasing the frequency of the RSSI-measured signal will enhance classification delay in critical transition times as well as for the overall model(s) classification performance.
Figure 8 presents the training and validation loss curves for the GRU, LSTM, and hybrid models. All three models demonstrate stable convergence. The hybrid model shows the lowest final validation loss and the most stable behavior, indicating superior learning efficiency and generalization. The LSTM model also achieves good performance with a slightly higher final loss, while the GRU model converges more slowly and stabilizes at a higher loss value. These trends support the hybrid model’s superior classification performance. However, this comes at the cost of increased computational complexity and resource consumption during training. To prevent overfitting, early stopping was applied using five validation sets for each model. This technique monitored validation performance and halted training when no significant improvement was observed, helping ensure generalization and training efficiency.
In the next evaluation method, k-fold cross-validation is evaluated for all three learning models, which have similar architectural structures and hyperparameters as mentioned above and shown in
Figure 5. This validation method allows the comparison of the learning models in terms of their generalization ability while avoiding overfitting on unseen datasets.
Table 3 clearly shows that the hybrid model performs more consistently in terms of better classification accuracy on the validation and test sets for each of the k-folds used in training sessions, as well as the best overall classification performance accuracy. It is also observed that the average model training times are 6 min for GRU, 6.44 min for LSTM, and 12.17 min for the hybrid models. Therefore, GRU models require fewer computational resources than the LSTM and hybrid models.
Although the current evaluation was conducted in a single-room setting, the system is inherently designed to support deployment across multi-room environments. The sensing mechanism relies on Bluetooth signal strength received by fixed beacons placed at individual doorways, with Faraday shielding used to minimize cross-directional interference. This setup allows each doorway to be instrumented independently, enabling the system to function reliably in a variety of spatial configurations. Moreover, experiments were carried out in the presence of active Bluetooth devices such as smartphones and laptops, which supports the system’s robustness under real-world interference conditions. While the machine learning models were trained on data collected from a specific layout, the signal features used for classification are highly localized. As a result, changes in the surrounding environment are not expected to significantly impact model performance. Future studies will explore deployments in different building layouts to further evaluate the system’s generalizability and scalability.
5. Conclusions
Occupancy monitoring (OM) techniques supply crucial information, such as occupancy number and status, in smart control and IoT systems to improve their application functionalities. Current solutions have limitations and disadvantages, such as the inability to guarantee the privacy of personal data gathered by the IoT-powered device, lack of accessibility, high computation resources needed for deployment, installation difficulties, and/or high overall system cost. In this paper, we propose an IBVD system that implements an OM method using RSSI pattern recognition-based ML algorithms and a BLE-enabled wearable target device with an anonymous ID. To the best of our knowledge, the proposed approach is the first research investigation focusing on the integration of ML algorithms and BLE technologies. The IBVD system is designed for OM in indoor environments without the need for any prior floor plan or environmental knowledge at the time of deployment. Hence, this system can provide a more generic OM solution that can be deployed in different workspaces or indoor environments. The experimental results of all three RNN-based ML models utilized in the IBVD system show that all learning models provide exceptional classification performance compared with other studies reported in the literature. For our collected datasets during the training processes, all three models showed excellent output classification accuracy ranging from 96.6% to 97.3%. When the results of k-fold cross-validation were examined, the hybrid model performed the best in terms of overall accuracy and in classifying data cases not seen during each of the k-fold validation scenarios (above 97% accuracy). Due to the consistent modeling in k-fold validation sessions, it is also postulated that the hybrid model can provide even better classification performance over the other two learning models if a larger dataset were to be used in training. It is also noted that GRU has the fastest training speed because of its simpler structure and fewer model parameters than the other two ML methods.
This study shows that the integration of ML and BLE technologies has the potential to improve existing OM methods while eliminating certain disadvantages of existing commercial solutions. Compared to the state-of-the-art solutions in OM, the proposed IBVD system provides many benefits, including lower hardware cost, ease of deployment, and ease of integration, with the potential to be implemented in many indoor systems to improve their performance. These systems may include HVAC control units, smart offices, smart employee tracking, and home smart systems, among others. In addition to commercial applications, the proposed system can also be exceptionally effective for public safety purposes, such as student tracking systems in schools and health monitoring systems in hospitals. Our next ongoing study is focused on testing the IBVD system in more complex environments, such as multi-room areas or dynamic settings with high occupancy traffic, to evaluate its performance and generalizability under realistic conditions, including obstacles. It also investigates the interference caused by multiple BLE devices operating simultaneously, including scenarios where IBVD systems are present in neighboring rooms in order to validate the IBVD model’s prediction capabilities in environments with signal disruption. Further studies will include the investigation of the performance of the proposed RNN-based ML models using faulty and noisy data obtained from wearables deployed in indoor environments, such as the one considered in this paper. In another potential future study, methods to reduce occupant state classification time delay will be investigated during critical transition times from indoor-to-outdoor and outdoor-to-indoor cases. Another potential avenue for future work will involve conducting real-world experiments to directly compare the performance of the IBVD system with other technologies, such as cameras and WIFI, to provide a more comprehensive evaluation of its effectiveness in practical settings.