Esp32 Wifi Long Range Mode

louisthetall
Posts: 8
Joined: Thu Jan 04, 2018 8:36 pm

Esp32 Wifi Long Range Mode

Postby louisthetall » Thu Jan 04, 2018 9:00 pm

I am currently testing the Long Range wifi mode on the esp32 device and I was wondering what other people have discovered about it.

With some preliminary tests that I have run, I set up two pairs of esp32 devices, one using the long range (LR) wifi protocol and the other using the default protocol. I print out the wifi signal strength (RSSI) every 5 seconds and compare the results of the two protocols.
For these tests, I don't have a direct line of sight between the two devices, but both pairs are being tested under the same conditions.

At the same distances, I am seeing a consistent power drop in the LR devices. For example, the signal strength of the default mode pair may be hovering around -64db and the LR mode pair with the same distance between devices will have a signal strength or -73db.

Has anyone else done any work with the long range mode? Is the power drop to be expected?

In my application, the two devices connected over wifi are not separated by a very big distance, but instead have lot of metal machinery between them. Would the LR mode provide a better signal in this case or are its benefits only seen when used at long distances?

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Esp32 Wifi Long Range Mode

Postby rudi ;-) » Thu Jan 04, 2018 11:23 pm

hi
happy new year.

can i ask you which esp32 boards you have used for this test?
do you use ipx/extern antenna or pcb antenna?

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Esp32 Wifi Long Range Mode

Postby ESP_Sprite » Fri Jan 05, 2018 10:04 am

FYI, one of the changes that the LR-mode has is to use a different modulation scheme. I don't exactly know how the RSSI is calculated when LR mode is enabled, but one of the effects could actually be that you can still receive data even at RSSIs where normal WiFi modulation schemes would fail.

louisthetall
Posts: 8
Joined: Thu Jan 04, 2018 8:36 pm

Re: Esp32 Wifi Long Range Mode

Postby louisthetall » Fri Jan 05, 2018 2:42 pm

can i ask you which esp32 boards you have used for this test?
do you use ipx/extern antenna or pcb antenna?
I am using the ESP-WROOM-32 with no external antennas
FYI, one of the changes that the LR-mode has is to use a different modulation scheme. I don't exactly know how the RSSI is calculated when LR mode is enabled, but one of the effects could actually be that you can still receive data even at RSSIs where normal WiFi modulation schemes would fail.
I believe I was seeing something to this effect. At the very limits of the range, I would sometimes still be getting an RSSI value but the device would still show that it was disconnected

Valerii
Posts: 16
Joined: Wed Dec 27, 2017 4:20 pm

Re: Esp32 Wifi Long Range Mode

Postby Valerii » Thu Jan 18, 2018 4:49 pm

Hi all, I've just started with ESP32 and trying to establish LR link based on WROOM-32 modules with modified esp-idf firmware.
I just set up AP with LR protocol on one module and Wifi Scanner from example. I do not see the AP at scanned list. I expect to see my LR AP with

Code: Select all

.phy_lr == 1 
in

Code: Select all

wifi_ap_record_t
struct.
What could be the problem?

perryc
Posts: 25
Joined: Fri Feb 17, 2017 1:29 am

Re: Esp32 Wifi Long Range Mode

Postby perryc » Thu Jan 25, 2018 9:29 pm

We've been using a pair of esp-woom-32 based pcb's to test performance in "Long Range WiFi" relative to standard WiFi mode and find both start to drop packets at -90dBm and no increase range before the connection drops with "Long Range" mode. Sure like to hear from anyone getting "long range" mode to actually deliver any meaningful increase in range.

Perry

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Esp32 Wifi Long Range Mode

Postby WiFive » Thu Jan 25, 2018 10:47 pm

I agree, all I have seen is similar range and lower throughput.

Ankit53
Posts: 13
Joined: Sat Dec 08, 2018 11:21 am

Re: Esp32 Wifi Long Range Mode

Postby Ankit53 » Wed Apr 17, 2019 10:31 am

Hi
I am doing WiFi long range test with SoftAP and STA with ESP32.

How to get RSSI ? I could not connect two devices if I mention protocol only WIFI_PROTOCOL_LR.

In your test protocol was lrbgn or only lr?

Regards,
Ankit Siddhapura

iParcelBox
Posts: 31
Joined: Sun Oct 27, 2019 3:12 pm

Re: Esp32 Wifi Long Range Mode

Postby iParcelBox » Sun Oct 27, 2019 3:15 pm

I"m having the same issue. I've connected 2 Wrover-IB with external antennas, one in STA and the other as AP with protocol set to LR on both.

They connect OK, but I'm only getting about 20m range - no where near what Espressif claim can be achieved.

Has anybody managed to get it working successfully?

bitrat
Posts: 1
Joined: Mon Nov 04, 2019 10:46 pm

Re: Esp32 Wifi Long Range Mode

Postby bitrat » Tue Nov 05, 2019 12:02 am

SOLVED! I've amended this post, but left it in place in case it's useful.

The solution was to make sure esp_wifi_set_mode() was called before the call to esp_wifi_set_protocol().

In micropython, this means a call to wlan.active(True)

Code: Select all

>>>
>>> import network as nw
>>> wlan = nw.WLAN(nw.STA_IF)
>>> wlan.active(True)
W (18387343) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
I (18387473) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 2
I (18387483) wifi: mode : sta (b4:e6:2d:d9:0f:ed)
True
I (18387483>)> >w ifi: STA_START

>>>
>>> nw.phy_mode(nw.STA_IF, nw.MODE_LR)
(True, I (18406273) network: event 3
0)
I (18406273) wifi: STA_START
>>>
>>>
>>> nw.phy_mode(nw.STA_IF)
(True, 8)
>>>

