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