xref: /openwifi/doc/app_notes/radar-self-csi.md (revision a47b55e6cafa759d041cd8d309e454edc8a51770)
1<!--
2Author: Xianjun jiao
3SPDX-FileCopyrightText: 2019 UGent
4SPDX-License-Identifier: AGPL-3.0-or-later
5-->
6
7One 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.
8 ![](./openwifi-radar.jpg)
9
10## Quick start
11- Power on the SDR board.
12- 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:
13  ```
14  ssh [email protected]
15  (password: openwifi)
16  cd openwifi
17  ./wgd.sh
18  ./fosdem.sh
19  (After the AP started by above command, you can connect a WiFi client to this openwifi AP)
20  (Or setup other scenario according to your requirement)
21  ifconfig
22  (Write down the openwifi AP MAC address. For example 66:55:44:33:22:5a)
23  insmod side_ch.ko num_eq_init=0
24  ./side_ch_ctl wh1h4001
25  ./side_ch_ctl wh7h4433225a
26  (Above two commands ensure receiving CSI only from XX:XX:44:33:22:5a. In this case, it is the openwifi self-TX)
27  ./sdrctl dev sdr0 set reg xpu 1 1
28  (Above unmute the baseband self-receiving to receive openwifi own TX signal/packet)
29  ./side_ch_ctl g0
30  ```
31  You should see on board outputs like:
32  ```
33  loop 64 side info count 4
34  loop 128 side info count 5
35  ...
36  ```
37  If the second number (4, 5, ...) keeps increasing, that means the CSI is going to the computer smoothly.
38
39- On your computer (NOT ssh onboard!), run:
40  ```
41  cd openwifi/user_space/side_ch_ctl_src
42  python3 side_info_display.py 0
43  ```
44  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**.
45  ![](./csi-screen-shot-radar.jpg)
46
47  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.
48  ![](./csi-screen-shot-radar-matlab.jpg)
49
50  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).
51  ![](./sensing.png)
52
53Please learn the python and Matlab script for CSI data structure per packet according to your requirement.
54
55Do read the [normal CSI app note](csi.md) to understand the basic implementation architecture.
56