This tutorial will guide you how to perform CSI measurement using PicoScenes.
- Kernel and PicoScenes Installation
- Install PicoScenes MATLAB Toolbox
- Prepare NICs for CSI Logging
- Prepare PicoScenes Argument Text File
- Perform CSI Measurement using PicoScenes
- Parse .csi Files using PicoScenes MATLAB Toolbox
- Recover Normal Wi-Fi Mode
Step 1:Kernel And PicoScenes Installation
Follow the installation tutorial https://gitlab.com/wifisensing/platform-setup/
Step 2: Install PicoScenes MATLAB Toolbox
Click https://gitlab.com/wifisensing/release/matlab-toolbox-release , then click the Download button (cloud with downward arrow icon), and choose picoscenes-matlab-toolbox.zip. Thus you can extract CSI-Parsing toolbox by decompressing this file.
- Open MATLAB
- Change “Working Directory” to the path where the toolbox is located
- run install2path. If no error occurs, a 3-line message shows telling about how to verify the installation.
Step 3: Prepare NICs for CSI Logging
Assume Step 1 is successful and platform things are installed .
- open a terminal
- run “array_prepare_for_csi_logging all”
If everything goes fine, you will see a status table of all NICs, showing that all NICs are working at 5200MHz with HT20 channel mode.
* If trying to measuring CSI using two separate computers, perform the above steps on both computers.
* array_prepare_for_csi_logging command accepts arguments. See usage information via -h option.
Step 4: Prepare PicoScenes Argument Text File
PicoScenes is a powerful multi-NIC Controlling, frame injection and CSI logging tool. It accepts controlling arguments from command-line, argument text file, and even arguments received from remote client via UDP messages while PicoScenes is running. In this tutorial, the recommended way is the argument text file.
The following argument directs NIC phy0 to switch to 5200MHz and injects 500 packets with 1000us interval using the 1st antenna. The Tx bandwidth is 40MHz and MCS=2. Let’s save the argument into a text file. In this tutorial it is tx.command.
--interface phy0 --mode injector --freq 5200000000 --inj-freq-repeat 500 --inj-bw 40 --inj-mcs 2 --txchainmask 1 --inj-delay 1000
The following argument first changes “local display level” to “detail”, which enables command line output for packet reception events. It then directs NIC phy0 to switch to 5200MHz and log CSI for the injected frames using the first two antennas (rxchainmask code 1/2/4 denotes the 3 antennas respectively). Let’s also save the argument into a text file. In this tutorial it is rx.command.
--local-display-level detail; --interface phy0 --mode logger --freq 5200000000 --rxchainmask 3
Step 5: Perform CSI Measurement using PicoScenes
Case 1: CSI Measurement using Two Computers (Tx and Rx)
- Copy tx.command and rx.command to Tx and Rx computers, respectively.
- In both sides, open a terminal
- To measure CSI, we start the Rx side first. In Rx side, run “sudo PicoScenes -b <path-to-rx.command>“
- When Rx side is ready, we start Tx side. In Tx side, run “sudo PicoScenes -b <path-to-tx.command>“
Case 2: CSI Measurement using One Computer Installed with Multiple NICs
- Merge tx.command and rx.command into one argument text file named txrx.command. Several things should be noted: 1. the merged file begins with rx.command content. 2. Two parts MUST be separated by a simicolon “;” and optionally a newline. 3. NIC phy0 cannot be transmitter and receiver simultaneously, so change Tx or Rx port to another NIC available. The following argument text is an example of txrx.command. In this example, phy0 and phy1 are receiver and transmitter, respectively.
--local-display-level detail; --interface phy0 --mode logger --freq 5200000000 --rxchainmask 3; --interface phy1 --mode injector --freq 5200000000 --inj-freq-repeat 500 --inj-bw 40 --inj-mcs 2 --txchainmask 1 --inj-delay 1000
- run “sudo PicoScenes -b <path-to-txrx.command>“
In Both cases, the packet reception message shall pop 500 times in the command line. That means the injected packets as well as CSI are both received. The logged data are automatically saved into a “.csi” file with name pattern rx_PHYID_DATE_TIME.csi.
Step 6: Parse .csi Files using PicoScenes MATLAB Toolbox
- Open MATLAB
- change “Working Directory” to “~/UserSpaceTools/trinity”, “.csi” files shall appear.
- Double-click a .csi file. After some message about mex compiling, a cell variable with the same name as the .csi file shall appear in Workspace, and that is the parsed CSI data structure.
Step 7: Recover Normal Wi-Fi Mode
Step 3 shutdowns normal Wi-Fi traffic for all compatible NICs. Perform the following commands to recover the normal Wi-Fi functionality:
- open a terminal
- run “Stop_All_Monitor_Interfaces”
- run “Network-Manager_Unmanaged-for-Array”