ESP-NOW protocol measure receiver power strength of signal strength
-
- Posts: 2
- Joined: Thu Jan 09, 2020 10:15 pm
ESP-NOW protocol measure receiver power strength of signal strength
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
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:
In the callback function, you can read the RSSI value from the packet header
Phil.
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.
-
- Posts: 1
- Joined: Sat Jun 26, 2021 2:03 pm
Re: ESP-NOW protocol measure receiver power strength of signal strength
See no one replied to your solution but that was very useful to me. Thanks a lot Phil
- mferrarotti
- Posts: 2
- Joined: Tue Sep 07, 2021 4:36 pm
Re: ESP-NOW protocol measure receiver power strength of signal strength
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
I believe I got this working, but need further testing:
https://otroblogdemarcelo.wordpress.com ... l-esp-now/
Any input?
Cheers,
Marcelo from Argentina
- mferrarotti
- Posts: 2
- Joined: Tue Sep 07, 2021 4:36 pm
Re: ESP-NOW protocol measure receiver power strength of signal strength
Hello there, I just got confirmation of this RSSI implementation working, can anyone else test this?
Thanks!
Thanks!
-
- Posts: 4
- Joined: Thu Sep 16, 2021 2:56 pm
Re: ESP-NOW protocol measure receiver power strength of signal strength
How can I get MAC related to RSSI on multiple ESPNOW?
Re: ESP-NOW protocol measure receiver power strength of signal strength
can anyone share a full code
Who is online
Users browsing this forum: No registered users and 65 guests