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

WiFi Fixed Channel parameter

Post by MMliam » Wed Dec 15, 2021 11:01 pm

Does microPython support the specification of a fixed WiFi channel when connecting?
For example, as a parameter in "station.connect('SSID', 'Pass', 'channel-number')", or in some other microPython network setting.

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

Re: WiFi Fixed Channel parameter

Post by davef » Wed Dec 15, 2021 11:15 pm


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

Re: WiFi Fixed Channel parameter

Post by MMliam » Thu Dec 16, 2021 2:45 am

# Set WiFi access point name (formally known as ESSID) and WiFi channel
ap.config(essid='My AP', channel=11)

This appears to be setting the channel when the unit is used as an access-point.
Would that apply to a unit that's being configured as a station (AKA client)?

In other words:
If
station = network.WLAN(network.STA_IF)
iIs there a
station.config(channel=11).

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

Re: WiFi Fixed Channel parameter

Post by davef » Thu Dec 16, 2021 3:38 am

Good question.

Try setting it and then do;

Code: Select all

print(station.config('channel'))

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

Re: WiFi Fixed Channel parameter

Post by MMliam » Thu Dec 16, 2021 4:16 am

I have the answer; it doesn't work.

I inserted station.config(channel=11) into my code right after the creation of the station object; then ran the code. microPython thru an error saying 'requires AP'

If there's a way to set a station channel so it doesn't scan all channels when connecting, that 's not the way.
For a station, a logical place to put it would be as a parameter in the "connect' method.

I can understand not having the facility to set station channels to a fixed number; if for some reason the AP (router) channel is changed all the clients would stop connecting. However, the capability should allow clients to connect faster coming out of deep-sleep.

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

Re: WiFi Fixed Channel parameter

Post by davef » Thu Dec 16, 2021 7:42 am

An interesting comment:
https://micropython-glenn20.readthedocs ... -operation
Some versions of the ESP IDF don’t permit setting the channel of the STA_IF at all, other than by connecting to an Access Point (This seems to be fixed in IDF 4+). Micropython versions without the ESPNow patches also disallow setting the channel of the STA_IF.
This seems to imply if you use a ESPNow image that you could set the station channel.

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

Re: WiFi Fixed Channel parameter

Post by MMliam » Thu Dec 16, 2021 4:38 pm

WOW, just when you thought using microPython was confusing enough - lol

You're right, they clearly show a coding example:
w0 = network.WLAN(network.STA_IF)
w0.active(True) # Set channel will fail unless Active
w0.config(channel=6)
I don't understand why they don't have a single distribution, or at least various distribution levels with clearly labelled feature extensions.

Thanks, looks like this may work.

By the way I'm also using umqtt for microPython, if you're familiar with MQTT, Node-RED and Node.js you can setup a network between devices very quickly.
The only thing is there are two distributions umqtt.simple and umqtt.robust. umqtt.simple only supports QoS (Quality of Service) levels 0 & 1, not 2. It's my understanding that umqtt.robust adds functionality to umqtt.simple (you need to install both distributions).
If you have any knowledge of umqtt, does umqtt.robust support QoS level 2?

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

Re: WiFi Fixed Channel parameter

Post by davef » Thu Dec 16, 2021 6:02 pm

My understanding is that there is quite a bit of work porting Micropython to all the different hardware platforms and that some features are just not available on various platforms. For example ESPNow, ESPMesh and probably others that I don't even know about.

So, it takes keen individuals to exploit these added features. Check out the ESPNow thread.

I know very little about umqqt and have never used it.

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

Re: WiFi Fixed Channel parameter

Post by MMliam » Thu Dec 16, 2021 6:36 pm

I'll definitely be checking-out the ESPNow thread; that looks like a great find - thanks.

As far as MQTT, and Node-RED, if you're interested, checkout these sites (BTW both technologies were created by IBM in the 1990's, but their use is exploding now)
Node-RED Essentials https://www.youtube.com/playlist?list=P ... qFcXBkHy-6

MQTT Essentials https://www.hivemq.com/mqtt-essentials/

Curiously, even though IBM developed MQTT & Node-RED they didn't integrate them; here's a link that will show how to integrate MQTT into Node-RED: http://stevesnoderedguide.com/install-m ... r-node-red

Have fun :D

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

Re: WiFi Fixed Channel parameter

Post by davef » Thu Dec 16, 2021 8:04 pm

I'll check out the links when I get back to civilization and unlimited data.

I had a good play with Hologram a few years ago but my home automation system running on ESP32s using uMail and Gmail's SMTP server works well enough through a cell connection.

I use ESPNow in a remote water tank monitoring system, so keep up to date on that development.

Post Reply