Code for ESP32
Go to file
Robert McMahon 8ba4bff040 Add Raspberry Pi 5 monitor mode scripts for RA/TA capture
- Add rpi_monitor_setup.sh: Basic monitor mode setup script
- Add rpi_capture_ra_ta.sh: Bash script for capturing RA/TA addresses
- Add rpi_capture_ra_ta_python.py: Python script using scapy for detailed 802.11 frame parsing
- Add RPI_MONITOR_GUIDE.md: Comprehensive guide for monitor mode setup and usage
- Add RPI_INSTALL_SCAPY.md: Installation instructions for scapy on Raspberry Pi

These scripts help debug WiFi traffic by capturing and displaying Receiver Address (RA) and Transmitter Address (TA) from 802.11 frames, useful for comparing with ESP32 monitor mode captures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-10 16:37:48 -08:00
components Add channel frequency display to monitor status 2026-02-10 10:50:16 -08:00
doc Rename to Wi-Fi Telemetry Capture, add SD card to README 2026-02-07 12:46:31 -08:00
main Add HTTP/serial file transfer, broadcast beacon, SD telemetry 2026-02-07 12:30:04 -08:00
php SD card (SPI + CD), GPS PPS polarity/diagnostics, wiring docs 2026-02-07 11:42:03 -08:00
tools Add HTTP/serial file transfer, broadcast beacon, SD telemetry 2026-02-07 12:30:04 -08:00
.gdbinit collapse detector with gdb support 2025-12-05 17:05:24 -08:00
.gitignore Clean up repository and improve console initialization 2025-12-27 17:56:46 -08:00
BUILD.txt build.txt file 2025-12-16 18:14:40 -08:00
CMakeLists.txt build system and --target all work 2025-12-11 10:34:02 -08:00
README.md README: use absolute Gitea blob URLs for documentation links 2026-02-07 21:54:16 -08:00
RPI_INSTALL_SCAPY.md Add Raspberry Pi 5 monitor mode scripts for RA/TA capture 2026-02-10 16:37:48 -08:00
RPI_MONITOR_GUIDE.md Add Raspberry Pi 5 monitor mode scripts for RA/TA capture 2026-02-10 16:37:48 -08:00
add_license.py update license 2025-12-19 18:13:49 -08:00
async_find_failed.py add asyncio based scripts 2025-12-07 20:57:08 -08:00
control_iperf.py more on scaling 2025-12-15 16:56:14 -08:00
dependencies.lock Move README.md to root and update with comprehensive project documentation 2025-12-27 19:47:20 -08:00
detect_esp32.py fix detect chiptype 2025-11-09 20:15:41 -08:00
esp32_deploy.py Remove deprecated Python scripts and clean up repository 2025-12-27 16:42:09 -08:00
gen_udev_rules.py Remove deprecated Python scripts and clean up repository 2025-12-27 16:42:09 -08:00
identiy_port.py more on builds at scale 2025-12-11 12:25:23 -08:00
leddiff.txt Remove deprecated Python scripts and clean up repository 2025-12-27 16:42:09 -08:00
mass_deploy.sh support scripts 2025-11-11 14:57:56 -08:00
mass_deploy_enhanced.sh support scripts 2025-11-11 14:57:56 -08:00
new_rules.part Remove deprecated Python scripts and clean up repository 2025-12-27 16:42:09 -08:00
parse_csi.py add csi parser 2025-11-21 13:34:56 -08:00
partitions.csv support for both monitor and sta modes, set in NVS using config_device. 2025-12-07 17:29:59 -08:00
partitions_c5.csv more on support for esp32, C5 and S3 2025-12-08 14:43:48 -08:00
partitions_esp32.csv more on support for esp32, C5 and S3 2025-12-08 14:43:48 -08:00
partitions_s3.csv more on support for esp32, C5 and S3 2025-12-08 14:43:48 -08:00
rpi_capture_ra_ta.sh Add Raspberry Pi 5 monitor mode scripts for RA/TA capture 2026-02-10 16:37:48 -08:00
rpi_capture_ra_ta_python.py Add Raspberry Pi 5 monitor mode scripts for RA/TA capture 2026-02-10 16:37:48 -08:00
rpi_monitor_setup.sh Add Raspberry Pi 5 monitor mode scripts for RA/TA capture 2026-02-10 16:37:48 -08:00
sdkconfig.defaults more cmd stuff 2025-12-22 15:00:54 -08:00
sdkconfig.defaults.ampdu Refactor build configs to match new deployment script targets 2025-12-11 10:22:47 -08:00
sdkconfig.defaults.esp32 build system and --target all work 2025-12-11 10:34:02 -08:00
sdkconfig.defaults.esp32c5 SD card (SPI + CD), GPS PPS polarity/diagnostics, wiring docs 2026-02-07 11:42:03 -08:00
sdkconfig.defaults.esp32c5csi Fix naming: Switch from .s3/.c5 to .esp32s3/.esp32c5 2025-12-11 10:24:29 -08:00
sdkconfig.defaults.esp32csi build system and --target all work 2025-12-11 10:34:02 -08:00
sdkconfig.defaults.esp32s3 Fix naming: Switch from .s3/.c5 to .esp32s3/.esp32c5 2025-12-11 10:24:29 -08:00
sdkconfig.defaults.esp32s3csi Fix naming: Switch from .s3/.c5 to .esp32s3/.esp32c5 2025-12-11 10:24:29 -08:00
sdkconfig.defaults.noampdu Refactor build configs to match new deployment script targets 2025-12-11 10:22:47 -08:00
test_devices.sh support scripts 2025-11-11 14:57:56 -08:00

