Duet 3 6HC wifi module chooses wrong access point
-
@jens55 Sadly, no. My Wifi here is not that sophisticated and relies on my FritzBox router and two rather simple extenders that are configured as LAN bridges.
But when I looked for this, I saw the access point next to the Duet used a higher channel than the one it kept connecting to. I switched that - and bingo: the Duet used the right one.
Thus, in case anyone has the same issue: the Wifi module seems to scan the channels from lowest to highest - and uses the first it can find and ignores any further options.
To work around this issue, just make sure the access point next to the Duet uses the lowest Wifi channel (and hope you won't get issues with another device then )
And: if you change that (which in my case involved unplugging the access point), I found the Duet will fail to reconnect - it keeps switching between "wifi module idle" and "authorisation rejected" then on the PanelDue which is simply wrong. You need to restart the Duet in this case - then it will reconnect immediately.
The Wifi module is running firmware 2.1beta4 by the way.
-
-
-
@NeoDue thanks for investigating and reporting this.
If you don't specify an AP name using the M552 P parameter then the wifi firmware scans for access points and picks the one with the strongest signal that it has the password for.
I don't know what happens if there are several APs on different channels all with the same SSID. The code that chooses which one to connect to may be in the closed source part of the Expressif firmware, in which case we will have no control over it. However, we will check whether it's possible to provide a preferred channel number with the command to connect.
-
@dc42 said in Duet 3 6HC wifi module chooses wrong access point:
If you don't specify an AP name using the M552 P parameter then the wifi firmware scans for access points and picks the one with the strongest signal that it has the password for.
@dc42 That would be great but it does not seem to be like that I fear. I have the following configuration:
- the network was defined on the Duet with
M587 S"my-SSID" P"password" I192.168.xxx.xxx J192.168.xxx.yyy K255.255.255.0
- and the Wifi module is started in the config.g with
G4 P5000 ; wait five seconds to allow the wifi module to start 2. M552 I1 S1 ; wifi module active
If the module would search for all channels of the given SSID and pick the strongest one, it would use the one one next to it (ca. 2m distance, visible for the antenna) regardless of which channel that one uses. But instead, it prefers the lowest channel and seems to ignore signal strength completely - which in my case resulted in a connection to the access point on the ground floor before I switched channels on the two access points, with a solid concrete floor between and therefore a miserable signal strength of -88db...
-
@NeoDue If you are using 2.1beta4 try using M587.1 and M587.2 to perform a network scan. It should return the signal strength along with the SSID channel number etc. that it finds. That may provide some clues as to what is going on.
-
@NeoDue I'm sorry, I wasn't clear. When I said "and picks the one with the strongest signal that it has the password for" I meant that the firmware takes the SSID of the AP with the strongest signal and asks the WiFi system to connect to that SSID.
Edit: I've just checked the Expressif SDK documentation and it does accept a channel parameter to start from when looking for the specified SSID. So we can fix this.
-
-
@gloomyandy I already had done that and it delivered me the following results (foreign networks excluded):
M587.2 Network Scan Results: ssid=my-SSID chan=9 rssi=-38 phymode=n auth=WPA2-Personal mac=xx:xx:xx:xx:xx:xx ssid=my-SSID chan=2 rssi=-74 phymode=n auth=WPA2-Personal mac=xx:xx:xx:xx:xx:xx ssid=my-SSID chan=6 rssi=-82 phymode=n auth=WPA2-Personal mac=xx:xx:xx:xx:xx:xx
The upper result was the access point close to the printer, the next one was the one it kept connecting to, and it happily ignored the third one which would have been even worse
But dc42's answer makes it clear what happens - if the Duet gives just the SSID to the Wifi module without specifying the channel, the module simply chooses the first access point it finds that fits.
@dc42 thanks a lot for the clarification! Great to hear that this can be fixed.
-
I think I have figured out a likely scenario why the Duet can't deal with a wifi system that locks it to a particular AP:
What I see happening is as follows::Close AP working on channel 11, distant AP working on channel 1. Duet starts to scan on channel 1, sees the access point and will always lock on the distant AP if it is operational. It will switch to the closer AP if the further AP is not available.
If the network is set up to lock the Duet to the closer AP then the Duet still starts to scan on channel 1 as before, sees that channel 1 access point is 'up' and tries to connect. The wifi network says "oh no you don't" and refuses the connection. The Duet keeps trying but can not connect. It never dawns on the Duet to carry on with the channel scan!
This seems to perfectly match what I see happening. It also seems to explain why a lot of other wifi devices in my house behave strangely in terms of which AP they connect to. I think the majority run the same wifi module. This behaviour would also explain why we see a lot of intermittent network connectivity even with an AP right next to the printer. While we say 'the AP is right there, of course it will have great signal'. the Duet says 'forget the close AP, I want to go to the AP that I can barely see because it is on a lower channel .... I don't care if I have to run at a snails pace nor do I care if I get interference on the signal I can just barely hear'
-
I think I have come up with a simple fix. I have reconfigured my wifi system channel assignments. What I had was channel 11 for the AP next to the printer and channel 1 for the AP on the main floor of the house. I am currently testing with the channels flipped and so far that looks pretty promising. With the AP next to the printers now being channel 1, all printers and cameras connect to that AP just like I had initially planned but could never achieve.
-
@jens55 Yes, that is what I noted in post 3 here as well - make sure the access point next to the Duet uses the lowest wifi channel
-
duhhhhh .... sorry about that, I thought I had discovered something .... alas, all I discovered that I can't read