Show HN: ESPectre – Motion detection based on Wi-Fi spectre analysis
🛜 ESPectre 👻
Motion detection system based on Wi-Fi spectre analysis (CSI), with Home Assistant integration.
📰 Featured Article: Read the complete story behind ESPectre on Medium 🇮🇹 Italian, 🇬🇧 English
📑 Table of Contents
🎯 In 3 Points
- What it does: Detects movement at home using Wi-Fi (no cameras, no microphones)
- What you need: A ~€10 device (ESP32-S3) + Home Assistant or MQTT server + ESP-IDF development tools
- Setup time: 30-45 minutes (first time, including ESP-IDF setup)
🔬 Mathematical Approach
This project currently does NOT use Machine Learning models. Instead, it employs a mathematical approach that extracts 10 features from CSI (Channel State Information) data using statistical and signal processing techniques.
Key Points
- ✅ No ML training required: Works out-of-the-box with mathematical algorithms
- ✅ 10 extracted features: Statistical, spatial, and temporal features
- ✅ Real-time processing: Low latency detection on ESP32-S3 hardware
- ✅ Foundation for ML: These features can serve as the basis for collecting labeled datasets to train ML models for advanced tasks (people counting, activity recognition, gesture detection)
The mathematical approach provides excellent movement detection without the complexity of ML model training, while the extracted features offer a solid foundation for future ML-based enhancements.
🛒 What You Need
Hardware (Total: ~€10)
- ✅ 2.4GHz Wi-Fi Router (the one you already have at home works fine)
- ✅ ESP32-S3 DevKit bundle with external antennas (~€10) - Available on Amazon, AliExpress, or electronics stores
ESP32-S3 DevKit with external antennas (recommended for better reception)
Software (All Free)
- ✅ MQTT Broker (required for operation):
- Home Assistant with built-in MQTT broker (on Raspberry Pi, PC, NAS, or cloud)
- OR standalone Mosquitto MQTT server (can run on any device, including Raspberry Pi)
- ✅ ESP-IDF v6.1 (development framework for building firmware)
Required Skills
- ✅ Basic command line knowledge required for building and flashing firmware
- ❌ NO router configuration needed
- ✅ Follow the setup guide in SETUP.md
🚀 Quick Start
Setup time: ~30-45 minutes (first time)
Difficulty: Intermediate (requires ESP-IDF setup)
- Setup & Installation: Follow the complete guide in SETUP.md
- Calibration & Tuning: Optimize for your environment with CALIBRATION.md
📖 How It Works (Simple Version)
When someone moves in a room, they "disturb" the Wi-Fi waves traveling between the router and the sensor. It's like when you move your hand in front of a flashlight and see the shadow change.
The ESP32-S3 device "listens" to these changes and understands if there's movement.
Advantages
- ✅ No cameras (total privacy)
- ✅ No wearables needed (no bracelets or sensors to wear)
- ✅ Works through walls (Wi-Fi passes through walls)
- ✅ Very cheap (~€10 total)
📚 Technical Explanation (click to expand)
What is CSI (Channel State Information)?
Channel State Information (CSI) represents the physical characteristics of the wireless communication channel between transmitter and receiver. Unlike simple RSSI (Received Signal Strength Indicator), CSI provides rich, multi-dimensional data about the radio channel.
What CSI Captures
Per-subcarrier information:
- Amplitude: Signal strength for each OFDM subcarrier (up to 64)
- Phase: Phase shift of each subcarrier
- Frequency response: How the channel affects different frequencies
Environmental effects:
- Multipath propagation: Reflections from walls, furniture, objects
- Doppler shifts: Changes caused by movement
- Temporal variations: How the channel evolves over time
- Spatial patterns: Signal distribution across antennas/subcarriers
Why It Works for Movement Detection
When a person moves in an environment, they:
- Alter multipath reflections (new signal paths)
- Change signal amplitude and phase
- Create temporal variations in CSI patterns
- Modify the electromagnetic field structure
These changes are detectable even through walls, enabling privacy-preserving presence detection without cameras, microphones, or wearable devices.
💡 What You Can Do With It
Practical Examples
- 🏠 Home security: Get an alert if someone enters while you're away
- 👴 Elderly care: Monitor activity to detect falls or prolonged inactivity
- 💡 Smart automation: Turn on lights/heating only when someone is present
- ⚡ Energy saving: Automatically turn off devices in empty rooms
- 👶 Child monitoring: Alert if they leave the room during the night
- 🌡️ Climate control: Heat/cool only occupied zones
📍 Where to Place the Sensor
Optimal sensor placement is crucial for reliable movement detection.
Recommended Distance from Router
Optimal range: 3-8 meters
| Distance | Signal | Multipath | Sensitivity | Noise | Recommendation |
|---|---|---|---|---|---|
| < 2m | Too strong | Minimal | Low | Low | ❌ Too close |
| 3-8m | Strong | Good | High | Low | ✅ Optimal |
| > 10-15m | Weak | Variable | Low | High | ❌ Too far |
Placement Tips
✅ Position sensor in the area to monitor (not necessarily in direct line with router)
✅ Height: 1-1.5 meters from ground (desk/table height)
✅ External antenna: Use IPEX connector for better reception
❌ Avoid metal obstacles between router and sensor (refrigerators, metal cabinets)
❌ Avoid corners or enclosed spaces (reduces multipath diversity)
⚙️ System Architecture
Processing Pipeline
ESPectre uses a streamlined processing pipeline:
┌─────────────┐
│ CSI Data │ Raw Wi-Fi Channel State Information
└──────┬──────┘
│
▼
┌─────────────┐
│Segmentation │ Moving Variance Segmentation (MVS)
│ (2-state) │ IDLE ↔ MOTION (operates on RAW CSI)
└──────┬──────┘
│
├─────────────────────┐
│ │
▼ ▼
┌─────────────┐ ┌──────────────┐
│ IDLE │ │ MOTION │
│ (no feat.) │ │ (optional │
│ │ │ features) │
└─────────────┘ └──────┬───────┘
│
▼
┌─────────────┐
│ Filters │ Butterworth, Wavelet,
│ │ Hampel, Savitzky-Golay
│ │ (applied to features only)
└──────┬──────┘
│
▼
┌─────────────┐
│ Features │ 10 mathematical features
│ (if enabled)│ (filtered CSI data)
└──────┬──────┘
│
┌────────────────────┴────────────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ MQTT │ Publish state + metrics │ MQTT │
│ (IDLE) │ │ (MOTION) │
└─────────────┘ └─────────────┘
Key Points:
- 2-state system: IDLE or MOTION (no intermediate states)
- Segmentation-based: Uses Moving Variance Segmentation (MVS) on raw CSI data
- Filters applied to features only: Segmentation uses unfiltered data to preserve motion sensitivity
- Optional features: Feature extraction only during MOTION state (configurable)
Single or Multiple Sensors
┌─────────┐ ┌─────────┐ ┌─────────┐
│ESP32-S3 │ │ESP32-S3 │ │ESP32-S3 │
│ Room 1 │ │ Room 2 │ │ Room 3 │
└────┬────┘ └────┬────┘ └────┬────┘
│ │ │
└────────────┴────────────┘
│
│ MQTT
▼
┌────────────────────┐
│ MQTT Broker │
│ (Home Assistant │
│ built-in or any │
│ MQTT Server) │
└────────┬───────────┘
│
▼
┌────────────────┐
│ Home Assistant │
│ MQTT Sensors │
│ & Automations │
└────────────────┘
Each sensor publishes to its own topic:
home/espectre/kitchenhome/espectre/bedroomhome/espectre/living
Home Assistant can then:
- Monitor each room independently
- Create group sensors for whole-house occupancy
- Implement zone-based automations
- Track movement patterns across rooms
❓ FAQ for Beginners
Click to expand FAQ
Q: Do I need programming knowledge to use it?
A: Basic command line skills are needed to build and flash the firmware using ESP-IDF. Follow the step-by-step guide in SETUP.md.
Q: Does it work with my router?
A: Yes, if your router has 2.4GHz Wi-Fi (virtually all modern routers have it).
Q: How much does it cost in total?
A: Hardware: ~€10 for the ESP32-S3 device. Software: All free and open source. You'll also need a device to run the MQTT broker (Home Assistant or Mosquitto), which can be a Raspberry Pi (~€35-50) or any existing PC/NAS you already have (free).
Q: Do I need to modify anything on the router?
A: No! The router works normally. The sensor "listens" to Wi-Fi signals without modifying anything.
Q: Can I try it without Home Assistant?
A: Yes, you can use any MQTT server (e.g., Mosquitto) or even just view data via serial port.
Q: Does it work through walls?
A: Yes, the 2.4GHz Wi-Fi signal penetrates drywall. Reinforced concrete walls reduce sensitivity but detection remains possible at reduced distances.
Q: How many sensors are needed for a house?
A: It depends on size. One sensor can monitor ~50 m². For larger homes, use multiple sensors (1 sensor every 50-70 m² for optimal coverage).
Q: Can it distinguish between people and pets?
A: The system uses a 2-state segmentation model (IDLE/MOTION) that identifies generic movement without distinguishing between people, pets, or other moving objects. For more sophisticated classification (people vs pets, activity recognition, gesture detection), trained AI/ML models would be required (see Future Evolutions section).
Q: Does it consume a lot of Wi-Fi bandwidth?
A: No, MQTT traffic is minimal. With smart publishing disabled (default), the system publishes all detection updates. When smart publishing is enabled, the system only sends data on significant changes or every 5 seconds as a heartbeat, resulting in ~0.2-0.5 KB/s per sensor during idle periods and up to ~1 KB/s during active movement. Network impact is negligible.
Q: Does it work with mesh Wi-Fi networks?
A: Yes, it works normally. Make sure the ESP32 connects to the 2.4 GHz band.
Q: Is a dedicated server necessary?
A: No, Home Assistant can run on Raspberry Pi, NAS, or cloud. Alternatively, just an MQTT broker (Mosquitto) on any device is sufficient.
Q: How accurate is the detection?
A: Detection accuracy is highly environment-dependent and requires proper tuning. Factors affecting performance include: room layout, wall materials, furniture placement, distance from router (optimal: 3-8m), and interference levels. In optimal conditions with proper tuning, the system provides reliable movement detection. Adjust the segmentation_threshold parameter to tune sensitivity for your specific environment.
Q: What's the power consumption?
A: ~500mW typical during continuous operation. The firmware includes support for power optimization, and deep sleep modes can be implemented for battery-powered deployments, though this would require custom modifications to the code.
Q: If it doesn't work, can I get help?
A: Yes, open an Issue on GitHub or contact me via email.
🔒 Security and Privacy
🔐 Privacy, Security & Ethical Considerations (click to expand)
Nature of Collected Data
The system collects anonymous data related to the physical characteristics of the Wi-Fi radio channel:
- Amplitudes and phases of OFDM subcarriers
- Statistical signal variances
- NOT collected: personal identities, communication contents, images, audio
CSI data represents only the properties of the transmission medium and does not contain direct identifying information.
Privacy Advantages
✅ No cameras: Respect for visual privacy
✅ No microphones: No audio recording
✅ No wearables: Doesn't require wearable devices
✅ Aggregated data: Only statistical metrics, not raw identifying data
⚠️ Disclaimer and Ethical Considerations
WARNING: Despite the intrinsic anonymity of CSI data, this system can be used for:
- Non-consensual monitoring: Detecting presence/movement of people without their explicit consent
- Behavioral profiling: With advanced AI models, inferring daily life patterns
- Domestic privacy violation: Tracking activities inside private homes
Usage Responsibility
The user is solely responsible for using this system and must:
- ✅ Obtain explicit consent from all monitored persons
- ✅ Respect local regulations (GDPR in EU, local privacy laws)
- ✅ Clearly inform about the presence of the sensing system
- ✅ Limit use to legitimate purposes (home security, personal home automation)
- ✅ Protect data with encryption and controlled access
- ❌ DO NOT use for illegal surveillance, stalking, or violation of others' privacy
� Technical Deep Dive
Note: Segmentation operates on raw, unfiltered CSI data to preserve motion sensitivity. Filters are not applied to the turbulence signal used for segmentation.
Advanced filters applied to CSI data before feature extraction (configurable via MQTT):
Filter Pipeline: Raw CSI → Butterworth (high freq) → Wavelet (low freq) → Hampel → Savitzky-Golay → Features
Note: Filters are applied only to feature extraction, not to segmentation. Segmentation uses raw CSI data to preserve motion sensitivity.
When enabled (default: on), extracts 10 mathematical features from filtered CSI data during MOTION state:
Note: Feature extraction can be disabled to reduce CPU usage if only basic motion detection is needed.
ESPectre can optionally extract 10 mathematical features from CSI data during MOTION state:
Statistical properties of the CSI signal distribution:
Characteristics across OFDM subcarriers (frequency domain):
Changes between consecutive CSI packets:
Feature extraction is enabled by default but can be disabled to reduce CPU usage.
Note: Features are only extracted during MOTION state, not during IDLE, to optimize performance.
Moving Variance Segmentation (MVS) analysis: baseline graphs (top) show quiet state, while bottom graphs show motion detection with turbulence signal, adaptive threshold, and state transitions
🔬 Signal Processing Pipeline (click to expand)
Data Flow
1️⃣ CSI Acquisition (ESP32-S3)
2️⃣ Motion Segmentation (ESP32-S3)
3️⃣ Optional Signal Processing Filters (ESP32-S3)
4️⃣ Optional Feature Extraction (ESP32-S3)
5️⃣ MQTT Publishing (ESP32-S3 → Broker)
6️⃣ Home Assistant Integration
movement value (0.0-1.0)📊 Optional Feature Extraction (click to expand)
Extracted Features
Statistical (5 features)
Spatial (3 features)
Temporal (2 features)
Usage
📋 Technical Specifications (click to expand)
Hardware Requirements
Software Requirements
Performance Metrics
Limitations
🤖 Future Evolutions: AI Approach
📚 Machine Learning and Deep Learning (click to expand)
The current implementation uses an advanced mathematical approach with 10 features and multi-criteria detection to identify movement patterns. While this provides excellent results without requiring ML training, scientific research has shown that Machine Learning and Deep Learning techniques can extract even richer information from CSI data for complex tasks like people counting, activity recognition, and gesture detection.
Advanced Applications
1. People Counting
Classification or regression models can estimate the number of people present in an environment by analyzing complex patterns in CSI.
References:
- Wang et al. (2017) - "Device-Free Crowd Counting Using WiFi Channel State Information" - IEEE INFOCOM
- Xi et al. (2016) - "Electronic Frog Eye: Counting Crowd Using WiFi" - IEEE INFOCOM
2. Activity Recognition
Neural networks (CNN, LSTM, Transformer) can classify human activities like walking, falling, sitting, sleeping.
References:
- Wang et al. (2015) - "Understanding and Modeling of WiFi Signal Based Human Activity Recognition" - ACM MobiCom
- Yousefi et al. (2017) - "A Survey on Behavior Recognition Using WiFi Channel State Information" - IEEE Communications Magazine
- Zhang et al. (2019) - "WiFi-Based Indoor Robot Positioning Using Deep Neural Networks" - IEEE Access
3. Localization and Tracking
Deep learning algorithms can estimate position and trajectory of moving people.
References:
- Wang et al. (2016) - "CSI-Based Fingerprinting for Indoor Localization: A Deep Learning Approach" - IEEE Transactions on Vehicular Technology
- Chen et al. (2018) - "WiFi CSI Based Passive Human Activity Recognition Using Attention Based BLSTM" - IEEE Transactions on Mobile Computing
4. Gesture Recognition
Models trained on CSI temporal sequences can recognize hand gestures for touchless control.
References:
- Abdelnasser et al. (2015) - "WiGest: A Ubiquitous WiFi-based Gesture Recognition System" - IEEE INFOCOM
- Jiang et al. (2020) - "Towards Environment Independent Device Free Human Activity Recognition" - ACM MobiCom
Available Public Datasets
- UT-HAR: Human Activity Recognition dataset (University of Texas)
- Widar 3.0: Gesture recognition dataset with CSI
- SignFi: Sign language recognition dataset
- FallDeFi: Fall detection dataset
🛜 Standardized Wi-Fi Sensing (IEEE 802.11bf) (click to expand)
Currently, only a limited number of Wi-Fi chipsets support CSI extraction, which restricts hardware options for Wi-Fi sensing applications. However, the IEEE 802.11bf (Wi-Fi Sensing) standard should significantly improve this situation by making CSI extraction a standardized feature.
IEEE 802.11bf - Wi-Fi Sensing
The 802.11bf standard was officially published on September 26, 2025, introducing Wi-Fi Sensing as a native feature of the Wi-Fi protocol. Main characteristics:
🔹 Native sensing: Detection of movements, gestures, presence, and vital signs
🔹 Interoperability: Standardized support across different vendors
🔹 Optimizations: Specific protocols to reduce overhead and power consumption
🔹 Privacy by design: Privacy protection mechanisms integrated into the standard
🔹 Greater precision: Improvements in temporal and spatial granularity
🔹 Existing infrastructure: Works with already present Wi-Fi infrastructure
Adoption Status (2025)
Market: The Wi-Fi Sensing market is in its early stages and is expected to experience significant growth in the coming years as the 802.11bf standard enables native sensing capabilities in consumer devices.
Hardware availability:
⚠️ Consumer routers: Currently there are no widely available consumer routers with native 802.11bf support- 🏢 Commercial/industrial: Experimental devices and integrated solutions already in use
- 🔧 Hardware requirements: Requires multiple antennas, Wi-Fi 6/6E/7 support, and AI algorithms for signal processing
Expected timeline:
- 2025-2026: First implementations in enterprise and premium smart home devices
- 2027-2028: Diffusion in high-end consumer routers
- 2029+: Mainstream adoption in consumer devices
Future Benefits for Wi-Fi Sensing
When 802.11bf is widely adopted, applications like this project will become:
- More accessible: No need for specialized hardware or modified firmware
- More reliable: Standardization ensures predictable behavior
- More efficient: Protocols optimized for continuous sensing
- More secure: Privacy mechanisms integrated at the standard level
- More powerful: Ability to detect even vital signs (breathing, heartbeat)
Perspective: In the next 3-5 years, routers and consumer devices will natively support Wi-Fi Sensing, making projects like this implementable without specialized hardware or firmware modifications. This will open new possibilities for smart home, elderly care, home security, health monitoring, and advanced IoT applications.
For now: Solutions like this project based on ESP32 CSI API remain the most accessible and economical way to experiment with Wi-Fi Sensing.
📚 References
This project builds upon extensive research in Wi-Fi sensing and CSI-based movement detection. The following academic works and theses provide valuable insights into mathematical signal processing approaches for human activity recognition using Wi-Fi Channel State Information:
-
Wi-Fi Sensing per Human Identification attraverso CSI
University thesis (in Italian) covering CSI data collection for human recognition through Wi-Fi signal analysis, with in-depth exploration of mathematical signal processing methods.
-
Channel State Information (CSI) Features Collection in Wi-Fi
Detailed analysis of CSI feature collection and processing in Wi-Fi environments, with methods for extraction and analysis suitable for mathematical processing.
-
Indoor Motion Detection Using Wi-Fi Channel State Information (2018)
Scientific article describing indoor movement detection using CSI with approaches based on signal mathematics and physics, minimizing the use of machine learning models.
-
WiFi Motion Detection: A Study into Efficacy and Performance (2019)
Study using CSI data collected from standard devices to detect movements, with analysis of signal processing methods to extract movement events without relying on ML.
-
CSI-HC: A WiFi-Based Indoor Complex Human Motion Recognition Using Channel State Information (2020)
Recognition of complex indoor movements through CSI with methods based on mathematical signal features, ideal for projects with signal-based analysis without advanced ML.
-
Location Intelligence System for People Estimation in Indoor Environment During Emergency Operation (2022)
Demonstrates the use of ESP32 with wavelet filtering (Daubechies db4) for people detection in emergency scenarios. This paper directly influenced ESPectre's wavelet filter implementation, showing that wavelet denoising outperforms traditional filters on ESP32 hardware.
These references demonstrate that effective Wi-Fi sensing can be achieved through mathematical and statistical approaches, which is the foundation of ESPectre's design philosophy.
📋 Changelog
For a detailed history of changes, new features, and improvements, see the CHANGELOG.md.
📄 License
This project is released under the GNU General Public License v3.0 (GPLv3).
GPLv3 ensures that:
- ✅ The software remains free and open source
- ✅ Anyone can use, study, modify, and distribute it
- ✅ Modifications must be shared under the same license
- ✅ Protects end-user rights and software freedom
See LICENSE for the full license text.
👤 Author
Francesco Pace
📧 Email: [email protected]
💼 LinkedIn: linkedin.com/in/francescopace
🛜 Project: ESPectre
What's Your Reaction?
Like
0
Dislike
0
Love
0
Funny
0
Angry
0
Sad
0
Wow
0