Skip to content

Wi-Fi Connection

Connecting to a Wi-Fi Network

Connect to the pico-jxgLABO shell on the Pico board via USB serial, and use the net shell command for network operations. First, use the wifi-scan subcommand to find available access points:

L:/>net wifi-scan
ssid:MyHome-WiFi                      rssi: -68 channel:  8 mac:xx:xx:xx:xx:xx:xx security:5
ssid:A12345678                        rssi: -75 channel: 11 mac:xx:xx:xx:xx:xx:xx security:7
ssid:LivingRoomAP                     rssi: -76 channel:  4 mac:xx:xx:xx:xx:xx:xx security:7
ssid:HUMIN-4512                       rssi: -76 channel:  4 mac:xx:xx:xx:xx:xx:xx security:7

Connect to a Wi-Fi router with the wifi-connect subcommand, specifying SSID and password:

L:/>net wifi-connect {ssid:'MyHome-WiFi' password:'PASSWORD'}
Connected ssid:'MyHome-WiFi' auth:wpa2 addr:192.168.0.20 netmask:255.255.255.0 gateway:192.168.0.1

In this example, DHCP assigns IP address 192.168.0.20, netmask 255.255.255.0, and gateway 192.168.0.1.

Note

Some Wi-Fi routers may not work well with the Pico board. If your host PC is Windows, you can use the mobile hotspot feature as an access point. This is also safer than using a Wi-Fi router, so give it a try.

To set a static IP address, use the config subcommand. The example below sets the IP to 192.168.0.101:

L:/>net config {addr:192.168.0.101}
Connected ssid:'MyHome-WiFi' auth:wpa2 addr:192.168.0.101 netmask:255.255.255.0 gateway:192.168.0.1

You can also specify netmask and gateway, but these must match the values assigned by DHCP when connecting to the access point, so usually you only specify the IP address.

You can execute wifi-connect and config in a single command:

L:/>net wifi-connect {ssid:'MyHome-WiFi' password:'PASSWORD'} config {addr:192.168.0.101}