Skip to content
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

Badger 2040W Won't Connect to Unsecured Wireless #72

Open
pottsrichard opened this issue Feb 13, 2024 · 4 comments
Open

Badger 2040W Won't Connect to Unsecured Wireless #72

pottsrichard opened this issue Feb 13, 2024 · 4 comments

Comments

@pottsrichard
Copy link

Our school uses heavily filtered, unsecured wireless - mainly for any non-staff devices.

Our recently bought Badger 2040Ws don't want to connect to the unsecured WiFi (standard Raspberry Pis connect fine). We've tried several variations in the WIFI_CONFIG.py file, but without any luck.

We've tried:
PSK = ""
PSK = None
Adding a line with: KEY_MGMT = None
Replacing the PSK line with: KEY_MGMT=None

I've tried taking a look at net_info.py, but it only seems to pass the SSID and PSK from WIFI_CONFIG.py

Any ideas guys?

@goozgig
Copy link

goozgig commented Feb 22, 2024

Hi,

Put together this simple wifi connect function whilst implementing an MQTT channel on my Badger 2040W (with very useful info from: https://core-electronics.com.au/guides/getting-started-with-mqtt-on-raspberry-pi-pico-w-connect-to-the-internet-of-things/).

Never tried connecting to open networks, but this would allow multiple connect tries and reporting, which should help with finding the solution.

Good luck .... Gerry

Code________________________________________

import network
from time import sleep

ssid = 'myssid'
password = 'mypassword' # or whatever required for open network ???

def connect_to_wifi(max_connection_tries):
print("*** connecting to network *")
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(ssid, password)
for i in range(0, max_connection_tries):
connect_tries = i
print("
network connection try: " + str(connect_tries))
if not wlan.isconnected():
connect_status = 'Not Connected'
connection = (0,0,0,0)
print('... Waiting for connection ... try#: ' + str(connect_tries))
sleep(1)
else:
connection = wlan.ifconfig()
connect_status = 'Connected'
break
return connection, connect_status, connect_tries

Test

connection_attempts = 20 # or whatever ...
connection, connect_status, connect_tries = connect_to_wifi(connection_attempts)
print(connection)
print(connect_status)
print(connect_tries)

@Gadgetoid
Copy link
Member

There was a bug in MicroPython's handling of open wireless networks, discussed and eventually fixed here - micropython/micropython#9016

Badger 2040W isn't building against the latest version of MicroPython yet, so it's very possible this could be the problem.

@pottsrichard
Copy link
Author

There was a bug in MicroPython's handling of open wireless networks, discussed and eventually fixed here - micropython/micropython#9016

Badger 2040W isn't building against the latest version of MicroPython yet, so it's very possible this could be the problem.

Thanks Gadgetoid - I'd read that thead when researching the issue and assumed the latest version of Badger 2040W would have this - good to know that a fix should eventually come. Thanks!

@BenjaminEHowe
Copy link

Looks like v0.0.5 might fix this -- @pottsrichard, could you verify?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants