Page 1 of 1

ESP-NOW protocol measure receiver power strength of signal strength

Posted: Wed Jan 15, 2020 9:27 pm
by stoicLemons
I would like to measure the RX power or signal strength while using the ESP-NOW protocol and varying the TX power in the code. Would using a spectrum analyzer achieve this?

Re: ESP-NOW protocol measure receiver power strength of signal strength

Posted: Thu Dec 24, 2020 10:24 pm
by plajjd
We also use ESP-NOW protocol and read the signal strength from each received packet. To do so, you have to configure a "promiscuous mode" callback function that will be called when each packet is received. For instance:

Code: Select all

        
        esp_wifi_set_promiscuous(true);
        esp_wifi_set_promiscuous_rx_cb(&promiscuous_rx_cb);

In the callback function, you can read the RSSI value from the packet header

Code: Select all

void promiscuous_rx_cb(void *buf, wifi_promiscuous_pkt_type_t type) {

    // All espnow traffic uses action frames which are a subtype of the mgmnt frames so filter out everything else.
    if (type != WIFI_PKT_MGMT)
        return;

    static const uint8_t ACTION_SUBTYPE = 0xd0;
    static const uint8_t ESPRESSIF_OUI[] = {0x18, 0xfe, 0x34};

    const wifi_promiscuous_pkt_t *ppkt = (wifi_promiscuous_pkt_t *)buf;
    const wifi_ieee80211_packet_t *ipkt = (wifi_ieee80211_packet_t *)ppkt->payload;
    const wifi_ieee80211_mac_hdr_t *hdr = &ipkt->hdr;

    // Only continue processing if this is an action frame containing the Espressif OUI.
    if ((ACTION_SUBTYPE == (hdr->frame_ctrl & 0xFF)) &&
        (memcmp(hdr->oui, ESPRESSIF_OUI, 3) == 0)) {

         int rssi = ppkt->rx_ctrl.rssi;
     }
}

Phil.

Re: ESP-NOW protocol measure receiver power strength of signal strength

Posted: Sat Jun 26, 2021 2:07 pm
by jacoduplooy
See no one replied to your solution but that was very useful to me. Thanks a lot Phil

Re: ESP-NOW protocol measure receiver power strength of signal strength

Posted: Tue Sep 07, 2021 4:39 pm
by mferrarotti
Hello there!

I believe I got this working, but need further testing:

https://otroblogdemarcelo.wordpress.com ... l-esp-now/

Any input?

Cheers,

Marcelo from Argentina

Re: ESP-NOW protocol measure receiver power strength of signal strength

Posted: Tue Sep 14, 2021 1:55 pm
by mferrarotti
Hello there, I just got confirmation of this RSSI implementation working, can anyone else test this?
Thanks!

Re: ESP-NOW protocol measure receiver power strength of signal strength

Posted: Thu Nov 04, 2021 2:32 pm
by JeanPinhal
How can I get MAC related to RSSI on multiple ESPNOW?

Re: ESP-NOW protocol measure receiver power strength of signal strength

Posted: Mon Apr 22, 2024 3:39 am
by ngobduong
can anyone share a full code