| .. | ||
| main | ||
| tools | ||
| CMakeLists.txt | ||
| README.md | ||
| sdkconfig.defaults | ||
ESP Wi-Fi Sensing Demo
This directory contains a self-contained ESP-IDF demo used to exercise the
esp_wifi_sensing component in a realistic bring-up flow.
The example combines:
- Wi-Fi STA connection and sensing FSM startup
- Three monitored channels: the connected AP plus two fixed peer MAC addresses
- A status LED policy for quick visual feedback
- A lightweight serial protocol that can be consumed by the browser-based Web
Serial monitor in
tools/web_serial_monitor.html
The example follows the same public workflow recommended by the component:
- Create the FSM with
esp_wifi_sensing_fsm_create(). - Add the AP channel and two extra peer channels.
- Register ACTIVE / INACTIVE callbacks.
- Start the FSM with
esp_wifi_sensing_fsm_control(..., ESP_WIFI_SENSING_FSM_CTRL_START, NULL). - Optionally keep CSI traffic flowing with
esp_wifi_sensing_fsm_ping_router_start().
Directory Layout
main/app_main.c: example entry point and sensing FSM wiringmain/led_control.*: LED backend and state mappingmain/web_serial_monitor.*: line-oriented serial protocol for diagnostics and runtime tuningtools/web_serial_monitor.html: browser UI for charts, live diagnostics, and configuration
Build and Run
Open the wifi_sensing_demo directory as an ESP-IDF project, then build and
flash it in the usual way:
idf.py set-target <chip>
idf.py flash monitor
The example uses protocol_examples_common for Wi-Fi provisioning, so configure
your Wi-Fi credentials before flashing if your local workflow requires it.
Web Serial Monitor
When CONFIG_ESP_WIFI_SENSING_WEB_SERIAL_ENABLE=y, the firmware emits
line-delimited JSON messages prefixed with HMS: and accepts commands prefixed
with HMSCMD . This allows ordinary ESP logs and structured diagnostics to
share the same serial port.
The browser UI currently focuses on the minimum public diagnostics exported by
the component: jitter_value, smooth_scaled, enter_level_scaled,
exit_level_scaled, state, and init_stage.
The serial monitor also exposes the main runtime controls used by the demo:
HMSCMD HELLOHMSCMD START_STREAMHMSCMD STOP_STREAMHMSCMD FSM_STARTHMSCMD FSM_STOPHMSCMD RESET_BASELINEHMSCMD GET_CFG ALLHMSCMD GET_CFG <peer>HMSCMD GET_RUNTIMEHMSCMD SET_AMPLITUDE_LOG onHMSCMD SET_AMPLITUDE_LOG offHMSCMD SET_CFG <peer> motion_sensitivity=<float> active_jitter_min=<float> active_filter_ms=<ms>
Here <peer> can be either the demo name (AP, MAC_1, MAC_2) or the peer
MAC string.
To use the browser monitor:
- Build and run the firmware.
- Open
tools/web_serial_monitor.htmlin a Chromium-based browser. - Connect to the board through Web Serial.
- Inspect live channel diagnostics or update channel parameters from the page.
If the browser blocks file:// access for Web Serial, serve the directory
locally:
cd tools
python3 -m http.server
Then open http://127.0.0.1:8000/web_serial_monitor.html.
Demo Behavior
- The AP BSSID channel is treated as the primary channel for LED feedback.
- The LED blinks while Wi-Fi is disconnected.
- When the AP channel becomes ACTIVE, the LED turns fully on.
- When the AP channel returns to INACTIVE, the LED fades out.
- The two fixed peer channels remain visible in logs and the browser monitor as extra sensing references.