ESP-NOW protocol measure receiver power strength of signal strength

stoicLemons
Posts: 2
Joined: Thu Jan 09, 2020 10:15 pm

ESP-NOW protocol measure receiver power strength of signal strength

Postby stoicLemons » Wed Jan 15, 2020 9:27 pm

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?

plajjd
Posts: 54
Joined: Thu Jul 05, 2018 11:47 pm

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

Postby plajjd » Thu Dec 24, 2020 10:24 pm

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.

jacoduplooy
Posts: 1
Joined: Sat Jun 26, 2021 2:03 pm

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

Postby jacoduplooy » Sat Jun 26, 2021 2:07 pm

See no one replied to your solution but that was very useful to me. Thanks a lot Phil

User avatar
mferrarotti
Posts: 2
Joined: Tue Sep 07, 2021 4:36 pm

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

Postby mferrarotti » Tue Sep 07, 2021 4:39 pm

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

User avatar
mferrarotti
Posts: 2
Joined: Tue Sep 07, 2021 4:36 pm

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

Postby mferrarotti » Tue Sep 14, 2021 1:55 pm

Hello there, I just got confirmation of this RSSI implementation working, can anyone else test this?
Thanks!

JeanPinhal
Posts: 4
Joined: Thu Sep 16, 2021 2:56 pm

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

Postby JeanPinhal » Thu Nov 04, 2021 2:32 pm

How can I get MAC related to RSSI on multiple ESPNOW?

ngobduong
Posts: 1
Joined: Mon Apr 22, 2024 3:38 am

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

Postby ngobduong » Mon Apr 22, 2024 3:39 am

can anyone share a full code

Who is online

Users browsing this forum: Baidu [Spider] and 153 guests