This project demonstrates how Channel State Information (CSI) from Wi-Fi signals can be used to sense environmental changes.
A Wi-Fi router acts as the transmitter, and an ESP32 acts as the receiver, collecting CSI data in real time.
The variance of CSI values is analyzed to detect changes in the wireless channel, such as movement or interference.
When significant variation is detected, the ESP32 controls an LED via a GPIO pin to indicate the change.
- To extract CSI data from Wi-Fi packets using ESP32.
- To analyze CSI variance for detecting environmental changes.
- To demonstrate real-time physical response using GPIO control (LED).
- To visualize CSI data and behavior through serial or Python script (optional).
Wi-Fi Router (Transmitter) │ ▼ ESP32 Receiver ├── Captures CSI packets ├── Calculates CSI variance ├── Controls LED via GPIO └── Sends data to serial (optional Python visualization)
- ESP32 Development Board
- Wi-Fi Router / Access Point (for packet transmission)
- LED + Resistor (connected to GPIO pin)
- Jumper wires and breadboard
- (Optional) Laptop/PC for real-time data visualization via Python
- The Wi-Fi router periodically transmits packets on a fixed channel.
- The ESP32 receiver captures CSI data for each incoming Wi-Fi packet.
- CSI samples are processed in firmware to calculate variance over time.
- If the variance exceeds a threshold (due to movement or disturbance),
the ESP32 activates the LED. - The LED acts as a physical indicator of CSI variation, representing environmental change.
-
Framework: ESP-IDF
-
Key APIs:
esp_wifi_set_csi_rx_cb()– register CSI receive callbackesp_wifi_set_csi_config()– configure CSI collection parametersesp_wifi_set_csi(true)– enable CSI reporting
-
Processing Steps:
- Connect ESP32 to Wi-Fi network (same as router).
- In the CSI callback, extract CSI amplitude values.
- Compute rolling variance of CSI samples.
- Control LED based on variance threshold.
If visualization is needed:
- The ESP32 sends CSI variance values over serial.
- A Python script reads serial data and plots it in real time using
matplotliborpyqtgraph.
Example output: CSI Variance < threshold → LED OFF CSI Variance > threshold → LED ON
- Start with LED OFF in a stable environment.
- Move your hand or an object between the router and ESP32.
- Observe LED turning ON when CSI variance increases.
- Move away → LED turns OFF as channel stabilizes.
Result:
ESP32 successfully detects environment changes using Wi-Fi CSI data without any external sensors.
- Human motion detection
- Indoor localization
- Wireless sensing for smart environments
- Gesture recognition
- IoT-based anomaly detection
- Implement multi-device CSI collection for spatial awareness.
- Apply machine learning to classify motion or gestures.
- Extend system for real-time visualization dashboards.
- Integrate with cloud platforms for IoT analytics.