How to maximize ESP-NOW range?

User avatar
Moskus
Posts: 4
Joined: Mon Oct 02, 2023 11:24 am

How to maximize ESP-NOW range?

Postby Moskus » Wed Nov 01, 2023 10:06 am

I'm sending data every second from many ESP32s ("nodes") to a receiver ESP32 ("station"), and I'm trying to get the absolute maximum transmit length possible. Many sources on guides and Youtube claims to achieve range in the hundres of meters using "standard development boards", but I'm not quite there yet.

I get around 70 m range when the receiver is placed indoors but very close to a large window, and the transmitter is outside. It's not bad, but not what I need.

Here's what I'm doing initializing ESP-NOW on the transmitters ("nodes"):

Code: Select all

  // Configuring ESP-NOW
  ESP_ERROR_CHECK(esp_netif_init());
  ESP_ERROR_CHECK(esp_event_loop_create_default());
  wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
  ESP_ERROR_CHECK(esp_wifi_init(&cfg));
  ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
  ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
  ESP_ERROR_CHECK(esp_wifi_start());
  // WiFi.mode(WIFI_STA);

  // Set Long Range Mode
  ESP_ERROR_CHECK(esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_LR));

  //Set the lowest espnow phy rate to maximum range
  ESP_ERROR_CHECK(esp_wifi_config_espnow_rate(WIFI_IF_STA, WIFI_PHY_RATE_LORA_250K));

  // Init ESP-NOW
  if (esp_now_init() != ESP_OK)
  {
    Serial.println("Error initializing ESP-NOW");
    return;
  }

  // Set transmission power, max 84.
  ESP_ERROR_CHECK(esp_wifi_set_max_tx_power(84));

  //Register callback to verify if data was sent successfully
  esp_now_register_send_cb(OnDataSent);

And the receiver:

Code: Select all

    ESP_ERROR_CHECK(esp_netif_init());
    ESP_ERROR_CHECK(esp_event_loop_create_default());
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK(esp_wifi_init(&cfg));
    ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
    ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
    ESP_ERROR_CHECK(esp_wifi_start());

    // WiFi.mode(WIFI_STA);

    // Set custom MAC
    esp_wifi_set_mac(WIFI_IF_STA, localCustomMac);

    // Set the Long Range mode
    ESP_ERROR_CHECK(esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_LR));
    ESP_ERROR_CHECK(esp_wifi_config_espnow_rate(WIFI_IF_STA, WIFI_PHY_RATE_LORA_250K));

    // Initialize
    if (esp_now_init() != ESP_OK)
    {
        Serial.println("Error initializing ESP-NOW");
        return;
    }

    // Set transmission power, max 84.
    ESP_ERROR_CHECK(esp_wifi_set_max_tx_power(84));

    // Register for recv CB to  get recv packet info
    esp_now_register_recv_cb(OnDataRecv);
Am I missing something?
Is there anything else I can do?

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: How to maximize ESP-NOW range?

Postby cruvus » Wed Nov 01, 2023 1:46 pm

What is your power saving setting? In some early experiments I had to set

Code: Select all

esp_wifi_set_ps(WIFI_PS_NONE);
else I did not receive anything.
ESP32 / ESP-IDF 5.1.4

User avatar
Moskus
Posts: 4
Joined: Mon Oct 02, 2023 11:24 am

Re: How to maximize ESP-NOW range?

Postby Moskus » Mon Nov 06, 2023 11:58 am

cruvus wrote:
Wed Nov 01, 2023 1:46 pm
What is your power saving setting? In some early experiments I had to set

Code: Select all

esp_wifi_set_ps(WIFI_PS_NONE);
else I did not receive anything.
Yes, I've set that too now. I will have to do some field tests.

g.gregory8
Posts: 1
Joined: Sat Mar 30, 2024 9:40 am

Re: How to maximize ESP-NOW range?

Postby g.gregory8 » Sat Mar 30, 2024 9:42 am

Hi did you get a solution to increasing range by decreasing bandwidth or any other functions?

Gijsbertud79
Posts: 1
Joined: Sun Nov 03, 2024 2:50 pm

Re: How to maximize ESP-NOW range?

Postby Gijsbertud79 » Sun Nov 03, 2024 6:49 pm

I have the same problem. There is not much information about the long range mode. Could please someone help?
I have placed a solar pannel on my garage its 300 meters away from my home. I'd like to monitor the battery from my home.

Who is online

Users browsing this forum: nopnop2002 and 105 guests