Pico WH not connecting to wifi

Hi guys,
I bought a pico wh from core electronics which arrived yesterday. I am struggling to connect it to wifi. The board itself works fine. I was able to run code and hookup a bme280 sensor and acquire data. But when I connect it to the internet, I get this error first
“Traceback (most recent call last):
File “”, line 17, in
OSError: [Errno 1] EPERM”
then if i run it again there is no response on the terminal and it is busy. If I stop running the code, it doesn’t stop and continually gives me an error saying the following until I disconnect and reconnect the pico.

Unable to connect to COM5: could not open port ‘COM5’: PermissionError(13, ‘Access is denied.’, None, 5)

If you have serial connection to the device from another program, then disconnect it there first.

Process ended with exit code 1.

I have tried multiple wifi connections at home (2.4 and 5ghz), hotspot from my phone, and wifi at work, but no luck. I also tried resetting the board. I am working on thonny and this is the code I was using, which was taken from the example code from your website. I can tell with certainty that it doesnt get past wlan.connect step. I have tried running the sample code for creating a HTTP server which has statements saying “waiting for connection” but it doesn’t even print those as these are written after the wlan.connect step. I tried print(wlan.status) statements before and after the wlan.connect step and it prints one 0 onto console and goes busy/unresponsive. please help.

import network # handles connecting to WiFi
import urequests # handles making and servicing network requests

wlan = network.WLAN(network.STA_IF)
wlan.active(True)

ssid = ‘IPhone’
password = ‘480184014’
wlan.connect(ssid, password)

1 Like

Welcome to the forum Jashuva!

Which version of micropython are you running? If you take a screenshot of the REPL as soon as you connect it to your computer it will show the version number.

Also its worth noting that like any internet connection you have to have the SSID and password exactly correct, its case sensitive so if you can login to your router and copy paste the details that’s your best bet.

It may take a little while to connect so be patient - at most I’d leave it around 1 minute before suspecting something is off.

For a less reliable connection try this code:

import network
import socket
from time import sleep
from picozero import pico_temp_sensor, pico_led
import machine

ssid = 'NAME OF YOUR WIFI NETWORK'
password = 'YOUR SECRET PASSWORD'

def connect():
    #Connect to WLAN
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    wlan.connect(ssid, password)
    while wlan.isconnected() == False:
        print('Waiting for connection...')
        sleep(1)
    print(wlan.ifconfig())

try:
    connect()
except KeyboardInterrupt:
    machine.reset()

Let us know how you go!
Liam

Hi Liam,
this is the filename of micropython I am using: rp2-pico-w-20221123-unstable-v1.19.1-713-g7fe7c55bb
I have tried your code and got this error:
Traceback (most recent call last):
File “”, line 4, in
ImportError: no module named ‘picozero’

Edit:
I have imported the picozero package using tools → manage packages → import picozero.
Now it has the same problem as before: terminal busy no output. I have actually dialed it down to the line “wlan.active(True)”. it is not passing that line in the script. if I make it false and add print statements before and after it, it prints both of them but doesnt print the statement after it I change it to active. Here is my modified code.
import network
import socket
from time import sleep
from picozero import pico_temp_sensor, pico_led
import machine

ssid = ‘DN8245V-FEE7’
password = ‘************’

def connect():
#Connect to WLAN
wlan = network.WLAN(network.STA_IF)
print(‘1’)
wlan.active(True)
print(‘2’)
wlan.connect(ssid, password)
while wlan.isconnected() == False:
print(‘Waiting for connection…’)
sleep(1)
print(wlan.ifconfig())

try:
connect()
except KeyboardInterrupt:
machine.reset()

1 Like

Hi Jashuva,

Would you be able to send through a photo of your setup? It sounds as if everything should be working.

If you have a multimeter and test across the 3v3 pin and GND whats the voltage?

Liam

Hi Liam,

Please see attached my photo of the setup. As I said on my earlier post, the board itself is working and I am able to hookup my sensor and get data. My only problem is connecting to wifi. I have tested the voltage across 3V3 and ground and its reading 3.26V. I suspect the wifi module is defective. Can I try any test/code to absolutely narrow it down to faulty wifi module?

2 Likes

Hi Jashuva,

It looks like you’ve got a standard non-wireless Pico, the main difference is the silver RF shield on the ,end furthest from the USB connector:Raspberry Pi Pico W with Soldered Male Headers | Core Electronics Australia

Liam

1 Like

Ahhhhhhhhhhhhhhhhhhhhhh! that would make sense. Yeah didn’t realise there were two versions. Thats frustrating! Thanks for your help anyway.

2 Likes

No worries at all Jashuva!
It was a good exercise in troubleshooting!

If you need a hand with any future projects feel free to pop back over to the forum and wer’e happy to help out! :smiley:
Happy Making!
Liam

1 Like