-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LR-mode #20
Comments
Thanks for the report. The LR mode is not supported in the micropython releases, but it is supported in the espnow releases. The espnow patches add support for:
Documentation for LR mode is available at: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#wi-fi-protocol-mode NOTE: I believe you may need to set this config option BEFORE calling w0.active(True) (ie. before esp_wifi_start() is called). (If I have misunderstood the intention of this issue, let me know. I'm not quite sure what the actual issue is. :-). |
I didn't make it clear that I was asking if you could put LR-mode into your ESPNow images. I was not aware that LR-mode was already included. I tried your code snippet before making w0.active(True) but get this error message: |
Found a posting about this error and tried making the local (receiver) AP_IF. That error disappears. However, when I do that at the remote (sender) end I now get: I realised that when you put an end into AP-mode then you have to change the mac, however all combinations of AP/STA and mac address still give the above error. |
I just ran some checks and it seems that it works fine so long as the STA_IF has been made active(True) at least once since the last hard reset or power cycle. So, reverse my previous advice to set the protocol before calling active(True):
Note that it does not throw the error even if w0 is not active - just so long as it has been set active at least once since the last reboot. |
Remember that when you call add_peer() on the remote to register the local end, you should set the ifidx parameter to 1 (network.AP_IF), so that the espnow stack knows to send messages to that peer through the AP_IF interface. eg:
You can check with |
I will post code on a new thread on the Micropython forum. Thanks for your help |
Using MicroPython v1.19.1-espnow-6-g44f65965b I am having another go at LR-mode. In your code snippet above I understand the need to have ifidx=network.AP_IF to talk to a local which is set up for AP. The snippet suggests that the remote is also on AP. Should both units be on AP? How is longer range observed? I would expect the RSSI reading to be different between the modes at the same distance or be able to move the devices further apart before the link drops out. I see both modes drop out at -95dBm at the same distance and re-establish at -93dBm. I have seen comments about -105dBm (LR-mode), in which case I would expect to see a change in this go/no-go threshold at the receive end. |
I believe my snippet was based on that you were already using the AP_IF. If all your devices are ESP32s, you shouldn't need to use the AP_IF at all on any of your devices as you can send and receive ESPNow messages just fine with the STA_IF (and that is simpler). (As I have recently discovered that is not true if some of your devices are esp8266s). I have not tested LR_MODE to see if it provides improved range. I have only tested that connections work. A user pointed me at the following video 6:05 on video which suggests success. To replicate the conditions they used in that test (and using my wifi.py module from https://github.com/glenn20/micropython-espnow-utils): import wifi, network, espnow
sta, ap = wifi.reset(protocol=network.MODE_LR) # STA on disconnected, AP off, force LR_MODE
wifi.status() # print details to confirm settings
peer=b'xxxxxx'
enow = espnow.ESPNow()
enow.active(True)
enow.add_peer(peer)
.... That should initialise everything to the same state as they used in that test. Note that your devices will not be able to connect to a wifi network in this mode (11B,11G,11N disabled). I'm not sure how to make LR_MODE work with wif mode - it might take some experimentation. |
Actually, all my testing so far has been with both units on STA mode. I can confirm that the connection works, just not appear to work better. I do not want to use WiFi on these test units. That can wait for another "day". Thank you for the link to the video and the espnow-utils. |
There is an open issue here:https://github.com/micropython/micropython/issues/8510
My tests indicate that normal WiFi and ESPNow work down to the same RSSI, ie -93dBm. Appears that ESPNow doesn't reduce the receiver bandwidth to improve signal to noise ratio.
The text was updated successfully, but these errors were encountered: