AT Network Provisioning Examples
This document mainly introduces the following network provisioning methods supported by ESP-AT:
Provisioning Method |
BluFi Provisioning |
SmartConfig Provisioning |
SoftAP Provisioning |
WPS Provisioning |
---|---|---|---|---|
Default Firmware Support |
(Note 1) |
|||
Requires BLE |
||||
Requires Additional Mobile App |
(Note 2) |
|||
Provisioning Success Rate |
High |
Moderate |
High |
High |
Operation Complexity |
Simple |
Simple |
Complex |
Complex |
Recommendation Level |
Recommended |
Moderate |
Moderate |
Moderate |
Note 1: If you want to enable SoftAP provisioning in the AT firmware, please refer to: Web Server AT Commands.
Note 2: The AirKiss provisioning in SmartConfig requires the WeChat app, which may be unavailable to users outside China.
BluFi Provisioning
BluFi is a Wi-Fi configuration feature based on the Bluetooth channel. For more information, please refer to the BluFi documentation.
Install the EspBluFi app on your mobile device.
Set the BluFi name on the ESP32 device.
Command:
AT+BLUFINAME="blufi_test"
Response:
OK
Enable BluFi on the ESP32 device.
Command:
AT+BLUFI=1
Response:
OK
Establish BluFi connection on your mobile device and perform Wi-Fi provisioning.
4.1 BluFi Connection
Enable the system’s Bluetooth and GPS location services on your mobile device, then launch the EspBluFi app. Find the device named
blufi_test
and click it to enter. Next, clickConnect
to establish a connection. At this point, the ESP device should log something similar to+BLUFICONN
, and the app will display the below information, indicating that the BluFi connection has been successfully established.Connected <mac> Discover service and characteristics success Set notification enable complete Set mtu complete, mtu=...
4.2 BluFi Wi-Fi Provisioning
After the connection is established, click
Configure
button in the EspBluFi app. The page will navigate toConfigure
page. Enter the Wi-Fi SSID and password, then clickOK
button to start provisioning. After a short wait, the app will display the below information.Post configure params complete Receive device status response: OpMode: Station Station connect Wi-Fi now Station connect Wi-Fi bssid: <mac> Station connect Wi-Fi ssid: <ssid>
4.3 Successful Provisioning
Please wait for a moment, and the ESP device will output the following logs. At this point, the ESP device’s network configuration is successfully completed.
WIFI CONNECTED WIFI GOT IP
(Optional) Send custom user data via BluFi on the ESP32 device.
Command:
AT+BLUFISEND=4
Response:
>
Input 4 bytes of data, for example, if the input data is
test
, then AT will output the following information.OK
At this point, the app will display the below information:
Receive custom data: test
Disable BluFi on the ESP32 device.
Command:
AT+BLUFI=0
Response:
+BLUFIDISCONN OK
At this point, the app will display the below information:
Disconnect <mac>, status=19
SmartConfig Provisioning
AT SmartConfig provisioning offers four types: ESP-TOUCH, AirKiss, ESP-TOUCH+AirKiss, and ESP-TOUCH v2. Below are examples of ESP-TOUCH v2 provisioning.
ESP-TOUCH v2 Provisioning Example
Install the EspTouch app on your mobile device.
Set the ESP device to Station mode.
Command:
AT+CWMODE=1
Response:
OK
Enable SmartConfig on the ESP32 device.
Command:
AT+CWSTARTSMART=4,0,"1234567890123456"
Response:
OK
Perform Wi-Fi provisioning on your mobile device.
Please follow the steps below: enable Wi-Fi on your mobile device and connect to the target network (e.g., SSID: test, password: 1234567890). Then, launch the EspTouch application and click
EspTouch V2
button. On the redirected page, enter the password for the connected Wi-Fi, the number of devices for provisioning, and the AES key, as shown below:Wi-Fi Password: 1234567890 Device Count for Provisioning: 1 AES Key: 1234567890123456
Confirm the successful provisioning on the ESP device.
At this point, the ESP device should output the below information:
smartconfig type:ESPTOUCH_V2 Smart get wifi info ssid:test password:1234567890 WIFI CONNECTED WIFI GOT IP smartconfig connected wifi
At this point, the ESP device’s provisioning has been successfully completed.
Disable SmartConfig on the ESP32 device.
Command:
AT+CWSTOPSMART
Response:
OK
SoftAP Provisioning
AT SoftAP provisioning refers to WEB provisioning. For more details, please refer to Web Server AT Examples.
WPS Provisioning
Prepare a router that supports WPS provisioning (e.g., Wi-Fi SSID: test).
Set the ESP device to Station mode.
Command:
AT+CWMODE=1
Response:
OK
Enable WPS provisioning on the ESP32 device.
Command:
AT+WPS=1
Response:
OK
Enable the WPS provisioning according to the router’s user manual, and wait for a moment. The ESP device should output the below information, indicating that the provisioning has been successfully completed.
WIFI CONNECTED WIFI GOT IP
Query the Wi-Fi information of the connected ESP32 device.
Command:
AT+CWJAP?
Response:
+CWJAP:"test",...... OK
Disable WPS provisioning on the ESP32 device.
Command:
AT+WPS=0
Response:
OK