Esp32 csi to rssi

1.5k views Asked by At

I am creating a project on esp32, currently I need to gather information for esp about the distance of the device with wifi from the esp32 modules. I used the project from github to gather information,

https://github.com/StevenMHernandez/ESP32-CSI-Tool.

From this project I uploaded a program for passive listening on the channel.

The collected information shows information such as:

type,role,mac,rssi,rate,sig_mode,mcs,bandwidth,smoothing,not_sounding,aggregation,stbc,fec_coding,sgi,noise_floor,ampdu_cnt,channel,secondary_channel,local_timestamp,ant,sig_len,rx_state,real_time_set,real_timestamp,len,CSI_DATA

This is the data collected by the esp32 which was listening on my wifi channel and which was sent over my phone.

CSI_DATA,PASSIVE,54:72:4F:09:7B:7B,-57,11,1,7,0,1,1,1,0,0,1,-94,1,11,0,2970769,0,82,0,0,3.234535,256,[82 32 5 0 -9 -21 -10 -21 -9 -20 -10 -20 -10 -20 -10 -20 -11 -19 -11 -18 -12 -18 -12 -18 -12 -17 -13 -17 -13 -17 -13 -17 -14 -17 -14 -16 -14 -17 -15 -18 -14 -18 -14 -18 -14 -19 -14 -20 -13 -21 -12 -22 -10 -24 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -4 -31 -2 -31 0 -30 1 -29 1 -28 2 -27 2 -26 2 -25 2 -25 1 -24 1 -24 1 -24 0 -23 -1 -23 -2 -23 -2 -22 -3 -22 -4 -22 -5 -22 -6 -22 -6 -22 -7 -22 -7 -22 -8 -22 -8 -21 -8 -22 ]
CSI_DATA,PASSIVE,54:72:4F:09:7B:7B,-61,9,0,0,0,0,0,0,0,0,0,-94,0,11,0,3340468,0,28,0,0,3.622702,128,[28 -64 1 0 -2 17 -1 17 0 16 0 17 1 16 1 16 2 15 2 16 3 15 3 15 4 15 4 15 5 15 4 15 5 15 6 15 6 15 6 15 6 16 6 16 7 16 6 17 5 17 4 19 2 19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -17 32 -18 30 -20 27 -21 25 -20 23 -19 22 -18 21 -17 20 -17 19 -15 18 -15 17 -14 17 -13 17 -12 17 -11 17 -10 17 -10 17 -8 17 -7 17 -6 18 -6 18 -5 18 -4 18 -4 17 -4 18 -4 18 ]
CSI_DATA,PASSIVE,54:72:4F:09:7B:7B,-68,9,0,0,0,0,0,0,0,0,0,-92,0,11,0,66470508,0,28,0,0,66.710994,128,[28 -64 1 0 -12 -7 -12 -6 -12 -5 -12 -5 -12 -4 -12 -3 -12 -3 -12 -2 -12 -1 -11 0 -12 0 -11 0 -11 1 -11 1 -11 3 -11 3 -11 3 -10 4 -10 5 -10 4 -11 5 -11 4 -12 4 -11 4 -11 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -19 -38 -15 -38 -12 -38 -10 -36 -8 -34 -7 -32 -7 -31 -6 -29 -6 -27 -6 -26 -6 -24 -6 -23 -6 -22 -7 -21 -8 -19 -8 -18 -9 -17 -9 -16 -10 -15 -11 -14 -11 -14 -11 -12 -11 -11 -12 -11 -12 -10 -12 -9 ]
CSI_DATA,PASSIVE,54:72:4F:09:7B:7B,-58,9,0,0,0,0,0,0,0,0,0,-92,0,11,0,93555394,0,28,0,0,93.845638,128,[28 -64 1 0 -13 -19 -13 -19 -13 -18 -14 -18 -14 -17 -14 -17 -14 -17 -14 -16 -14 -15 -14 -15 -15 -14 -15 -14 -15 -14 -15 -14 -15 -14 -16 -13 -16 -14 -16 -14 -15 -14 -15 -15 -16 -15 -15 -16 -14 -17 -13 -18 -12 -19 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -11 -37 -8 -37 -6 -35 -4 -35 -4 -33 -3 -32 -2 -31 -2 -30 -2 -29 -3 -28 -3 -27 -3 -26 -4 -26 -5 -25 -5 -25 -6 -24 -7 -24 -8 -22 -9 -22 -10 -22 -10 -22 -10 -22 -10 -21 -11 -21 -12 -21 -12 -21 ]
CSI_DATA,PASSIVE,54:72:4F:09:7B:7B,-58,9,0,0,0,0,0,0,0,0,0,-92,0,11,0,93571320,0,28,0,0,93.868210,128,[28 -64 1 0 15 14 16 14 16 13 16 12 16 12 16 12 16 11 16 10 16 9 16 9 17 9 17 8 17 8 17 7 17 8 17 8 17 7 17 7 17 8 18 9 17 9 17 10 17 10 16 12 15 13 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 18 31 15 31 13 31 11 31 9 29 9 28 7 27 8 26 7 25 8 24 8 24 8 23 8 22 9 21 11 20 10 19 11 19 11 18 13 18 13 18 14 17 14 17 15 16 15 16 15 16 15 15 ]

I can collect distance information from esp32 using RSSI, the smaller the distance the greater the value. But the RSSI is not very accurate, so the question is, can I read the distance to the device from the CSI_DATA?

1

There are 1 answers

0
ESP_Minatel On

You can take a look at this project from Espressif.

CSI-Tools: https://github.com/espressif/esp-csi/blob/master/examples/console_test/tools/README.md

and

CSI-Example: https://github.com/espressif/esp-csi/tree/master/examples/console_test

For the distance in meter/feet you'll need to calibrate due the different aspects of the antenna.

For the ESP32-S2 and ESP32-C3 you have the ToF (Time of Flight) to calculate the round trip from the device and the router. You can try that if you have those boards.

https://github.com/espressif/esp-idf/tree/master/examples/wifi/ftm (only for S2/C3)