foreword
There are three commonly used wifi network distribution methods for wireless modules designed by Espressif based on Espressif chips: smart distribution network, hotspot distribution network and Bluetooth distribution network;
two commonly used methods for intelligent distribution network: ESP-TOUCH APP for network distribution and WeChat Airkiss realizes distribution network. The Bluetooth distribution network is mainly completed through the BLUFI distribution network protocol. Today's topic is the application of hotspot distribution network. This time we use the hotspot distribution network based on WeChat applet. In addition to the network distribution function, the applet also has an OTA upgrade function.
1. Web service distribution network
The principle of the web service distribution network is that the module opens the hotspot, builds an HTTP server, and the WeChat applet serves as the client connection module, and sends the specified wifi account password to the module. After the module parses out the specified wifi account password, it connects to the specified wifi.
2. Operation process
1. Burn AT firmware with web service function
The factory firmware of Anxinke ESP32S does not have Web service function. Therefore, if users want to use this function, they must burn the firmware with Web service function. The download link of this firmware is: https://docs.ai-thinker.com/_media/ web_esp32-s_dio-v2.2.0_Uart0.zip Anxinke
ESP12S factory firmware does not have Web service function, so if users want to use this function, they must burn the firmware with Web service function, the download link of the firmware: https:/ /docs.ai-thinker.com/_media/esp8266_rxio3_txio1_at_web_ota.rar
2. Web service distribution network process
2.1 ESP-12S/ESP32-S to build a web server
After the ESP-12S/ESP32-S module has burned the firmware, enter the following commands to complete the web service construction:
AT+RESTORE //清除之前的配网信息
AT+CWMODE=3 //配置 ESP 设备为 Station + SoftAP 模式
AT+CWSAP="pos_softap","espressif",11,0,3 //设置 SoftAP 的 ssid 和 password
AT+CIPMUX=1 //使能多连接
AT+WEBSERVER=1,80,25 //开启Web服务
Note:
In the web service distribution network implemented by the WeChat applet, the SSID and PASSWORD of the hotspot of the ESP-12S module/ESP32S module can only be set to "pos_softap" and "espressif". Once the settings are wrong, the network distribution will fail.
2.2 Operations of WeChat Mini Programs
- Scan the QR code below or enter "ESP-AT" in the applet search box to enter the network configuration interface: The
configuration network operation interface is as follows:
Enter the account and password of the specified wifi in the hotspot network configuration interface, and click "Start network configuration" .
If the network configuration is successful, the interface will display the prompt "Network configuration successful" :
3. Web service OTA upgrade operation process
After the network distribution function is completed, keep the Web service connection, and we can also complete the OTA upgrade function.
3.1. Preparation of new firmware
To upgrade the firmware, we use the compiled AT firmware, the path of the firmware is: esp-at\build\esp-at.bin
to transfer the firmware to any chat window on WeChat.
3.2. WeChat applet operation
Switch the OTA upgrade function interface, click Browse, select the upgrade firmware just uploaded, and click Firmware Upgrade:
After the OTA upgrade is successful, the upgrade interface will display "Upgrade Successful" :
more info
The above is the content shared in this issue. The purpose is to allow everyone to quickly adapt to the development of new product solutions. For more information, visit the following links
Official website: https://www.ai-thinker.com
Development information: https://docs.ai-thinker.com
Official forum: http://bbs.ai-thinker.com
Company address: West of Bao'an District, Shenzhen 410, Building C, Huafeng Smart Innovation Port, Xianggushu