The ThingsInNet ESP32 Devkits are popular among IoT fans for their unmatchable reliable options, versatility, durability, and ease of use. However, just like other devkits in the market, manually configuring Wi-Fi credentials or making frequent changes to them on these devices can be cumbersome. This blog post presents a web portal designed to streamline the Wi-Fi provisioning process for ThingsInNet ESP32 IoT devices as a solution to the problem. Note that the program code and instructions provided in this article are also applicable to other ESP32 devkits available in the market.
The program code is available on GitHub, and you may download and use it in your project.
The program uses a set of key libraries for Wi-Fi management, web server functionality, and EEPROM storage on ESP32 devkit. On startup, the device attempts to connect to a Wi-Fi network using stored credentials. If connected, it executes custom code (indicated by "YOUR CODE WILL RUN HERE"). If it fails, it initiates a hotspot named "Master_AP001" without a password. Devices can then connect to this hotspot and access the dedicated configuration webpage shown in Figure 1.
Connect to Master_AP001: To access the configuration webpage shown in Figure 1, first connect to the "Master_AP001" hotspot Wi-Fi network from the Wi-Fi settings of your computer or mobile device.
Access the Configuration Webpage:Â Once connected to the "Master_AP001" hotspot, open a web browser and navigate to the IP address of the ESP32 device from your computer or mobile device. Typically, this would be 192.168.4.1Â or similar, but you can find it displayed on the Serial Monitor when the IoT device is in hotspot mode.
Scan Available Networks:Â On the configuration webpage, click on the "Scan" button. This will search for and display a list of available Wi-Fi networks in your vicinity.
Spot the New Wi-Fi Network:Â From the list of scanned networks, identify the Wi-Fi network (SSID) you wish to connect.
Enter New Credentials:Â Go back to the Wi-Fi configuration window and enter the SSID. Then input the correct password into the provided field and submit.
Save and Restart:Â Once submit the credentials, the ESP32 devkit will securely store these new credentials in its EEPROM memory. After saving, the device will automatically restart to apply the changes and attempt to connect to the newly configured Wi-Fi network.
Verify Connection:Â After the restart, the ESP32 devkit will try to connect to the newly configured Wi-Fi network using the provided credentials. You can check the Serial Monitor for messages indicating a successful connection. Alternatively, the device's LED 2 connected to GPIO2 shows blinks and indicates status.
Reset Wi-Fi Password or Network:Â
Press the button (S1) connected to GPIO pin 34 in ThingsInNet ESP32 devkits for 5 seconds to reset the Wi-Fi credentials. After pressing the button, the device creates a hotspot called "Master_AP001" with no password. Connect your device to this hotspot and go to the provided configuration webpage. Follow the steps above 1 to 7Â for resetting.
Advantages:
User-Friendly Interface:Â The web portal eliminates the need for manual code modifications, making Wi-Fi setup intuitive and straightforward.
Persistent Storage:Â By utilizing EEPROM, the ESP32 retains Wi-Fi credentials across power cycles, reducing setup hassles.
Dynamic Configuration:Â Real-time Wi-Fi changes are facilitated, providing flexibility for varying network environments without reprogramming.
In conclusion, this ThingsInNet ESP32 Wi-Fi Configuration Web Portal offers an efficient and accessible method for managing Wi-Fi connections, catering to both novice and experienced developers alike. Since ESP32 NodeMCU can also utilize the same code for Wi-Fi provisioning, publishing this code on GitHub would undoubtedly benefit the ESP32 community by simplifying and enhancing Wi-Fi management in their projects.
Reference:
[1] "Change ESP8266 WiFi Credentials Without Uploading Code from Arduino IDE," Electronics Innovation. [Online]. Available: https://electronicsinnovation.com/change-esp8266-wifi-credentials-without-uploading-code-from-arduino-ide/
[2] "ESP32 Wi-Fi Provisioning using BLE with Arduino," Random Nerd Tutorials. [Online]. Available: https://randomnerdtutorials.com/esp32-wi-fi-provisioning-ble-arduino/Â
[3] "ESP32 Wi-Fi Manager: Making Wi-Fi Configuration Easy," DroneBot Workshop. [Online]. Available: https://dronebotworkshop.com/wifimanager/Â
ความคิดเห็น