This guide shows how to use WiFiManager on the UNIHIKER K10 (ESP32) so users can configure WiFi via their phone by connecting to a temporary AP (K10_Config). The device will display status and IP on its screen and sync time via NTP.
- Open VSCode Package Manager
- Search for the official
platformio ideextension
Install PlatformIO IDE.
Click on “PlatformIO Home” button on the bottom PlatformIO Toolbar
Click on “New Project”, select a random DFRobot board and create new PlatformIO Project.
Open platformio.ini file, then copy and paste the following configure text in it. And use ctrl+s to save the configure file.Wait for the SDK download.
[env:unihiker]
platform = https://github.com/DFRobot/platform-unihiker.git
board = unihiker_k10
framework = arduino
build_flags =
-DARDUINO_USB_CDC_ON_BOOT=1
-DARDUINO_USB_MODE=1
-DModel=None
PlatformIO:
- In platformio.ini add:
lib_deps =
tzapu/WiFiManager@^0.16.0
- Or run:
pio lib install "WiFiManager"
Arduino IDE:
- Open Library Manager → search "WiFiManager" → install tzapu / ESP32-compatible version.1. Power on the K10. It opens an AP named `K10_Config`.
2. On your phone open Wi‑Fi settings and connect to `K10_Config` (usually open).
3. Open a browser (or it may auto-redirect) and go to `http://192.168.4.1`.
4. Enter your home WiFi SSID and password, submit.
5. K10 will attempt to connect to the provided network. On success it shows `Connected` and `IP: x.x.x.x`, then syncs NTP time.
##Key Code Points
- Start config portal:
wifiManager.startConfigPortal("K10_Config");
- AP callback for UI:
wifiManager.setAPCallback(...)
- Save callback:
wifiManager.setSaveConfigCallback(...)
- Clear stored credentials (long press):
wifiManager.resetSettings(); WiFi.disconnect(true, true);
- Auto-connect uses WiFi.begin() or WiFiManager.autoConnect().
##Button Behavior
- Short press A: open config portal.
- Long press A (≈3s): clear saved WiFi credentials and restart portal.
## Tips for Display
- Keep each displayed line short and place IP on its own line to avoid truncation.
- Use landscape orientation if text is wider.
## Troubleshooting
- If browser doesn’t open automatically, visit: http://192.168.4.1
- If not connecting after setup: verify SSID/password and router settings (e.g., MAC filtering).
- Compilation error referencing `ESP8266WiFi.h`: ensure you're using the ESP32-compatible WiFiManager and include `<WiFi.h>` for ESP32.
## Conclusion
This approach allows non-technical users to configure WiFi on-site using their phone without editing code. The provided example displays concise English messages and ensures the IP/date/time are visible after connection.









Comments