TinyWifiDongle เปลี่ยน ESP32-S3 เป็น USB WiFi Adapter
ถ้า WiFi ใน Notebook พัง แต่มี ESP32-S3 หรือ Raspberry Pi Pico 2 W อยู่ใกล้มือ Project นี้เสนอทางแก้แบบ Maker มาก ๆ: เปลี่ยน Microcontroller ให้กลายเป็น USB WiFi Adapter
TinyWifiDongle ของ Phil Schatzmann ทำให้ Computer มองเห็น Board เป็น Network Adapter ผ่าน USB CDC-NCM แล้ว Bridge Ethernet Frames ต่อออกไปยัง WiFi Network
User Sketch ขั้นต่ำดูเหมือนมีเพียงไม่กี่บรรทัด แต่เบื้องหลัง Library จัดการทั้ง USB Networking, WiFi Frame Bridge, Buffer, Logging และ Recovery ให้
- TinyWifiDongle เป็น Header-only Arduino C++ Library
- USB ฝั่ง PC ใช้ CDC-NCM Network Class
- MCU ทำ Layer-2 Bridge ระหว่าง USB และ WiFi
- PC รับ IP จาก Router DHCP โดยตรง
- ESP32-S3 ทดสอบได้ประมาณ 600 KB/s
- Raspberry Pi Pico 2 W ทดสอบได้ประมาณ 250 KB/s
- Linux, macOS และ Windows 11 มี CDC-NCM Driver ในตัว
- มี Browser Setup Portal, Logging และ USB Stall Recovery
TinyWifiDongle คืออะไร?
TinyWifiDongle เป็น Arduino Library ที่เปลี่ยน Microcontroller ที่มีทั้ง WiFi และ USB Device Controller ให้กลายเป็น USB Network Adapter
Board เชื่อม WiFi Network ขณะที่ Computer เชื่อม Board ผ่าน USB
จากมุมของ Computer มันเห็น Network Interface ใหม่ เหมือนเสียบ USB Ethernet/WiFi Adapter
แต่ TinyWifiDongle ไม่ได้สร้าง NAT Router ขึ้นมาบน MCU เพราะมันทำงานเป็น Layer-2 Bridge
“4 Lines of C++” จริงไหม?
จริงในแง่ User Sketch ขั้นต่ำ เพราะ Logic หลักถูกซ่อนอยู่ใน Library
#include "TinyWifiDongle.h"
TinyWifiDongle dongle;
void setup() { dongle.begin("ssid", "password"); }
void loop() {}
Architecture ทำงานอย่างไร?
Official Source ระบุว่า Ethernet Frames ถูก Forward โดยไม่เปลี่ยนแปลงระหว่าง USB กับ WiFi
PC จึงเป็น Client ปกติ ของ WiFi Network และได้ IP Address จาก DHCP Server ของ Router
MCU เองไม่ต้องทำ NAT หรือ DHCP Server สำหรับ Bridge นี้
Source ของ `L2Bridge.h` ยังมี Logic ป้องกัน Frame ที่มี Foreign Source MAC และกรอง Broadcast Frame ที่ Access Point Echo กลับมา
Platform ไหนรองรับ?
| Platform | Arduino Core | สถานะจาก Source |
|---|---|---|
| ESP32-S3 | arduino-esp32 3.x | Works / Tested |
| ESP32-S2 | arduino-esp32 3.x | Supported |
| Raspberry Pi Pico 2 W | arduino-pico | Works / Tested |
| Raspberry Pi Pico W | arduino-pico | Supported แต่ Source ระบุว่ายัง Untested |
| ESP32-P4 | arduino-esp32 3.x | Compile ได้, WiFi side tested; USB side มี Caveat |
Platform ที่ README ระบุว่าไม่รองรับ
- Original ESP32
- ESP32-C3
- ESP32-C6
- Chip ที่ไม่มี USB Device Controller สำหรับ Network Class
- Raspberry Pi Pico รุ่นไม่มี WiFi
- Arduino mbed cores
ความเร็วจริงไม่ได้ระดับ WiFi Adapter ของ PC
| Platform | Throughput ที่ Source รายงาน |
|---|---|
| ESP32-S3 | ประมาณ 600 KB/s |
| Raspberry Pi Pico 2 W | ประมาณ 250 KB/s |
Official README อธิบายว่า Full-speed USB ของ Chip เหล่านี้ ทำงานที่ 12 Mbit/s และเป็นข้อจำกัดสำคัญของระบบ
ความเร็วระดับนี้ เพียงพอกับ Browsing, Download เบา ๆ หรือใช้ชั่วคราวเพื่อโหลด Network Driver แต่ Source ไม่แนะนำให้คาดหวัง Gigabit-class Performance
USB Setup ต่างกันตาม Platform
ESP32-S2 / ESP32-S3
README ระบุให้ตั้ง:
- USB Mode: USB-OTG (TinyUSB)
- ต่อ Computer เข้ากับ USB-OTG port
Raspberry Pi Pico W / Pico 2 W
ใช้ Default:
- USB Stack: Pico SDK
- ใช้ USB connector ของ Board เชื่อมกับ PC
WiFi Credentials ใส่ตรง Code หรือ Setup ผ่าน Browser ก็ได้
วิธีง่ายที่สุด: ใส่ SSID / Password ใน Sketch
Minimal Example ส่ง Credential เข้า `dongle.begin()`
ไม่อยาก Hard-code: ใช้ Setup Portal
Official `WifiManager.ino` ใช้ `TinyWifiDongleSetup` เพื่อเปิด Setup Network ชั่วคราว
- Board เปิด WiFi ชื่อ TinyWifiDongle-Setup
- เชื่อม Smartphone หรือ Laptop เข้า Network นี้
- Setup page เปิดขึ้นมา หรือเข้าที่ 192.168.4.1
- เลือก WiFi Network
- ใส่ Password และ Save
- Credential ถูกเก็บใน Flash
Logging / Monitoring ถูกเตรียมมาให้ใน Library
TinyWifiDongle ใช้ `TWD_LOGGER` และสามารถส่งข้อความไปยัง Arduino `Print` เช่น Serial
#include "TinyWifiDongle.h"
TinyWifiDongle dongle;
void setup() {
Serial.begin(115200);
TWD_LOGGER.begin(Serial);
if (!dongle.begin("my-ssid", "my-password")) {
while (true) delay(1000);
}
}
void loop() {
delay(1000);
}
Config ยังมี `statsIntervalMs` สำหรับ Status Line ระหว่าง Debug
USB Stall Recovery มีอยู่ใน ESP32 Implementation
`TinyWifiDongleConfig` มีค่า: stallTimeoutMs
Default ใน Current Source คือ 1000 ms
หาก USB Send Path ไม่มี Progress เกิน Threshold Implementation สามารถ Disconnect และ Re-enumerate USB เพื่อให้ Host มองเหมือน Network Adapter ถูกถอดและเสียบใหม่
Pico ใช้ Frame Buffer Pool แยกสองทิศทาง
RP2040/RP2350 implementation แยก Buffer สำหรับ:
- Frames ไปยัง Host
- Frames มาจาก Host
เพื่อไม่ให้ Burst ฝั่ง Download ใช้ Buffer จนหมด แล้วทำให้ ACK หรือ Frames ฝั่งกลับไม่มีพื้นที่
| Platform | To Host | From Host |
|---|---|---|
| RP2350 / Pico 2 W | 48 buffers | 16 buffers |
| RP2040 / Pico W | 24 buffers | 8 buffers |
Source ระบุว่า Buffer แต่ละ Frame ใช้หน่วยความจำประมาณ 1.5 KB และการเพิ่มจำนวน Buffer แลกกับการใช้ RAM มากขึ้น
Code หลักจริงอยู่ใน Library ไม่ใช่แค่ Sketch
Main User Sketch สั้น เพราะ Project แยกส่วนสำคัญออกเป็น:
- TinyWifiDongle.h
- L2Bridge.h
- ESP32 USB NCM implementation
- RP2040 / RP2350 USB NCM implementation
- WiFi Frame Link
- Setup Portal
- Logger
จึงเหมาะทั้งสำหรับคนที่ต้องการ “Flash แล้วใช้” และ Developer ที่อยากศึกษาว่า USB Network Class กับ WiFi Layer-2 Bridge เชื่อมเข้าหากันอย่างไร
Source Code, Release และ Documentation
Project / Release
Official Examples
Library Source
Documentation / Wiki
Media Audit: รูปและ Video ครบไหม?
| Media | สถานะ |
|---|---|
| Hackaday Hero Image | มี และ Embed แล้ว |
| Project Image ใน GitHub Repo | ไม่พบ Project PNG/JPG/SVG |
| Original Phil Article Project Image | ไม่พบ Direct Project Image เพิ่มที่ Verify ได้ |
| Dedicated YouTube Video | ไม่พบ |
| MP4 / WebM / MOV ใน Repository | ไม่พบ |
คำว่า “$5 Microcontroller” เท่ากับกี่บาท?
บทความต้นทางของ Phil ใช้ชื่อว่า “Turn a $5 Microcontroller into a USB WiFi Dongle”
แต่ตัวเลขนี้ไม่ใช่ราคา TinyWifiDongle และไม่ได้ระบุว่า Board รุ่นใด ต้องขายในราคา US$5 เสมอ
คำนวณจากอัตราอ้างอิงประมาณ US$1 = ฿33.96 วันที่ 23 พฤศจิกายน 2026
มี Video ของ TinyWifiDongle หรือไม่?
จาก Hackaday, Original Article และ Official GitHub Repository ยังไม่พบ Dedicated YouTube, MP4, WebM หรือ MOV สำหรับ TinyWifiDongle Project นี้
ดังนั้น HTML นี้ไม่มี iframe และไม่เอาวิดีโอ USB WiFi Adapter จาก Project อื่นมาปน
FAQ คำถามที่พบบ่อย
TinyWifiDongle คืออะไร?
เป็น Arduino C++ Library ที่เปลี่ยน Microcontroller ที่รองรับ WiFi และ USB Network Device ให้เป็น USB WiFi Adapter
ใช้กับ ESP32-S3 ได้หรือไม่?
ได้ และ Official Source ระบุว่า Tested แล้ว
ใช้กับ ESP32-S2 ได้หรือไม่?
รองรับตาม README
ใช้กับ ESP32-C3 หรือ C6 ได้หรือไม่?
README ระบุว่าไม่รองรับ
ใช้กับ Raspberry Pi Pico 2 W ได้หรือไม่?
ได้ และ Official Source ระบุว่า Tested แล้ว
Pico W รุ่น RP2040 ใช้ได้หรือไม่?
Source ระบุว่ารองรับ แต่ยัง Untested
ต้องลง Driver บน PC หรือไม่?
Linux, macOS และ Windows 11 มี CDC-NCM Driver ในตัว ส่วน Windows 10 ต้องใช้ Driver เพิ่ม
ESP32-S3 ได้ความเร็วเท่าไร?
ประมาณ 600 KB/s ใน Project Test
Pico 2 W ได้ความเร็วเท่าไร?
ประมาณ 250 KB/s ใน Project Test
ทำไมไม่เร็วระดับ WiFi ปกติของ Notebook?
Official Source ระบุว่า Full-speed USB 12 Mbit/s เป็นข้อจำกัดหลักของ Chip เหล่านี้
MCU ทำ NAT หรือไม่?
ไม่ Architecture ใช้ Layer-2 Bridge ระหว่าง USB และ WiFi
PC ได้ IP จากไหน?
จาก DHCP Server ของ Router เหมือน WiFi Client ปกติ
MCU มี IP Address ของ Bridge เองหรือไม่?
README ระบุว่า MCU เองไม่มี IP Address สำหรับ Layer-2 Bridge นี้
ต้อง Hard-code WiFi Password หรือไม่?
ไม่ จำเป็นสามารถใช้ Browser Setup Portal ได้
มี Logging หรือไม่?
มีผ่าน `TWD_LOGGER` และสามารถใช้ Arduino `Print` เป็น Output
มี Release หรือไม่?
มี Release v0.1.0 ชื่อ First Release
License คืออะไร?
MIT License
มี STL หรือ PCB Files หรือไม่?
Current Repository ไม่พบ STL, CAD, PCB หรือ Gerber
มีวิดีโอหรือไม่?
จาก Source ที่ตรวจสอบ ยังไม่พบ Dedicated Video
ราคา Project เท่าไร?
Source ไม่ได้ระบุ Total Project Cost ส่วน US$5 เป็นเพียงตัวเลขในชื่อบทความต้นทาง
ทำไม Project นี้น่าสนใจสำหรับ Maker?
ถ้ามองจากภายนอก TinyWifiDongle ดูเหมือน Trick ง่าย ๆ: Flash Board แล้วเสียบ USB
แต่ข้างในมี Concept ที่น่าสนใจมากกว่า: USB Network Class, Ethernet Frames, MAC Address, Layer-2 Bridge, WiFi Frame Link, Buffering และ Platform-specific USB implementation
จึงเป็น Project ที่ดี สำหรับคนที่อยากศึกษา Networking ในระดับต่ำกว่า HTTP หรือ TCP Socket แต่ยังสามารถนำไปใช้งานจริงได้
โปรเจกต์นี้มีหลายส่วน แนะนำอ่านต้นฉบับควบคู่กัน
References / แหล่งข้อมูลต้นฉบับ
กำลังทำ ESP32, Raspberry Pi Pico หรือ Networking Project?
TinyWifiDongle เป็นตัวอย่างว่า Development Board ธรรมดา สามารถทำงานเป็น USB Network Device ได้มากกว่าการเปิด Web Server บน WiFi
หากกำลังทำ ESP32, Raspberry Pi Pico, USB, IoT หรือ Networking Project สามารถสอบถามทีม Globalbyte เรื่องบอร์ดและอุปกรณ์ที่เหมาะกับ Project ได้