README.md

ESP32 Wi-Fi Telemetry Capture / iPerf Load Generator

High-performance Wi-Fi monitor and iperf 2 based traffic generator firmware for ESP32 devices with interactive console interface, GPS synchronization, and Wi-Fi telemetry capture (MCS, RSSI, frame stats, collapse detection, and more).

Version: 2.1.0 ESP-IDF: 6.0+

Features

  • UDP Traffic Generation: Precise packet pacing (PPS) with drift-free timers
  • Interactive Console: Full REPL interface with command history and tab completion
  • WiFi Management: Station mode with static IP support, DHCP, and monitor mode
  • GPS Synchronization: PPS signal support and NMEA parsing for timestamp synchronization
  • Persistent Configuration: NVS storage for WiFi credentials, IP settings, and iPerf parameters
  • SD Card: Telemetry storage (fiwi-telemetry), HTTP file download (port 8080), serial transfer, broadcast beacon for laptop discovery
  • Status LED: Visual feedback for connection state and system status
  • Mass Deployment: Python scripts for flashing and configuring multiple devices

Supported Targets

  • ESP32
  • ESP32-S3
  • ESP32-C5
  • ESP32-C3, ESP32-C6 (may require testing)

Quick Start

Prerequisites

  • ESP-IDF v6.0 or later
  • Python 3.7+ (for deployment scripts)
  • USB serial connection to ESP32 device

ESP-IDF Setup

Add this function to your ~/.bashrc or ~/.zshrc to activate ESP-IDF v6:

# ESP-IDF v6 activator
get_idf() {
  export IDF_PATH="$HOME/Code/esp32/esp-idf-v6"
  export IDF_PYTHON_ENV_PATH="$HOME/.espressif/python_env/idf6.0_py3.11_env"
  export IDF_TOOLS_PYTHON="$IDF_PYTHON_ENV_PATH/bin/python"
  export PATH="$IDF_PYTHON_ENV_PATH/bin:$PATH"
  export PYTHONNOUSERSITE=1
  . "$IDF_PATH/export.sh"
  hash -r
  echo "ESP-IDF : $(idf.py --version 2>/dev/null)"
  echo "python  : $(python --version)"
  echo "idf.py  : $(command -v idf.py)"
}

After adding the function, reload your shell configuration and run get_idf to activate the ESP-IDF environment.

Building

Note: All idf.py commands require the ESP-IDF environment to be activated first by running get_idf.

# Activate ESP-IDF environment (required before all idf.py commands)
get_idf

# Set target (e.g., esp32c5, esp32s3, esp32)
idf.py set-target esp32c5

# Configure (optional)
idf.py menuconfig

# Build
idf.py build

# Flash and monitor
idf.py -p /dev/ttyUSB0 flash monitor

Initial Configuration

After flashing, connect to the console at 115200 baud. Use the interactive commands:

# Connect to WiFi
wifi connect "YourSSID" "password"

# Set static IP (optional)
ip set 192.168.1.100 255.255.255.0 192.168.1.1

# Configure iPerf parameters
iperf set --client 192.168.1.10 --port 5001 --len 1470 --burst 1

# Save configuration to NVS
iperf save

# Start iPerf traffic
iperf start

# Check status
iperf status

# WiFi telemetry (monitor mode writes to fiwi-telemetry on SD; disconnects WiFi)
monitor start 6
sdcard status
sdcard read fiwi-telemetry

Console Commands

WiFi Commands

  • wifi connect <ssid> [password] - Connect to WiFi network
  • wifi scan - Scan for available networks
  • wifi status - Show WiFi connection status
  • wifi mode <sta|ap> - Set WiFi mode
  • wifi power <dbm> - Set transmit power

IP Configuration

  • ip addr - Show current IP configuration
  • ip set <ip> <mask> <gateway> - Set static IP
  • ip dhcp - Enable DHCP

iPerf Commands

  • iperf start - Start traffic generation
  • iperf stop - Stop traffic generation
  • iperf status - Show current status and statistics
  • iperf set [--client <ip>] [--port <port>] [--len <bytes>] [--burst <count>] - Configure parameters
  • iperf save - Save configuration to NVS
  • iperf reload - Reload configuration from NVS
  • iperf clear - Clear saved configuration

System Commands

  • reset - Software reset
  • version - Show firmware and IDF version
  • system info - Show system information
  • system heap - Show free heap memory

