WiFi Fixed Channel parameter

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
MMliam
Posts: 121
Joined: Mon May 07, 2018 1:08 pm

Re: WiFi Fixed Channel parameter

Post by MMliam » Mon Dec 20, 2021 2:36 pm

w0 = network.WLAN(network.AP_IF)
You've created an Access-Point object not a station object; that has always worked even in the standard build.

Remember this excerpt from the example [https://micropython-glenn20.readthedocs ... -operation] you provided on 16-Dec:

w0 = network.WLAN(network.STA_IF)
w0.active(True) # Set channel will fail unless Active
w0.config(channel=6)

This is what hasn't worked for the ESP8266 in the standard or ESPNow builds.
Note the error when trying to create a station object:
File "main.py", line 18, in
OSError: AP required

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WiFi Fixed Channel parameter

Post by davef » Mon Dec 20, 2021 6:17 pm

Both worked. I tried station first then AP and then copied the AP example!

MMliam
Posts: 121
Joined: Mon May 07, 2018 1:08 pm

Re: WiFi Fixed Channel parameter

Post by MMliam » Mon Dec 20, 2021 6:22 pm

Still leaves me with a problem; fixing a channel for an ESP8266 station.
Wonder why the ESPNow would work for ESP32 and not ESP8266; does seem likely that it shouldn't work for the ESP8266.

It's not absolutely necessary, but I was hoping it would speed up the connection time.

Here's a question; can an AP connect with another AP, and function like a station?
It would seem that it should be possible if one wanted to setup a mesh-network.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WiFi Fixed Channel parameter

Post by davef » Mon Dec 20, 2021 6:50 pm

All the features of ESPNow may not be implemented on a ESP8266 due to limited space.

I have read several tutorials on ESP-Mesh, search <randomnerd tutorials>. Then there is Zoland's work on SMesh, see latest ESPNow thread

MMliam
Posts: 121
Joined: Mon May 07, 2018 1:08 pm

Re: WiFi Fixed Channel parameter

Post by MMliam » Mon Dec 20, 2021 9:54 pm

Well, I've determined that an ESP8266 configured as an AP object, can not connect to another AP like a station.
Didn't think it would, but it was worth a shot.

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WiFi Fixed Channel parameter

Post by davef » Wed Dec 22, 2021 2:26 am

Just re-reading some of your comments. Deep sleep, the ESP32 has it as well. Don't know how it compares to ESP8266's deep sleep though.

I can get the bareboard ESP32 for about $4 NZ including shipping.
https://www.aliexpress.com/item/3286472 ... 8470%22%7D
Even the ESP32-WROOM-32U is only $6 including shipping but for only one unit. If you want 2 you the shipping takes a big jump, at least it does to NZ. You might as well order 10!

Unless size is an issue and/or you hope to go into production then the time saved by using the more capable unit has got to be worth something.

Yes, it does seem to be a waste to use an ESP32 for a 1 wire temperature sensor that is not even WiFi connected but it is just so easy.

For my datalogger I was having to freeze some modules to fit on a standard ESP32-WROOM-32U and that became a pain so for the BIG jobs I bought 2 of the SPIRAM variants.

MMliam
Posts: 121
Joined: Mon May 07, 2018 1:08 pm

Re: WiFi Fixed Channel parameter

Post by MMliam » Thu Dec 23, 2021 4:11 pm

Hi Dave,

From the experiments I've run it's clear that providing the station-mode with fixed-channel method (like an AP) greatly reduces the network re-connection time after a deep-sleep wake-up.

The question is how to get this incorporated into a microPython build. I don't expect the increase in the coding required would significantly increase the size of the build. But as I mentioned in a past post, the trade-off would be to replace the channel-scanning code with the fixed-channel code.

I have never created a build; if it were simply modifying existing code an recompiling I might be able to do it, but unless there is a complete build library available in one place like Github, it might not be that simple.

The link you provided me
Has an error, the secondary link "Espressif Getting Started guide" results in "Page Not Found".
I searched for it and found this
This appears to be the correct information.

Given the simple addition I'm look for, is there someone that can create the build, before I begin what will no doubt be a long learning curve to create a build myself?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WiFi Fixed Channel parameter

Post by davef » Thu Dec 23, 2021 7:33 pm

The link I sent and that you copied back to me works. It is a well-written guide on one of the most difficult aspects of using the ESP8266 in space-constraint applications.

I tried building, before he wrote that and was never successful. I haven't tried his instructions.

I don't where to begin with changing the behaviour of ESP-Now itself so an expert is required. Maybe, do a search around the Arduino and PyCom forums maybe someone else has tried to do this.

Good luck.

MMliam
Posts: 121
Joined: Mon May 07, 2018 1:08 pm

Re: WiFi Fixed Channel parameter

Post by MMliam » Thu Dec 23, 2021 8:06 pm

I wasn't considering modifying the ESPNow version. I would try modifying the last basic version dated 20211111.

BTW: It's not the link you sent that I had a problem with, it's a link within that one that consistently fails for me. Is the Espressif link that I found the one you that works for you?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: WiFi Fixed Channel parameter

Post by davef » Thu Dec 23, 2021 8:45 pm

Sorry, misunderstood.

Your secondary link works.

This is the one I have read before
esp-now_user_guide_en.pdf
and
ESP-NOW - ESP32 - — ESP-IDF Programming Guide latest documentation.html
struct esp_now_peer_info

ESPNOW peer information parameters.

Public Members

uint8_t peer_addr[ESP_NOW_ETH_ALEN]

ESPNOW peer MAC address that is also the MAC address of station or softap

uint8_t lmk[ESP_NOW_KEY_LEN]

ESPNOW peer local master key that is used to encrypt data

uint8_t channel

Wi-Fi channel that peer uses to send/receive ESPNOW data. If the value is 0, use the current channel which station or softap is on. Otherwise, it must be set as the channel that station or softap is on.
... but what to do with the information.

Post Reply