Raspberry Pi Pico W as a USB Wi‑Fi Adapter
Raspberry Pi Pico W as a USB Wi‑Fi Adapter
Overview
The Pico W USB Wi‑Fi adapter project demonstrates how to repurpose a Raspberry Pi Pico W as a generic USB Ethernet device that tunnels traffic over its onboard 802.11 Wi‑Fi radio. This makes any host that supports USB networking (Windows, macOS, Linux, Android, etc.) instantly wireless without additional hardware.
Why It Matters
- Universal wireless bridge – A single, inexpensive microcontroller replaces dedicated USB‑Wi‑Fi dongles, reducing cost and simplifying inventory.
- Open‑source firmware – The firmware is hosted on GitLab (https://gitlab.com/baiyibai/pico-usb-wifi) and can be built with the official Pico SDK, allowing custom tweaks or integration into other projects.
- Low power & small form factor – The Pico W’s 2 × 20 mm board fits into tight spaces and draws only a few tens of milliamps when active, making it suitable for embedded or portable use cases.
How It Works
- USB CDC‑ECM (Ethernet Control Model) – The firmware implements the CDC‑ECM class, presenting the Pico W to the host as a virtual Ethernet adapter.
- Wi‑Fi station mode – The Pico connects to a configured Wi‑Fi network using its built‑in CYW43439 radio.
- Packet forwarding – Ethernet frames received over USB are encapsulated and sent over the Wi‑Fi interface; inbound Wi‑Fi packets are decapsulated and delivered to the host via USB.
- Configuration – Network credentials (SSID, password) and optional static IP settings are stored in the Pico’s flash and can be updated via a simple serial console or a small web UI (if compiled in).
Getting Started
Prerequisites
- Raspberry Pi Pico W board.
- A recent version of the Raspberry Pi Pico SDK (≥ 1.5.0).
- CMake and a suitable compiler toolchain (e.g., GNU Arm Embedded Toolchain).
- Access to a Wi‑Fi network for testing.
Build Steps
# Clone the repository
git clone https://gitlab.com/baiyibai/pico-usb-wifi.git
cd pico-usb-wifi
# Initialize submodules (if any)
git submodule update --init --recursive
# Create a build directory
mkdir build && cd build
# Configure with CMake, pointing to your Pico SDK path
cmake -DPICO_SDK_PATH=/path/to/pico-sdk ..
# Build the firmware
make -j$(nproc)
The resulting pico_usb_wifi.uf2 can be flashed by holding the BOOTSEL button and copying the file to the mounted USB mass‑storage device.
Runtime Configuration
After flashing, connect the Pico W to a host via USB. Open a serial terminal (115200 baud) to the Pico’s UART (or use the CDC‑ACM console if enabled). Use the provided commands to set Wi‑Fi credentials, for example:
> wifi_set ssid MyNetwork
> wifi_set pass MyPassword
> wifi_connect
The device will attempt to join the network and, upon success, the host will acquire an IP address via DHCP from the Wi‑Fi router.
Limitations and Known Issues
- Throughput – The CDC‑ECM implementation is limited by the USB 2.0 Full‑Speed endpoint (12 Mbps) and the Pico W’s Wi‑Fi radio, typically yielding 5–10 Mbps real‑world throughput.
- Driver support – Some older operating systems lack native CDC‑ECM drivers; in such cases, a custom driver or a different USB class (e.g., RNDIS) would be required.
- Security – The firmware does not currently support WPA3 or enterprise authentication methods; only WPA2‑PSK is implemented.
- Power management – The Pico W does not enter deep‑sleep while acting as a USB adapter, so power consumption remains at the active level.
Potential Extensions
- RNDIS or CDC‑NCM – Adding support for additional USB networking classes would broaden compatibility with Windows versions lacking CDC‑ECM.
- Static IP configuration UI – A lightweight web server could expose a configuration portal for headless setup.
- Packet inspection – Hooking into the forwarding path could enable simple firewall or traffic‑shaping features.
- Multi‑interface support – Combining the USB Ethernet function with other USB classes (e.g., HID) could create composite devices for specialized use cases.
Conclusion
The Raspberry Pi Pico W can be transformed into a functional USB Wi‑Fi adapter using open‑source firmware that implements the CDC‑ECM class and forwards traffic over the board’s built‑in Wi‑Fi radio. This solution provides a low‑cost, programmable bridge for any USB‑enabled host, while also offering a flexible platform for further networking experiments and custom extensions.