francescopace / espectre
- ΡΡΠ΅Π΄Π°, 10 ΠΈΡΠ½Ρ 2026β―Π³. Π² 00:00:04
π ESPectre π» - Motion detection system based on Wi-Fi spectre analysis (CSI), with Home Assistant integration.
Motion detection system based on Wi-Fi spectre analysis (CSI), with native Home Assistant integration via ESPHome.
Tip
New ML Detector: Neural network-based motion detection. No calibration required, runs on-device. This is an experimental feature, and feedback is welcome in the dedicated ML detector discussion. A snapshot build with the latest changes is also available (use -ml assets for the machine learning based detector), or follow Setup guide for custom configuration.
ESP32-S3 DevKit with external antennas
Setup time: ~10-15 minutes
Difficulty: Easy (YAML configuration only)
Home Assistant dashboard with real-time motion detection, threshold control, and debug sensors
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 device "listens" to these changes and understands if there's movement.
Want to understand the technical details? See ALGORITHMS.md for CSI explanation and signal processing documentation.
Optimal sensor placement is crucial for reliable movement detection.
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 |
Do:
Don't:
ESPectre uses a focused processing pipeline for motion detection:
βββββββββββββββ
β CSI Data β Raw Wi-Fi Channel State Information
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Gain Lock β AGC/FFT stabilization (~3 seconds)
β β Locks hardware gain for stable measurements
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Auto β Automatic subcarrier selection (once at boot)
β Calibration β Selects optimal 12 subcarriers (NBVI)
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Adaptive β auto: P95 Γ 1.1 | min: P100
β Threshold β or fixed manual value
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Hampel β Turbulence outlier removal
β Filter β (enabled by default)
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Low-pass β Noise reduction (smoothing)
β Filter β (optional, disabled by default)
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Detection β MVS or ML score
β Evaluation β every evaluation_interval packets
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Hit Filter β motion_on_hits / motion_off_hits
β β edge-driven IDLE β MOTION
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Home β Edge-driven motion binary +
β Assistant β periodic Movement Score / Threshold
βββββββββββββββ
βββββββββββ βββββββββββ βββββββββββ
β ESP32 β β ESP32 β β ESP32 β
β Room 1 β β Room 2 β β Room 3 β
ββββββ¬βββββ ββββββ¬βββββ ββββββ¬βββββ
β β β
ββββββββββββββ΄βββββββββββββ
β
β ESPHome Native API
βΌ
ββββββββββββββββββββββ
β Home Assistant β
β (Auto-discovery) β
ββββββββββββββββββββββ
Each sensor is automatically discovered by Home Assistant with:
ESPectre implements NBVI (Normalized Band Variance Index) for automatic subcarrier selection, achieving near-optimal performance (F1>96%) with zero manual configuration. The algorithm selects 12 non-consecutive subcarriers based on stability metrics and spectral diversity.
β οΈ IMPORTANT (MVS mode): Keep the room quiet and still for 10 seconds after device boot. The auto-calibration runs during this time and movement will affect detection accuracy. ML mode skips calibration.
For algorithm details, see ALGORITHMS.md.
Q: Do I need programming knowledge to use it?
A: No! ESPectre uses YAML configuration files. Just download the example, flash it, and configure WiFi via the ESPHome app or web interface.
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 an ESP32 device (S3/C6 recommended, other variants also work). Software: All free and open source. You'll also need Home Assistant running somewhere (Raspberry Pi ~β¬35-50, or any existing PC/NAS).
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: 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 Evolution section).
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: 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.
The system collects anonymous data related to the physical characteristics of the Wi-Fi radio channel:
CSI data represents only the properties of the transmission medium and does not contain direct identifying information.
WARNING: Despite the intrinsic anonymity of CSI data, this system can be used for:
The user is solely responsible for using this system and must:
For algorithm details (MVS, NBVI calibration, Hampel filter), see ALGORITHMS.md.
For performance metrics (confusion matrix, F1-score, benchmarks), see PERFORMANCE.md.
This project follows a dual-platform approach to balance innovation speed with production stability:
Target: End users, smart home enthusiasts, Home Assistant users
Target: Researchers, developers, academic/industrial applications
Micro-ESPectre gives you the fundamentals for:
βββββββββββββββββββββββ Validated ββββββββββββββββββββββββ
β Micro-ESPectre β ββββββββββββββββββΊ β ESPectre β
β (R&D Platform) β algorithms β (Production Platform)β
β β β β
β β’ Fast prototyping β β β’ ESPHome component β
β β’ Algorithm testing β β β’ Home Assistant β
β β’ Data analysis β β β’ End-user ready β
β β’ MQTT flexibility β β β’ Native API β
βββββββββββββββββββββββ ββββββββββββββββββββββββ
Innovation cycle: New features and algorithms are first developed and validated in Micro-ESPectre (Python), then ported to ESPectre (C++) once proven effective.
While ESPectre v2.x focuses on motion detection (MVS + automatic subcarrier selection), the project is exploring machine learning capabilities for advanced applications:
| Capability | Status | Description |
|---|---|---|
| ML Detector | Experimental | Neural network (MLP 9β32β16β1) |
| Gesture Recognition | Planned | Detect hand gestures (swipe, push, circle) for smart home control |
| Human Activity Recognition | Planned | Identify activities (sitting, walking, falling) |
| People Counting | Planned | Estimate number of people in a room |
| 3D Localization | Research | Indoor positioning (30-50cm accuracy) via phase-coherent antenna array |
The ML Detector is already available with detection_algorithm: ml in your YAML configuration. For algorithm details, see ALGORITHMS.md and PERFORMANCE.md for current metrics
The ML data collection and training infrastructure is documented in ML_DATA_COLLECTION.md.
See ROADMAP.md for detailed plans, timelines, and how to contribute.
| Document | Description |
|---|---|
| Intro | (This file) Project overview, quick start, FAQ |
| Setup Guide | Installation and configuration with ESPHome |
| Tuning Guide | Parameter tuning for optimal detection |
| Performance | Benchmarks, confusion matrix, F1-score |
| The Game | Browser game, USB streaming API, interactive threshold tuning |
| Test Suite | PlatformIO Unity test documentation |
| Document | Description |
|---|---|
| Intro | R&D platform overview, CLI, MQTT, Web Monitor |
| Algorithms | Scientific documentation of MVS, NBVI calibration, Hampel filter |
| Analysis Tools | CSI analysis and optimization scripts |
| ML Data Collection | Building labeled datasets for machine learning |
| References | Academic papers and research resources |
| Document | Description |
|---|---|
| Roadmap | Project vision and ML plans |
| Contributing | How to contribute (code, data, docs) |
| Changelog | Version history and release notes |
| Security | Security policy and vulnerability reporting |
| Code of Conduct | Community guidelines |
| Articles | Title |
|---|---|
| Medium | How I Turned My Wi-Fi Into a Motion Sensor - Part 1 |
| Medium | How I Turned My Wi-Fi Into a Motion Sensor - Part 2 |
| IoT For All | How I Turned My Wi-Fi Into a Motion Sensor |
| Hackaday | Make Your Own ESP32-Based Person Sensor, No Special Hardware Needed |
| Adafruit Learn | ESPectre Human Detector for Feather |
| Seeed Studio Wiki | Deploying Espectre on Seeed Studio XIAO ESP32 Series with ESPHome |
| Blog | Discussion |
|---|---|
| Home Assistant | ESPectre - Wi-Fi Motion Detection for Home Assistant |
| Videos | Video |
|---|---|
| @GithubAwesome | ESPectre |
| Podcasts | Episode |
|---|---|
| Hackaday | Podcast Episode 355: Person Detectors, Walkie Talkies, Open Smartphones... |
ESPectre leverages the native Wi-Fi CSI capabilities of ESP32 chips. Thanks to Espressif for making CSI accessible in the ESP-IDF framework and for recognizing ESPectre as a community project in their esp-csi repository.
This project is released under the GNU General Public License v3.0 (GPLv3).
GPLv3 ensures that:
See LICENSE for the full license text.
Contributions are submitted under GPLv3 and must include a DCO
Signed-off-by trailer on each commit (git commit -s).
Francesco Pace
Email: francesco.pace@espectre.dev
LinkedIn: linkedin.com/in/francescopace
If you find ESPectre useful and want to support its development, you can buy me a coffee. It's completely optional. I work on this project because I'm passionate about it. Contributions help me buy new hardware to expand the list of tested and supported devices, and dedicate more time to new features.