Detect human presence in a room using only WiFi signals β no cameras, no special sensors, no extra hardware.
This project detects whether a human is present in a room by analyzing fluctuations in WiFi signal patterns β caused by the human body absorbing and reflecting radio frequency signals.
When a person is in a room, their body subtly disturbs the WiFi environment. These disturbances show up as microscopic changes in signal strength (RSSI) and ping latency. This system captures those changes, extracts statistical patterns, and uses Machine Learning to classify them in real time.
Inspired by research systems like MIT WiTrack and Meta WiFi DensePose β but built entirely with consumer hardware and free software.
| Capability | Status |
|---|---|
| Human presence detection (present / absent) | β Working |
| Real-time inference with live terminal dashboard | β Working |
| Auto-labeling via webcam during data collection | β Working |
| GPU-accelerated LSTM training (CUDA) | β Working |
| Through-wall detection | β³ Future (needs CSI hardware) |
| Activity recognition (walking, sitting) | β³ Future |
| Component | Details |
|---|---|
| Laptop | ASUS TUF F15 β GTX 1650, 8GB RAM |
| Router | Any standard home WiFi router |
| Webcam | Built-in laptop webcam (for labeling only) |
| Special sensors | β None |
Zero extra cost. If you have a laptop and a WiFi router, you can run this.
Router ββpingβββΊ Laptop
β
RSSI + Latency
sampled at 2 Hz
β
Sliding window
(last 20 samples)
β
11 statistical features
(std, variance, peaks, ROC...)
β
Random Forest / LSTM
β
"π€ PERSON PRESENT β 91.5%"
The human body is an RF (radio frequency) absorber and reflector. When a person enters a room, WiFi signals bounce differently β causing measurable (but invisible to the naked eye) changes in:
- Latency β how long a ping takes to reach the router
- RSSI β received signal strength
These patterns differ between an occupied and empty room. ML learns these patterns from labeled data and generalizes to new readings.
wifi_detection/
βββ collect.py # Stage 1 β RSSI + latency collection + webcam auto-labeling
βββ features.py # Stage 2 β Sliding window feature extraction
βββ train.py # Stage 3 β Random Forest + LSTM (PyTorch) training
βββ detect.py # Stage 4 β Real-time inference + terminal dashboard
βββ requirements.txt
βββ data/
β βββ raw_samples.csv # Raw collected signal data
β βββ features.csv # Extracted feature windows
βββ models/
βββ rf_model.pkl # Trained Random Forest
βββ lstm_model.pt # Trained LSTM weights
βββ scaler.pkl # Feature normalizer
git clone https://github.com/YOUR_USERNAME/wifi_detection.git
cd wifi_detectionpip install -r requirements.txt# For NVIDIA GPU (recommended)
pip install torch --index-url https://download.pytorch.org/whl/cu121
# CPU only
pip install torchipconfig
# Look for "Default Gateway" β usually 192.168.1.1python collect.py --router 192.168.1.1 --duration 600- Run for at least 10 minutes
- Spend ~5 min in the room (person present) and ~5 min outside (room empty)
- Webcam automatically labels frames using motion detection
- No camera? Use
--no-camflag and label manually
Data saved to data/raw_samples.csv
python features.pyConverts raw signal readings into 11 statistical features using sliding windows.
Output β data/features.csv
python train.pyTrains two models:
- Random Forest β fast, interpretable baseline
- LSTM (PyTorch) β captures temporal patterns, uses GPU if available
Models saved to models/
# Random Forest (recommended for low data)
python detect.py --router 192.168.1.1 --model rf
# LSTM (better with 1000+ training samples)
python detect.py --router 192.168.1.1 --model lstmLive output:
π€ PERSON PRESENT [ββββββββββββββββββββββββββββββ] 91.5% RSSI=82.0% Lat=2.0ms n=0114
π² ROOM EMPTY [ββββββββββββββββββββββββββββββ] 28.2% RSSI=82.0% Lat=1.0ms n=0195
| Feature | Description |
|---|---|
rssi_mean |
Average signal strength in window |
rssi_std |
How much signal fluctuated |
rssi_range |
Max β Min signal value |
rssi_roc |
Rate of change (speed of fluctuation) |
rssi_peak_cnt |
Number of signal spikes |
lat_mean |
Average ping latency |
lat_std |
Latency variance |
lat_max |
Worst latency in window |
lat_roc |
Latency change rate |
lat_peak_cnt |
Number of latency spikes |
rssi_lat_corr |
Correlation between RSSI and latency |
Tested on ASUS TUF F15 with a standard home router:
| Model | Accuracy | Training Data |
|---|---|---|
| Random Forest | ~69% | 668 samples (~10 min) |
| LSTM | ~53% | Needs more data (1000+ samples) |
Accuracy improves significantly with more training data. 30+ minutes of varied movement data can push RF accuracy above 85%.
Top predictive features (Random Forest importance):
lat_std ββββββββββββββββββββ 0.275
lat_mean βββββββββββββββββββ 0.261
lat_roc ββββββββββββββ 0.207
lat_max βββββββββββ 0.157
lat_peak_cnt βββββββ 0.100
Latency features dominate because RSSI stays relatively stable on consumer hardware, while latency shows more sensitivity to human presence.
Real research-grade WiFi sensing (WiTrack, DensePose) uses Channel State Information (CSI) β raw physical layer data with amplitude and phase across multiple frequency subcarriers. Far richer than RSSI.
CSI requires special hardware (Intel 5300 NIC, ESP32 with modified firmware). This project intentionally avoids that to stay zero-cost and fully accessible.
- Collect 2000+ samples and retrain for 85%+ accuracy
- Add CSI support via ESP32 (optional hardware upgrade path)
- Activity recognition: walking vs sitting vs stationary
- Multi-person occupancy counting
- Web dashboard (Flask + React) for visualization
- Integration with smart home systems (Home Assistant, MQTT)
- Paranormal activity detection (EMF anomaly classification)
| Tool | Use |
|---|---|
| Python 3.10+ | Core language |
| OpenCV | Webcam motion-based labeling |
| NumPy / Pandas | Data processing |
| SciPy | Peak detection, signal processing |
| Scikit-learn | Random Forest, preprocessing |
| PyTorch | LSTM model + CUDA training |
Windows netsh |
RSSI extraction |
Windows ping |
Latency measurement |
- Detection is coarse (present/absent), not fine-grained activity recognition
- Consumer RSSI is often stable β model relies mainly on latency variance
- Accuracy varies with room size, router placement, and wall materials
- Through-wall detection not possible without CSI hardware
- Currently Windows only (uses
netshandpingcommands)
- MIT WiTrack β Through-wall Human Tracking
- Meta AI β WiFi-Based Human Pose Estimation
- DensePose From WiFi β CMU / Meta Research Paper
π¨βπ» Author Nishant Singh
π§ Email: ns1199816@gmail.com
π GitHub: https://github.com/nishant1199816
π LinkedIn: https://www.linkedin.com/in/nishant-singh-tech/