This question was answered by jimmo at the micropython forum

=============================================== original post from here
Hi,

I'm trying to get wifi LR mode from Micropython. I can use C code along the lines of this example, but it's easier to use Micropython at present.

I've added this rough implementation of phy_mode() to modnetwork.c (with a view to enabling LR mode) and flashed it to a sparkfun thing, but I get ESP_ERR_INVALID_ARG. Calling phy_mode() with no args just returns the error values, (0, 12289, 12292, 258), so I can decode them.

Code: Select all

STATIC mp_obj_t esp_phy_mode(size_t n_args, const mp_obj_t *args) {

       if (n_args == 0) {
		 mp_obj_t tuple[4] = {
		    mp_obj_new_int(ESP_OK),
		    mp_obj_new_int(ESP_ERR_WIFI_NOT_INIT),
		    mp_obj_new_int(ESP_ERR_WIFI_IF),
		    mp_obj_new_int(ESP_ERR_INVALID_ARG),
		};
		return mp_obj_new_tuple(4, tuple);		 
	 }
      
	uint8_t protocol_bitmap = -1;
	esp_err_t esp_err  = ESP_OK;
	wifi_interface_t ifx = WIFI_IF_STA;
	switch(n_args)
	{
		case 1:
			ifx = mp_obj_get_int(args[0]);
		
		//case 0:
			esp_err = esp_wifi_get_protocol(ifx, &protocol_bitmap);
			if(esp_err ==ESP_OK)
			{
				 mp_obj_t tuple[2] = {
					    mp_const_true,
					    mp_obj_new_int(protocol_bitmap),
					};
					return mp_obj_new_tuple(2, tuple);					
			}
			break;
		
		case 2:
			ifx = mp_obj_get_int(args[0]);
			esp_err = esp_wifi_set_protocol(ifx, mp_obj_get_int(args[1]));
			break;
	}
	
	 mp_obj_t tuple[2] = {
		    mp_obj_new_bool(esp_err ==ESP_OK),
		    mp_obj_new_int(esp_err),
		};
		return mp_obj_new_tuple(2, tuple);		
    }

STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(esp_phy_mode_obj, 0, 2, esp_phy_mode);
I also added ..

Code: Select all

 STATIC const mp_rom_map_elem_t mp_module_network_globals_table[] = {
.
 { MP_ROM_QSTR(MP_QSTR_MODE_LR), MP_ROM_INT(WIFI_PROTOCOL_LR) },
 .
after reboot..

Code: Select all

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5064
load:0x40078000,len:9656
load:0x40080400,len:6252
entry 0x400806f4
I (440) cpu_start: Pro cpu up.
I (440) cpu_start: Application information:
I (441) cpu_start: Compile time:     Nov  5 2019 12:51:12
I (444) cpu_start: ELF file SHA256:  0000000000000000...
I (450) cpu_start: ESP-IDF:          v3.3
I (454) cpu_start: Starting app cpu, entry point is 0x40083168
I (0) cpu_start: App cpu up.
I (465) heap_init: Initializing. RAM available for dynamic allocation:
I (472) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (478) heap_init: At 3FFBA488 len 00025B78 (150 KiB): DRAM
I (484) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (490) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (497) heap_init: At 40092A60 len 0000D5A0 (53 KiB): IRAM
I (503) cpu_start: Pro cpu start user code
I (74) cpu_start: Chip Revision: 1
I (74) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (470) modsocket: Initializing
I call it like this..

Code: Select all

>>>
>>>
>>>
>>>
>>> import network as nw
>>> nw.phy_mode()
(0, 12289, 12292, 258)
>>>
>>> nw.phy_mode(nw.STA_IF, nw.MODE_LR)
(False, 12289)
>>>
>>>
>>> wlan = nw.WLAN(nw.STA_IF)
I (372060) wifi: wifi driver task: 3ffe2e9c, prio:23, stack:3584, core=0
I (386295) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (386305) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (386355) wifi: wifi firmware version: aeed694
I (386355) wifi: config NVS flash: enabled
I (386355) wifi: config nano formating: disabled
I (386355) wifi: Init dynamic tx buffer num: 32
I (386355) wifi: Init data frame dynamic rx buffer num: 32
I (386365) wifi: Init management frame dynamic rx buffer num: 32
I (386365) wifi: Init management short buffer num: 32
I (386375) wifi: Init static rx buffer size: 1600
I (386375) wifi: Init static rx buffer num: 10
I (386385) wifi: Init dynamic rx buffer num: 32
>>>
>>> nw.phy_mode(nw.STA_IF, nw.MODE_LR)
(False, 258)
>>>
>>>
>>> nw.phy_mode(nw.STA_IF)
(True, 7)
>>>
>>> nw.phy_mode(nw.STA_IF, 7)
(False, 258)
>>>
>>>
Note: before I call nw.WLAN(nw.STA_IF), the error I get is from phy_mode() is ESP_ERR_WIFI_NOT_INIT. After wlan is initialized, I get ESP_ERR_INVALID_ARG, which seems to suggest my call to esp_wifi_set_protocol() is executing actual code and not some stub.

Note: that phy_mode() returns the (presumably) correct mode value: 7 (ie, 11b|11g|11n == 1|2|4)

But note: setting mode to 7 also fails with ESP_ERR_INVALID_ARG.

This is compiled against idf v3.3

Can anyone suggest what might be missing to set phy mode. Has anyone out there successfully used ESP32 LR mode on a thing?

Who is online

Users browsing this forum: Bing [Bot] and 114 guests