AT Network Provisioning Examples

[中文]

This document mainly introduces the following network provisioning methods supported by ESP-AT:

Summary of Key Parameters for Provisioning Methods

Provisioning Method

BluFi Provisioning

SmartConfig Provisioning

SoftAP Provisioning

WPS Provisioning

Default Firmware Support

icon-green-check

icon-green-check

icon-red-cross (Note 1)

icon-green-check

Requires BLE

icon-green-check

icon-red-cross

icon-red-cross

icon-red-cross

Requires Additional Mobile App

icon-green-check

icon-green-check (Note 2)

icon-green-check

icon-red-cross

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.

  1. Install the EspBluFi app on your mobile device.

  2. Set the BluFi name on the ESP32 device.

    Command:

    AT+BLUFINAME="blufi_test"
    

    Response:

    OK
    
  3. Enable BluFi on the ESP32 device.

    Command:

    AT+BLUFI=1
    

    Response:

    OK
    
  4. 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, click Connect 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 to Configure page. Enter the Wi-Fi SSID and password, then click OK 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
    
  5. (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
    
  6. 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

  1. Install the EspTouch app on your mobile device.

  2. Set the ESP device to Station mode.

    Command:

    AT+CWMODE=1
    

    Response:

    OK
    
  3. Enable SmartConfig on the ESP32 device.

    Command:

    AT+CWSTARTSMART=4,0,"1234567890123456"
    

    Response:

    OK
    
  4. 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
    
  5. 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.

  6. 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

  1. Prepare a router that supports WPS provisioning (e.g., Wi-Fi SSID: test).

  2. Set the ESP device to Station mode.

    Command:

    AT+CWMODE=1
    

    Response:

    OK
    
  3. 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
    
  4. Query the Wi-Fi information of the connected ESP32 device.

    Command:

    AT+CWJAP?
    

    Response:

    +CWJAP:"test",......
    OK
    
  5. Disable WPS provisioning on the ESP32 device.

    Command:

    AT+WPS=0
    

    Response:

    OK