Use this quick runbook to bring one Pico device online after initial setup.

Get the repository from: djaus2/iothub-fast-setup

  • Setup and work though the workflows for the simulators.
  • Setup according to documentation in folders 5_PicoW and 5a_PicoW
  • Then …

1. Set target device identity

Pick the device number (N) so firmware gets the right deviceId and key.

.\5a_PicoW\set_picow_device_env.ps1

2. Set Wi-Fi and hub values in the same terminal

Use your preferred option. Example:

.\5a_PicoW\set_iot_env.ps1 -WifiPassword "<your-wifi-password>" -IotHubName "my-iot-123"

Optional (if needed):

.\5a_PicoW\set_com_port_env.ps1

3. Build and upload firmware

Check build

 .\5a_PicoW\build_upload_pico.ps1 -SketchPath .\5a_PicoW\pico_firmware\pico_firmware.ino -Action build 

Upload

.\5a_PicoW\build_upload_pico.ps1 -SketchPath .\5a_PicoW\pico_firmware\pico_firmware.ino -Action upload

Notes:

  • The script prints the effective device id (for example Using device id: picow1).
  • If upload says No drive to deploy
    • Disconnect the device (USB port)
    • Press and hold the BOOTSEL button whilst reconnecting
    • Then press Enter to retry.
  • Rerun the upload.

Sample upload output

S C:\temp\iothub> .\5a_PicoW\build_upload_pico.ps1 -SketchPath .\5a_PicoW\pico_firmware\pico_firmware.ino -Action upload
Auto-selected Pico W2 FQBN.
Using FQBN: rp2040:rp2040:rpipico2w:ipbtstack=ipv4only,arch=arm
Using IoT Hub FQDN from environment: My-IoT-123.azure-devices.net
Using Wi-Fi SSID from environment.
Using Wi-Fi password from environment.
Using device id from environment: picow1
Using device primary key from environment.
Using device id: picow1
Using upload port: COM3
Sketch uses 467504 bytes (11%) of program storage space. Maximum is 4186112 bytes.
Global variables use 73460 bytes (14%) of dynamic memory, leaving 450828 bytes for local variables. Maximum is 524288 bytes.
Resetting COM3
Converting to uf2, output size: 974848, start address: 0x2000
Scanning for RP2040 devices
No drive to deploy.
Failed uploading: uploading error: exit status 1
WARNING: UF2 drive was not found. This usually means the board is not in BOOTSEL mode.
Please press and hold BOOTSEL, tap RESET (or reconnect USB), then release BOOTSEL once RPI-RP2 appears.
Press Enter to retry upload after the board is in UF2 mode: 
Resetting COM3
Converting to uf2, output size: 974848, start address: 0x2000
Scanning for RP2040 devices
Flashing D: (RP2350)
Wrote 974848 bytes to D:/NEW.UF2
New upload port: COM3 (serial)

4. Check in Azure IoT Explorer

Assume Azure IoT Explorer is already installed.

Get the IoT Hub connection string:

az iot hub connection-string show --hub-name my-iot-123 --policy-name iothubowner --query connectionString -o tsv

In Azure IoT Explorer:

  • Add connection using the hub connection string.
  • Open picow1 or picow2 under devices.
  • Watch connection status and telemetry/messages etc while the device starts.

5. Watch serial logs

Use your detected COM port:

arduino-cli --config-dir .\5a_PicoW\.arduino-cli monitor -p COM3 -c baudrate=115200

Healthy startup usually shows:

  • Pico firmware starting
  • Connecting to WIFI SSID …
  • Connected flow (without endless reconnect loop)

6. Confirm cloud connectivity

For picow1:

az iot hub monitor-events --hub-name my-iot-123 --device-id picow1

You can also check state directly:

az iot hub device-identity show --hub-name my-iot-123 --device-id picow1 --query "{connectionState:connectionState,lastActivityTime:lastActivityTime,status:status}" -o json

Quick troubleshooting

  • Disconnected with no activity:
    • Re-run steps 1 and 2 in the same terminal, then upload again.
  • Upload fails with No drive to deploy:
    • Put board in BOOTSEL/UF2 mode and retry.
  • No telemetry events:
    • Verify the selected device id matches the flashed board and IoT Hub device entry.

  • Have successfully provisioned 2 RPI Pico W 2 devices and uploaded firmware to them.
  • Verified twin values and telemetry.
  • Both viewable and able to be interrogated in Azure IoT Explorer :).

ToDo

Multi device setup. O-T-A updates for Pico W, and ADU workflow for Pico W.


 TopicSubtopic
  Next: > IoT Hub
<  Prev:   IoT Hub
   
 This Category Links 
Category:IoT Index:IoT