Pico-W Connecting to AP Autonomously #9324
-
My main.py script successfully connects my Pico-W to my Access Point perfectly when I'm running the code in Thonny 4.0. Nothing fancy in the code, pretty much the same code everyone finds when first starting out. However ... If I move my USB to a power adapter/battery/UPS port, it fails to connect. I've checked my AP logs, and it doesn't show the attempt being made. I added some blinking LED code to see what it's getting for an wlan.status() value, and I'm getting a "1". So that tells me the main.py code is running, albeit finishing with a raised exception. So I have a working Pico-W and my code appears to be working: The only change is connecting the Pico from my PC (Thonny) vs connecting to 5V USB power source. I've tried a few different nightly builds from the Raspberry PI site, various power sources including a USB port on my UPS block, and I've also tried loading up a different Pico W to see if I just had a bad unit. Has anyone else had this issue?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I have a Pico W that connects OK either using USB or battery power. My codes a little different to yours:
When making network connections I always use a loop that keeps trying and ignores errors and not just with the Pico W. Rather bizarely I found I get much more reliable connections with the Pico if I include the I'm using a relatively recent nightly build. |
Beta Was this translation helpful? Give feedback.
-
Worth remembering the Pico W network code is quite new so expect teething problems. If you do get further issues do try adding in the scan. Seems bizarre but works consistently for me.
The rather clumsy try / except I use because a different processor (esp32) would throw a network error rather than just failing to connect which killed the program, but ignoring the error and trying again worked fine.
--
Sent from Universal Email App for Android Thursday, 15 September 2022, 05:46pm +01:00 from XexusUS ***@***.*** :
…Oddly, just before I put this question together, I thought just for giggles I'd extend the time out to an hour. After about 5-10 mins I decided that wasn't going to work and walked away to work on a different project. Came back to my desk a few hours later and found it had connected. Then I power cycled it again, and it came up rather quickly. I'm happy it works again after poking at it for so many days.
Still, I'm glad I posted because I can see the logic and wisdom in your solution, and will certainly incorporate it in my code. Thank you very much! This was my last stumbling block, and now I'm fairly confident I'll have a pico power grandfather clock by the end of the weekend. :)
—
Reply to this email directly, view it on GitHub , or unsubscribe .
You are receiving this because you commented. Message ID: @ github . com>
|
Beta Was this translation helpful? Give feedback.
I have a Pico W that connects OK either using USB or battery power. My codes a little different to yours:
When making network connections I always use a loop that keeps trying and ignores errors and not just with the Pico W.
Rather bizarely I found I get much more reliable connections with the Pico if I include the
.scan()
before trying to connect.I'm using a relatively recent nightly build.