‹ All articles

Tutorials

ath9k spectral scan: a cheap 2.4/5 GHz spectrum analyzer

Use supported Atheros hardware and Linux debugfs to collect FFT bins. Useful for interference hunting, but not raw I/Q or an SDR audio receiver.

An older Atheros Wi-Fi adapter can be useful even when it cannot hand you raw I/Q. Linux’s ath9k spectral scan exposes FFT-bin magnitudes from supported AR92xx/AR93xx radios. That makes a handy relative spectrum viewer for interference hunting. It does not make an audio receiver, and it is not a calibrated lab analyzer.

What you’ll need

Some links may earn the show a small commission at no cost to you, which helps pay for airtime. No affiliate purchase links are included in this draft.

  • A spare Linux machine with a supported Atheros AR92xx/AR93xx-family adapter and a kernel exposing its spectral feature. Chipset, bus and driver support matter more than the name on the case.
  • Kernel options ATH9K_COMMON_SPECTRAL and ATH9K_DEBUGFS and/or ATH9K_HTC_DEBUGFS, as appropriate, plus mounted debugfs.
  • The iw tool, administrative access for this limited debugfs operation, and a supported FFT viewer such as FFT_eval for HT20 data.
  • A separate way to stay online: scans can disrupt the test adapter’s connection.

Step 1: Identify the real interface and driver

iw dev
lspci -nnk
lsusb
mountpoint /sys/kernel/debug

Match the wireless interface to its physical radio. The examples below use wlan0 and phy0; substitute the actual pair from iw dev. Do not scan a remote machine’s only management link. A 2.4-only card does not acquire 5 GHz support through this feature, and channel availability still follows the hardware and US regulatory settings.

If debugfs is not mounted and your lab machine permits it, mount it explicitly. Keep its default restricted permissions; do not expose the entire debug filesystem to ordinary users or a network service.

sudo mount -t debugfs debugfs /sys/kernel/debug

If it is already mounted, skip that command. If the spectral files are absent, check kernel configuration and the adapter’s actual driver. A compatible-looking Wi-Fi brand is not enough. USB ath9k_htc devices may expose a different debugfs subdirectory; use the documented path present for your driver rather than inventing one.

Step 2: Capture one channel scan

The kernel documentation gives this sequence for the ath9k directory. Confirm both paths exist first. Using sudo tee matters: sudo echo ... > file leaves the redirection in your unprivileged shell.

echo chanscan | sudo tee /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan_ctl
sudo iw dev wlan0 scan
sudo cat /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan0 > samples.tlv
echo disable | sudo tee /sys/kernel/debug/ieee80211/phy0/ath9k/spectral_scan_ctl

The scan output is binary TLV data, not text and not cs16 samples. Save it to a file rather than dumping it into a terminal. Run the final disable command even if the scan or capture fails. If the reader remains waiting after the scan should have finished, disable scanning from another terminal, then interrupt the reader and treat the capture as incomplete.

Step 3: View the FFT data

Use a tool listed by the kernel documentation, such as FFT_eval, ath_spectral or speccy. Follow that tool’s current build and input instructions rather than passing the file to an SDR audio source. FFT_eval is listed as HT20 only; pick an appropriate decoder for HT40. Record the channel width, adapter, driver and kernel version alongside the file.

The documented bin counts are 56 for HT20 and 128 for HT40. Compare relative energy and shape across captures. Noise-floor and RSSI assumptions affect derived power, so do not label a graph as accurate dBm without calibration. Channel scans visit channels at different times: a plotted span is not a simultaneous view of the whole band.

Step 4: A useful interference experiment

What this is not

FFT magnitudes omit the phase/time-domain information required to reconstruct an arbitrary signal. You cannot recover FM or SSB audio by feeding samples.tlv into gqrx, and you cannot turn it into raw I/Q by renaming the file. For actual complex samples from a Wi-Fi stick, see the MediaTek receive-only comparison. For an inexpensive microcontroller experiment, start with ESP-SDR in a browser.

Also, this is not necessarily a strictly passive procedure: iw ... scan can issue ordinary Wi-Fi probe requests where permitted. This tutorial does not enable custom RF transmission or packet injection. Respect the configured US regulatory domain and use only devices/networks you are authorized to test.

Troubleshooting and cleanup

Sources checked Nov 5, 2026: Linux Wireless ath9k spectral-scan documentation · FFT_eval.

This tutorial accompanies the Nov 7, 2026 episode of Echos in the Ether on WRMI with Chris, KD0CQ. These are project-documentation-based instructions, not a claim that I have bench-tested every board or measured its emissions. 73!

More to read