This research presents a comprehensive study on a novel, low-cost approach to human presence detection using WiFi Received Signal Strength Indicator (RSSI) and machine learning implemented on the ESP32 microcontroller. Traditional presence detection systems typically rely on cameras, passive infrared (PIR) sensors, or ultrasonic detectors, which often raise privacy concerns, require significant power consumption, or have limited detection capabilities. Our proposed method leverages the inherent variations in WiFi signal strength caused by human presence in indoor environments, offering a privacy-preserving and energy-efficient alternative.
The system architecture employs an ESP32 microcontroller running MicroPython for real-time data collection and processing. RSSI values from nearby WiFi access points are continuously monitored and logged to an SD card. Two distinct datasets are collected: one representing an empty room scenario and another with human presence. These datasets are then analyzed using Python-based machine learning tools in a Jupyter Notebook environment, where statistical features (minimum, maximum, mean, and standard deviation of RSSI values) are extracted and used to train a logistic regression classifier.
Experimental results demonstrate that our approach achieves over 95% accuracy in controlled indoor environments, with detection latency between 1-2 seconds. The system's performance is evaluated under various conditions, including different room sizes, multiple access point configurations, and varying human movement patterns. The final implementation includes real-time classification on the ESP32, visual feedback via an OLED display, and auditory alerts through a buzzer. This research contributes to the growing field of contactless sensing and demonstrates the practical viability of RSSI-based presence detection for smart home applications, security systems, and energy management solutions.
Keywords: ESP32, WiFi RSSI, Human Presence Detection, Machine Learning, MicroPython, IoT, Contactless Sensing, Indoor Localization, Smart Environments
The detection of human presence has become a fundamental requirement in various applications ranging from home automation and smart surveillance to cybersecurity and energy management systems. Traditional approaches to presence detection typically employ passive infrared (PIR) sensors, ultrasonic detectors, or camera-based systems. While these methods have proven effective in many scenarios, they present several limitations including privacy concerns (in the case of cameras), high power consumption, and limited detection capabilities in certain environmental conditions.
Recent advancements in wireless signal processing and machine learning have opened new possibilities for human presence detection using existing WiFi infrastructure. The human body, composed primarily of water, interacts with electromagnetic waves in the 2.4GHz and 5GHz bands used by WiFi networks. This interaction causes measurable disturbances in signal propagation characteristics, particularly in the Received Signal Strength Indicator (RSSI), which can be leveraged for presence detection.
This paper presents a comprehensive study on the development and implementation of a WiFi RSSI-based human presence detection system using the ESP32 microcontroller. The ESP32 was selected for this research due to its integrated WiFi capabilities, low power consumption, and cost-effectiveness, making it ideal for IoT applications. The system employs machine learning techniques to analyze RSSI variations and distinguish between occupied and unoccupied states of a room or defined space.
The primary contributions of this work include:
The remainder of this paper is organized as follows: Section 2 reviews related work in the field of RSSI-based sensing and presence detection. Section 3 details the system architecture and methodology. Section 4 presents the experimental results and performance evaluation. Section 5 discusses potential applications and practical considerations. Section 6 outlines the advantages of the proposed approach. Section 7 discusses limitations and future work directions. Finally, Section 8 concludes the paper.
The use of wireless signals for human presence detection and activity recognition has gained significant attention in recent years. This section provides an overview of existing approaches and their limitations, followed by a discussion of WiFi-based sensing techniques.
Traditional presence detection systems can be broadly categorized into three main types:
Vision-based systems: These systems employ cameras and computer vision algorithms to detect human presence. While effective, they raise significant privacy concerns and require substantial computational resources for image processing. Additionally, their performance degrades in low-light conditions and they often require careful positioning to avoid blind spots.
Infrared-based systems: Passive infrared (PIR) sensors detect changes in infrared radiation caused by human body heat. These sensors are widely used in motion-activated lighting systems but have several limitations. They can only detect moving subjects, have a limited field of view, and are sensitive to environmental temperature changes.
Ultrasonic and microwave sensors: These active sensors emit high-frequency sound waves or microwaves and detect reflections from moving objects. While they can detect stationary subjects better than PIR sensors, they consume more power and may interfere with other electronic devices.
The concept of using WiFi signals for sensing applications has emerged as a promising alternative to traditional methods. The foundation of WiFi-based sensing lies in the fact that wireless signals are affected by the environment through which they propagate, including the presence and movement of people.
Early work in this field focused on Channel State Information (CSI)-based approaches, which provide fine-grained information about the wireless channel. However, CSI extraction requires specialized hardware and drivers, making it impractical for many applications. RSSI-based approaches, while less precise than CSI, offer several practical advantages:
Several studies have demonstrated the feasibility of RSSI-based presence detection. For example, [1] showed that human presence causes measurable fluctuations in RSSI values due to signal absorption and multipath effects. [2] developed a threshold-based approach for occupancy detection using commercial WiFi devices. However, these studies often relied on complex signal processing or required multiple access points.
Our work builds upon these foundations while addressing several key challenges:
This section details the system architecture, hardware components, data collection methodology, and machine learning pipeline developed for this research.
The proposed system consists of three main components:
Figure 1: System architecture overview showing data flow from collection to deployment
The hardware platform was carefully selected to balance performance, power efficiency, and cost:
ESP32 Dev Board: The core of the system is an ESP32-WROOM-32D development board, featuring:
Peripheral Components:
Figure 2: Hardware components and connections
The data collection process was designed to capture RSSI variations under different occupancy conditions:
Experimental Setup:
Data Collection Scenarios:
The raw data format includes timestamp, RSSI values for each access point, and ground truth labels:
| Timestamp | AP1_RSSI | AP2_RSSI | Occupancy |
|---|---|---|---|
| 2023-05-15 14:30:01 | -35.2 | -42.1 | 0 |
| 2023-05-15 14:30:02 | -36.8 | -41.5 | 1 |
Raw RSSI values are processed to extract meaningful features for classification:
Preprocessing Steps:
Feature Extraction: For each 10-second window, the following features are calculated:
The feature vector F for classification can be represented as:
where β1 is the slope coefficient from linear regression.
Several classification algorithms were evaluated before selecting logistic regression:
| Algorithm | Accuracy | Memory Usage | Inference Time |
|---|---|---|---|
| Logistic Regression | 95.2% | 2.1KB | 0.8ms |
| Decision Tree | 93.7% | 4.5KB | 1.2ms |
| k-NN (k=3) | 94.1% | 15.2KB | 3.5ms |
| SVM (Linear) | 95.0% | 3.8KB | 1.5ms |
Logistic regression was selected for final implementation due to its optimal balance between accuracy and resource requirements. The decision function is:
where w is the weight vector and b is the bias term learned during training.
The final system was implemented in MicroPython for rapid development and deployment:
Key Software Components:
The main processing loop executes the following steps every second:
The system was evaluated under various conditions to assess its detection accuracy, response time, and reliability.
Using a dataset of 12,000 samples (6,000 per class), the classifier achieved:
| Metric | Value |
|---|---|
| Overall Accuracy | 95.2% |
| Precision (Occupied) | 94.8% |
| Recall (Occupied) | 95.6% |
| F1 Score | 95.2% |
| False Positive Rate | 4.3% |
The following table compares RSSI statistics between empty and occupied scenarios:
| Scenario | Min RSSI | Max RSSI | Mean RSSI | Std Dev | Variation |
|---|---|---|---|---|---|
| Blank Room | -33.4 | -30.0 | -31.93 | 0.46 | 3.4 |
| Person in Room | -37.8 | -30.8 | -33.63 | 0.97 | 7.0 |
Figure 3: Probability distributions of RSSI values for empty vs. occupied scenarios
The system's response time was measured under different conditions:
| Movement Type | Detection Latency | Success Rate |
|---|---|---|
| Walking (1m/s) | 1.2s | 96% |
| Sitting Still | 2.5s | 89% |
| Multiple Persons | 1.0s | 98% |
Power measurements were taken under different operating modes:
| Mode | Current Draw | Estimated Battery Life |
|---|---|---|
| Active Sensing | 85mA | 12 hours |
| Deep Sleep (wake every 10s) | 5mA avg | 7 days |
| Alert Active | 120mA | 8 hours |
The developed system has numerous practical applications across different domains:
The proposed system offers several significant advantages over traditional presence detection methods:
Unlike camera-based systems, the RSSI-based approach doesn't capture any visual or identifiable information about individuals, addressing growing privacy concerns in smart environments.
The total hardware cost is under $15, significantly cheaper than most commercial presence detection systems, making it accessible for widespread deployment.
The ESP32's low-power capabilities enable battery operation for extended periods, with current draw as low as 5µA in deep sleep mode.
WiFi signals can penetrate walls and furniture, allowing detection even when direct line-of-sight isn't available, unlike PIR or camera systems.
The system can be easily integrated with existing smart home platforms and IoT ecosystems through standard communication protocols.
While the proposed system demonstrates promising results, several limitations and opportunities for improvement have been identified:
Several avenues for future research and development have been identified:
Advanced Machine Learning Models:
Multi-Modal Sensing:
System Optimization:
This research has successfully demonstrated the feasibility of implementing a practical, low-cost human presence detection system using WiFi RSSI and machine learning on the ESP32 platform. The developed system achieves over 95% detection accuracy in controlled environments while addressing critical concerns of privacy preservation and energy efficiency that plague traditional approaches.
The comprehensive evaluation presented in this work provides valuable insights into the characteristics of WiFi signal variations caused by human presence and establishes a framework for implementing machine learning on resource-constrained IoT devices. The system's performance metrics, including detection latency, power consumption, and accuracy, suggest strong potential for real-world deployment in various application domains.
Future work will focus on addressing the identified limitations through advanced machine learning techniques, multi-modal sensor fusion, and system optimization. The promising results obtained in this research pave the way for further exploration of wireless signal-based sensing and its applications in smart environments.