Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Wi-Fi Channel State Information: A Practical Guide

· 6 min read · Home Networking

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Wi-Fi channel state information (CSI) is the raw, per-subcarrier measurement of how a Wi-Fi signal travels from transmitter to receiver. You can capture it on a laptop with a compatible Wi-Fi card and open-source tools, then analyze the amplitude and phase changes to sense motion, breathing, or gestures. The exact steps depend on your hardware and operating system, but the general workflow is: pick a supported NIC, install the CSI extraction tool, configure the radio, capture data, and process it. Below is a step-by-step guide to get you from zero to a working CSI capture.

What You'll Need

  • A computer running Linux (Ubuntu or Debian recommended) with a Wi-Fi card that supports CSI extraction. Common choices are the Intel 5300 (with modified firmware and the Linux 802.11n CSI Tool), the Atheros AR9580/AR9590 (with Atheros CSI Tool), or the Nexmon CSI patched firmware for Broadcom/Cypress chips (e.g., Raspberry Pi 3B+/4 with Nexmon).
  • The appropriate CSI extraction tool and drivers for your card. For Intel 5300, use the Linux 802.11n CSI Tool; for Atheros, use the Atheros CSI Tool; for Nexmon, use the Nexmon CSI patched firmware and the nexmon_csi utility.
  • A second Wi-Fi device (router or smartphone hotspot) to act as the transmitter. You need a steady stream of packets, so a simple ping flood or iperf UDP stream works well.
  • Basic familiarity with the Linux terminal and compiling software from source.
  • Optional: a second machine to generate traffic, and a Python environment with NumPy/SciPy for analysis.

Step-by-Step

  1. Verify your Wi-Fi card supports CSI. Run lspci or lsusb to identify the chipset. Check the documentation of your chosen CSI tool for a list of supported cards. If your card is not listed, CSI extraction is not possible without hardware changes.
  2. Install the CSI tool and patched driver. Follow the official instructions for your tool. For the Intel 5300 tool, you typically need to install a modified iwlwifi driver and the csi_tool userspace program. For Nexmon, flash the patched firmware to your Raspberry Pi or supported router, then install the nexmon_csi utility. Reboot after installation.
  3. Configure the wireless interface in monitor mode. Use sudo ip link set wlan0 down, then sudo iw wlan0 set monitor control (or monitor depending on your tool) and sudo ip link set wlan0 up. Some tools provide a script to do this automatically. Confirm with iw dev that the interface is in monitor mode.
  4. Set the channel and bandwidth. Lock the interface to the same channel as your transmitter. For example, sudo iw wlan0 set channel 36 80MHz for 5 GHz 80 MHz. Use a channel with low interference. For Nexmon, you may need to set the channel via the utility's configuration file.
  5. Start a packet stream from the transmitter. On a second device connected to the same network, run ping -i 0.01 <receiver_ip> or iperf -u -c <receiver_ip> -b 10M to generate a steady flow of packets. CSI is extracted from received packets, so continuous traffic is essential.
  6. Launch the CSI capture tool. For the Intel 5300 tool, run sudo ./csi_tool log_to_file 1 and then ping from the receiver to the transmitter to trigger CSI logging. For Nexmon, run sudo nexmon_csi -i wlan0 -c <channel> -b <bandwidth> -o output.pcap. The exact command syntax varies; consult your tool's README.
  7. Capture for a fixed duration. Let the capture run for 30–60 seconds while the environment is static, then introduce motion (e.g., walk between the devices) and capture again. Stop the tool with Ctrl+C. You should now have a log file or pcap containing CSI frames.
  8. Parse the CSI data. Use the provided parsing scripts (e.g., read_csi.m for MATLAB or Python equivalents) to extract amplitude and phase per subcarrier. For Nexmon, use nexmon_csi utilities or Python libraries like csiread to read the pcap. Verify that the number of subcarriers matches your expectation (e.g., 30 for Intel 5300, 56 for 20 MHz Nexmon).
  9. Visualize and analyze. Plot amplitude over time for a few subcarriers. You should see fluctuations when motion occurs. Apply a bandpass filter (e.g., 0.1–0.5 Hz for breathing, 0.5–5 Hz for walking) and compute features like variance or Doppler shift. Use Python with Matplotlib and SciPy for quick exploration.
  10. Repeat with controlled variables. Change distance, orientation, or channel and capture again. Keep a log of settings so you can reproduce results. This is the core of any CSI-based sensing experiment.

Common Mistakes

  • Using an unsupported Wi-Fi card. Most built-in laptop cards cannot extract CSI. Check compatibility before buying hardware.
  • Forgetting to generate traffic. CSI is only available from received packets. Without a continuous stream, you get sparse or no data.
  • Mismatched channels. If the receiver is on a different channel than the transmitter, no packets are received. Always lock both to the same channel.
  • Ignoring phase offsets. Raw phase is corrupted by sampling frequency offset and carrier frequency offset. Use the tool's phase sanitization or apply a linear fit to remove the slope.
  • Capturing in a noisy environment. Other Wi-Fi networks on the same channel add interference. Use a quiet channel, preferably in the 5 GHz band.
  • Not rebooting after driver installation. Patched drivers often require a reboot to load correctly.

Tips

  • Use a dedicated router as the transmitter with a fixed channel and disabled power saving.
  • Keep the receiver stationary during captures to avoid self-induced CSI changes.
  • Record timestamps and metadata (channel, bandwidth, distance) alongside your CSI files.
  • Start with a simple amplitude-only analysis before tackling phase.
  • For Nexmon on Raspberry Pi, use a heatsink and stable power supply; CSI capture is CPU-intensive.
  • Check the tool's GitHub issues for known bugs and workarounds.

Troubleshooting

If you see no CSI data, first confirm the interface is in monitor mode and on the correct channel. Check that the transmitter is actually sending packets by running tcpdump on the monitor interface. If packets are present but no CSI, your driver may not be loaded correctly—reinstall and reboot. If the CSI file is empty, ensure the capture tool was started before the traffic stream. If amplitude looks flat, increase the packet rate or move the devices closer. If phase is erratic, apply the phase sanitization steps from your tool's documentation. For Nexmon, verify the firmware version matches the utility. If parsing fails, check the endianness and header format of your capture file.

Frequently Asked Questions

Can I extract CSI from a standard smartphone?

No, smartphones do not expose raw CSI to apps. You need a device with a supported Wi-Fi chipset and patched firmware.

What is the difference between RSSI and CSI?

RSSI is a single received signal strength value per packet. CSI provides amplitude and phase for each OFDM subcarrier, giving much richer information about the channel.

Do I need a license to capture Wi-Fi CSI?

Capturing CSI from your own devices is generally fine, but recording network traffic may be subject to local laws. Only capture on networks you own or have permission to test.

Can I use CSI for presence detection through walls?

Yes, CSI can detect motion through walls, but signal attenuation increases with wall thickness and material. Range and reliability vary widely.

Which tool is easiest for beginners?

Nexmon CSI on a Raspberry Pi is often considered the most accessible because it uses a common, inexpensive device and has good documentation. The Intel 5300 tool requires specific older hardware.

Why does my CSI data have missing subcarriers?

Some subcarriers are null or used for pilot signals. Your parsing tool should account for this; missing subcarriers are normal and can be interpolated.