This project is a Wi-Fi connection utility written for the ESP8266.
Feel free to submit Issues and PRs to improve the project together.
Modify and add your own logic based on the comments. You can also customize the HTML/CSS interface.
The default is Device Connect, which you can modify.
Note: The Wi-Fi name has a length limit. Exceeding it will cause errors.
Convert your image to Base64 and replace the corresponding Base64 field in the code.
You can customize the interface style and design your own provisioning page.
Note: The logo is loaded via JS code. Ensure the element ID matches the one in the JS code. See details below.
Request (GET): http://192.168.4.1/WiFiList
Response: Wi-Fi names wrapped in <option> and </option>
Request (GET): http://192.168.4.1/connectWifi
| Field | Meaning |
|---|---|
| ssid | Target Wi-Fi name |
| password | Wi-Fi password |
Request (GET): http://192.168.4.1/img1
Note: This returns a JS code snippet, not the Base64-encoded image. If customizing HTML, refer to the example HTML and modify the corresponding element ID.
Request (GET): http://192.168.4.1/css
After powering on, the device will attempt to connect to the last saved Wi-Fi within 10 seconds. If it fails, the provisioning mode will activate automatically.
The 10-second timeout can be adjusted in the code.
-
Use a phone, computer, or other device to connect to the Wi-Fi named
Device Connect. -
After connecting, the configuration page will open automatically.
If it doesn’t, manually visit
http://192.168.4.1/in a browser. -
Follow the prompts to select a Wi-Fi network and enter the password.
-
After clicking "Connect," the webpage will close, and the device will reboot. If it still fails to connect within 10 seconds, repeat the steps.
Note: The device does not wait for a successful connection before exiting the provisioning page. Regardless of success (or password correctness), it will reboot and only attempt to connect within the 10-second window.