GPS Commands (if GPS enabled)

  • gps status - Show GPS synchronization status

Monitor Mode

  • monitor start [channel] - Start WiFi monitor mode (writes MCS telemetry to fiwi-telemetry on SD every 10s)
  • monitor stop - Stop monitor mode
  • monitor channel <channel> - Set monitor channel
  • monitor status - Show monitor status

SD Card Commands

Telemetry from monitor mode is stored in fiwi-telemetry (NDJSON, appended each flush). Use SD commands to inspect or transfer it.

  • sdcard status - Show CD, mounted, capacity, and fiwi-telemetry file info
  • sdcard list [path] - List files (path optional, default root)
  • sdcard read <file> - Read and print file (e.g. sdcard read fiwi-telemetry)
  • sdcard write <file> <text> - Write text to file
  • sdcard send <file> - Stream file over serial (use tools/sdcard_recv.py)
  • sdcard delete <file> - Delete a file

Example (telemetry capture):

monitor start 6
sdcard status
sdcard list
sdcard read fiwi-telemetry

For detailed command documentation, see Quick Reference.

Mass Deployment

Use the esp32_deploy.py script for deploying to multiple devices:

# Flash and configure multiple devices
python3 esp32_deploy.py \
  --ssid "YourSSID" \
  --password "password" \
  --start-ip 192.168.1.50 \
  --netmask 255.255.255.0 \
  --gateway 192.168.1.1 \
  --iperf-dest-ip 192.168.1.10 \
  --iperf-port 5001

See Deployment Guide for complete deployment instructions.

USB Port Mapping (gen_udev_rules.py)

When deploying to multiple ESP32 devices, Linux assigns /dev/ttyUSB* ports that can change between reboots or when devices are reconnected. The gen_udev_rules.py script creates stable symbolic links (e.g., /dev/esp_port_01, /dev/esp_port_02) based on each device's USB physical topology (ID_PATH), ensuring consistent port identification across system reboots.

Features:

  • Uses ID_PATH for stable device identification (not just port numbers)
  • Creates predictable symlinks: /dev/esp_port_01, /dev/esp_port_02, etc.
  • Supports full scan (generate from scratch) or incremental updates (append new devices)
  • Sorts devices by physical USB topology for consistent ordering

Usage:

# Generate complete rules file from scratch
python3 gen_udev_rules.py --full

# Append only new devices to existing rules (default mode)
python3 gen_udev_rules.py --append

# Dry run to preview changes
python3 gen_udev_rules.py --append --dry-run

After generating rules, install them:

sudo cp 99-esp32-stable.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && sudo udevadm trigger

The deployment script (esp32_deploy.py) can use these stable symlinks when --map-ports is used, or devices can be referenced directly by their esp_port_XX names.

Project Structure

├── main/                  # Main application code
│   ├── main.c            # Entry point and console initialization
│   ├── broadcast_beacon.c/h  # UDP broadcast for laptop discovery
│   └── board_config.h    # Hardware pin definitions
├── components/
│   ├── app_console/      # Console command implementations
│   │   ├── cmd_wifi.c    # WiFi commands (connect, scan, status, mode, power)
│   │   ├── cmd_ip.c      # IP configuration (addr, set, dhcp)
│   │   ├── cmd_iperf.c   # iPerf commands (start, stop, status, set, save, reload, clear)
│   │   ├── cmd_monitor.c # Monitor mode (start, stop, channel, status)
│   │   ├── cmd_sdcard.c  # SD card commands (status, list, read, write, send, delete)
│   │   ├── cmd_gps.c     # GPS commands (status)
│   │   ├── cmd_system.c  # System commands (reset, version, info, heap)
│   │   ├── cmd_ping.c    # Ping command
│   │   └── cmd_nvs.c     # NVS management commands
│   ├── iperf/            # iPerf traffic generator core
│   ├── wifi_controller/  # WiFi management and monitor mode
│   ├── wifi_monitor/     # 802.11 frame capture and collapse detection
│   ├── wifi_cfg/         # WiFi and IP configuration storage
│   ├── gps_sync/         # GPS PPS and NMEA parsing
│   ├── status_led/       # LED status indication
│   ├── sd_card/          # SD card SPI mount and file I/O
│   ├── sdcard_http/      # HTTP server for SD file download (port 8080)
│   ├── mcs_telemetry/    # MCS/RSSI telemetry -> fiwi-telemetry
│   ├── csi_log/          # CSI logging (when CSI enabled)
│   └── csi_manager/      # CSI configuration (when CSI enabled)
├── tools/
│   ├── beacon_listen.py  # Listen for beacons, download fiwi-telemetry
│   └── sdcard_recv.py    # Receive file over serial from device
├── esp32_deploy.py       # Mass deployment script
├── gen_udev_rules.py     # USB port mapping utility
└── doc/                  # Additional documentation

Documentation

License

Copyright (c) 2025 Umber Networks & Robert McMahon All rights reserved.

See individual source files for full license details.

Contributing

This is a project-specific firmware. For issues or feature requests, please contact the maintainers.