How To Enable ESP NOW Long Range Mode in Arduino

IMK123
Posts: 4
Joined: Sat Apr 22, 2023 8:34 am

How To Enable ESP NOW Long Range Mode in Arduino

Postby IMK123 » Sat Apr 22, 2023 9:40 am

Hello,
I am developing a Serial to Serial via WiFi (Radio Modem) using a pair ESP32 WROOM-32 boards.
This project is in test and is running reliable for hours sending 250 byte packets to each other.
This radio modem project is for an autonomous wheeled Robot.
Where one ESP32 is driven by an App in a PC, with the other ESP32 is in the Robot.
Now this is working well although the range seems limited to about 11m through three brick walls before I get lost massages.
So I thought I would try to configure these ESP32 WROOM-32 boards in Long Range Mode.
Well I have researched much and tried many permutations of Arduino setup to enable Long Range Mode but none seem to work.
Can someone take a look at this setup code below to see if correct please.
Many thanks in advance imk

WiFi.mode( WIFI_AP_STA );

// Initilize ESP-NOW
if( esp_now_init() != ESP_OK )
{
Serial.println("Error initializing ESP-NOW");
return;
}
// Set Long Range Mode
esp_wifi_set_protocol( WIFI_IF_STA , WIFI_PROTOCOL_LR);

// Register callback function
esp_now_register_recv_cb( OnDataRecv );
// Register the send callback
esp_now_register_send_cb( OnDataSent );

// Register peer to Send To
memcpy( peerInfo.peer_addr, broadcastAddress, 6 );
peerInfo.channel = 0;
peerInfo.encrypt = false;

// Add peer
if( esp_now_add_peer( &peerInfo ) != ESP_OK )
{
Serial.println("Failed to add peer");
return;
}

SkydiveWags
Posts: 8
Joined: Tue Apr 18, 2023 6:47 pm

Re: How To Enable ESP NOW Long Range Mode in Arduino

Postby SkydiveWags » Mon Jun 26, 2023 2:35 pm

I would also like to know the answer to IMK123's question.

I would like to implement Long Range mode, but everything I see online has completely different code and much of it is in (Python?).
I am using Arduino IDE and would like to know if adding the one line used above to enable it is all I need.
The documentation doesn't make this clear at all.

Thanks.

SkydiveWags
Posts: 8
Joined: Tue Apr 18, 2023 6:47 pm

Re: How To Enable ESP NOW Long Range Mode in Arduino

Postby SkydiveWags » Wed Jun 28, 2023 6:21 pm

I am amazed nobody has replied to this with an answer. I really wonder how many people actually use ESP-NOW.

I would also like to know if long range mode will help with interference issues. I seem to be having some interference that causes me to loose communication between ESP32's.

Does it push more power? If so, how much more? Is it safe to broadcast continuously in LR mode? Or will the processor get too hot?

Fenribel
Posts: 2
Joined: Sat Oct 28, 2023 4:44 pm

Re: How To Enable ESP NOW Long Range Mode in Arduino

Postby Fenribel » Sat Oct 28, 2023 4:47 pm

Hello, colleague! I'm facing the same problem - I'm trying to integrate long-distance mode into my code that uses the esp-now protocol. Do you have any updates on the issue? It's quite difficult to debug it yourself; you'll have to run hundreds of meters with your laptop to try to write the code correctly during range tests...

IMK123
Posts: 4
Joined: Sat Apr 22, 2023 8:34 am

Re: How To Enable ESP NOW Long Range Mode in Arduino

Postby IMK123 » Sun Oct 29, 2023 9:45 pm

Not a squeak of news from anyone.
Only thing I can think is that it is illegal in some territories and therefore no one want to say how to do it.
Or it doesn't actual exist or its default state anyway.
Good luck imk

niklasonfire
Posts: 1
Joined: Thu Nov 09, 2023 2:51 pm

Re: How To Enable ESP NOW Long Range Mode in Arduino

Postby niklasonfire » Thu Nov 09, 2023 2:55 pm

Hey there,

i found that for LR Mode to work in Arduino you also need to

Code: Select all

#include <WiFi.h>
#include <esp_wifi.h
then in Setup you need to set Wifi mode as well as the mode of the Phy like so:

Code: Select all

  WiFi.mode(WIFI_MODE_STA);
  esp_wifi_set_protocol( WIFI_IF_STA , WIFI_PROTOCOL_LR);
Hope this helps somehow. I would also like to know a little more about LR mode as it is quite interesting.

Cheers

Who is online

Users browsing this forum: lbernstone and 96 guests