Extending ESP NOW range by setting a slower data rate
-
I'm a DIY'er and have purchased several T-Display, T-Display-S3 and TQT devices to play with. None have external antennas (yet) which I know might also solve my problem. I'd rather not try adding external antennas since I thin they will be too frajile.
I have a pair of TTGO T-Displays set up using ESP NOW as a Sensor to Remote display in my home. It works fine within say 50 feet... But I'm right on the limit of the range I need to get from the Home Theater system / or Den area, and the garage where the Sensor is located and sending from .. so, it drops sending data intermittently.
I'm aware the esp_wifi_set_protocol() function is available in the ESP-IDF, but I don't have this IDF, and the option does not appear to be exposed directly by the Arduino WiFi library using Arduino IDE 2.10.
I think need to use esp_wifi_set_protocol() (or some other alternative method I'm un aware of to change the data rate within in an Arduino 2.10 sketch, but when I try, the Arduino 2.10 IDE always gives me compile errors.
Is there and easy way to extend the ESP NOW range by setting a slower 1Mbit vs the default 54Mbit 802.11n data rate from within an Arduino IDE 2.10 sketch?
-
@jims123
I'm using the Arduino framework, but I initialize ESP-NOW using the IDF function. I include in the project library:
#include <esp_now.h>
#include <esp_wifi.h>I initialize the WiFi interface like this:
wifi_init();
if (esp_now_init() != ESP_OK) {
Serial.println("Error initializing ESP-NOW");
return;
}static void wifi_init()
{
ESP_ERROR_CHECK(esp_netif_init());
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_protocol( WIFI_IF_STA, WIFI_PROTOCOL_LR ));
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));
ESP_ERROR_CHECK(esp_wifi_start());
int8_t defaultWiFiPower;
ESP_ERROR_CHECK(esp_wifi_get_max_tx_power(&defaultWiFiPower));
Serial.printf("Default power: %d\r\n",defaultWiFiPower);
ESP_ERROR_CHECK(esp_wifi_set_max_tx_power(MAX_WIFI_POWER));
ESP_ERROR_CHECK(esp_wifi_set_country(&country));
}I get a range on the built-in antennas of about 300m with the visibility of the antennas (no obstacles)