Espectre
π ESPectre π» - Motion detection system based on Wi-Fi spectre analysis (CSI), with Home Assistant integration.
Install / Use
/learn @francescopace/EspectreREADME
π ESPectre π»
Motion detection system based on Wi-Fi spectre analysis (CSI), with native Home Assistant integration via ESPHome.
[!TIP] New in v2.5 β ML Detector: Neural network-based motion detection. No calibration required, runs on-device. This is an experimental feature, feedback is welcome in the discussion. A snapshot build with the latest changes is also available (use
-mlassets for the machine learning based detector), or follow Setup guide for custom configuration.
Table of Contents
- In 3 Points
- What You Need
- Quick Start
- How It Works
- What You Can Do With It
- Sensor Placement Guide
- System Architecture
- FAQ
- Security and Privacy
- Technical Deep Dive
- Two-Platform Strategy
- Future Evolution
- Documentation
- Media
- Acknowledgments
- License
- Author
In 3 Points
- What it does: Detects movement using Wi-Fi (no cameras, no microphones)
- What you need: A ~β¬10 ESP32 device (S3 and C6 recommended, other variants supported)
- Setup time: 10-15 minutes
What You Need
Hardware
- 2.4GHz Wi-Fi Router - the one you already have at home works fine
- ESP32 with CSI support - ESP32-C6, ESP32-S3, ESP32-C3, ESP32 (original) or other variants. See SETUP.md for the complete platform comparison table.
ESP32-S3 DevKit with external antennas
Software (All Free)
- Home Assistant (on Raspberry Pi, PC, NAS, or cloud)
- ESPHome (integrated in Home Assistant or standalone)
Required Skills
- Basic YAML knowledge for configuration
- Home Assistant familiarity (optional but recommended)
- NO programming required
- NO router configuration needed
Quick Start
Setup time: ~10-15 minutes
Difficulty: Easy (YAML configuration only)
- Setup & Installation: Follow the complete guide in SETUP.md
- Tuning: Optimize for your environment with TUNING.md
Home Assistant dashboard with real-time motion detection, threshold control, and debug sensors
How It Works
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.
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)
Want to understand the technical details? See ALGORITHMS.md for CSI explanation and signal processing documentation.
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
Do:
- 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
Don't:
- 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 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)
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
βSegmentation β MVS algorithm
β (MVS) β IDLE β MOTION
ββββββββ¬βββββββ
β
βΌ
βββββββββββββββ
β Home β Native ESPHome integration
β Assistant β Binary sensor + Movement/Threshold
βββββββββββββββ
Single or Multiple Sensors
βββββββββββ βββββββββββ βββββββββββ
β 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:
- Binary sensor for motion detection
- Movement score sensor
- Adjustable threshold (number entity)
Automatic Subcarrier Selection
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.
FAQ for Beginners
<details> <summary>Click to expand FAQ</summary>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 pr
