xref: /openwifi/doc/app_notes/radar-self-csi.md (revision 90a961823175e3903613a8254a4efa9dd13da633)
1a4eb2001SXianjun Jiao<!--
2a4eb2001SXianjun JiaoAuthor: Xianjun jiao
3a4eb2001SXianjun JiaoSPDX-FileCopyrightText: 2019 UGent
4a4eb2001SXianjun JiaoSPDX-License-Identifier: AGPL-3.0-or-later
5a4eb2001SXianjun Jiao-->
6a4eb2001SXianjun Jiao
756ab2d85SJiao XianjunOne super power of the openwifi platform is "**Full Duplex**" which means that openwifi baseband can receive its own TX signal. Just like a radar! This brings a unique capability of "**joint radar and communication**" to openwifi. For instance, put two directional antennas to openwifi TX and RX, and the **CSI** (Channel State Information) of the self-TX signal will refect the change of the target object.
8a4eb2001SXianjun Jiao ![](./openwifi-radar.jpg)
9a4eb2001SXianjun Jiao
10a4eb2001SXianjun Jiao## Quick start
11a4eb2001SXianjun Jiao- Power on the SDR board.
12a4eb2001SXianjun Jiao- Connect a computer to the SDR board via Ethernet cable. The computer should have static IP 192.168.10.1. Open a terminal on the computer, and then in the terminal:
13a4eb2001SXianjun Jiao  ```
14a4eb2001SXianjun Jiao  ssh [email protected]
15a4eb2001SXianjun Jiao  (password: openwifi)
16a4eb2001SXianjun Jiao  cd openwifi
17a4eb2001SXianjun Jiao  ./fosdem.sh
18a4eb2001SXianjun Jiao  (After the AP started by above command, you can connect a WiFi client to this openwifi AP)
19a4eb2001SXianjun Jiao  (Or setup other scenario according to your requirement)
20e9d2be2eSJiao Xianjun  ifconfig
21a4eb2001SXianjun Jiao  (Write down the openwifi AP MAC address. For example 66:55:44:33:22:5a)
22a4eb2001SXianjun Jiao  insmod side_ch.ko num_eq_init=0
23a4eb2001SXianjun Jiao  ./side_ch_ctl wh1h4001
24a4eb2001SXianjun Jiao  ./side_ch_ctl wh7h4433225a
25a4eb2001SXianjun Jiao  (Above two commands ensure receiving CSI only from XX:XX:44:33:22:5a. In this case, it is the openwifi self-TX)
26a4eb2001SXianjun Jiao  ./sdrctl dev sdr0 set reg xpu 1 1
27a4eb2001SXianjun Jiao  (Above unmute the baseband self-receiving to receive openwifi own TX signal/packet)
28a4eb2001SXianjun Jiao  ./side_ch_ctl g0
29a4eb2001SXianjun Jiao  ```
30a4eb2001SXianjun Jiao  You should see on board outputs like:
31a4eb2001SXianjun Jiao  ```
32a4eb2001SXianjun Jiao  loop 64 side info count 4
33a4eb2001SXianjun Jiao  loop 128 side info count 5
34a4eb2001SXianjun Jiao  ...
35a4eb2001SXianjun Jiao  ```
36a4eb2001SXianjun Jiao  If the second number (4, 5, ...) keeps increasing, that means the CSI is going to the computer smoothly.
37a4eb2001SXianjun Jiao
38a4eb2001SXianjun Jiao- On your computer (NOT ssh onboard!), run:
39a4eb2001SXianjun Jiao  ```
40a4eb2001SXianjun Jiao  cd openwifi/user_space/side_ch_ctl_src
41a4eb2001SXianjun Jiao  python3 side_info_display.py 0
42a4eb2001SXianjun Jiao  ```
43a4eb2001SXianjun Jiao  The python script needs "matplotlib.pyplot" and "numpy" packages installed. Now you should see figures showing run-time **CSI** and **frequency offset**. Meanwhile the python script prints the **timestamp**.
44a4eb2001SXianjun Jiao  ![](./csi-screen-shot-radar.jpg)
45a4eb2001SXianjun Jiao
4656ab2d85SJiao Xianjun  While running, all CSI data is also stored into a file **side_info.txt**. A matlab script **test_side_info_file_display.m** is offered to help you do CSI analysis offline. In this case, run **test_side_info_file_display(0)** in Matlab.
47a4eb2001SXianjun Jiao  ![](./csi-screen-shot-radar-matlab.jpg)
48a4eb2001SXianjun Jiao
49*90a96182SXianjun Jiao  The following picture is generated by data processing on the captured openwifi CSI while people move in front of two directional antennas (Tx/Rx antenna).
50*90a96182SXianjun Jiao  ![](./sensing.png)
51*90a96182SXianjun Jiao
52a4eb2001SXianjun JiaoPlease learn the python and Matlab script for CSI data structure per packet according to your requirement.
53a4eb2001SXianjun Jiao
54a4eb2001SXianjun JiaoDo read the [normal CSI app note](csi.md) to understand the basic implementation architecture.
55