Wi-Fi AT Commands
AT+CWINIT: Initialize/Deinitialize Wi-Fi driver.
AT+CWMODE: Set the Wi-Fi mode (Station/SoftAP/Station+SoftAP).
AT+CWSTATE: Query the Wi-Fi state and Wi-Fi information.
AT+CWJAP: Connect to an AP.
AT+CWRECONNCFG: Query/Set the Wi-Fi reconnecting configuration.
AT+CWLAPOPT: Set the configuration for the command AT+CWLAP.
AT+CWLAP: List available APs.
AT+CWQAP: Disconnect from an AP.
AT+CWSAP: Query/Set the configuration of an ESP32-C3 SoftAP.
AT+CWLIF: Obtain IP address of the station that connects to an ESP32-C3 SoftAP.
AT+CWQIF: Disconnect stations from an ESP32-C3 SoftAP.
AT+CWDHCP: Enable/disable DHCP.
AT+CWDHCPS: Query/Set the IPv4 addresses allocated by an ESP32-C3 SoftAP DHCP server.
AT+CWAUTOCONN: Connect to an AP automatically when powered on.
AT+CWAPPROTO: Query/Set the 802.11 b/g/n protocol standard of SoftAP mode.
AT+CWSTAPROTO: Query/Set the 802.11 b/g/n protocol standard of station mode.
AT+CIPSTAMAC: Query/Set the MAC address of an ESP32-C3 station.
AT+CIPAPMAC: Query/Set the MAC address of an ESP32-C3 SoftAP.
AT+CIPSTA: Query/Set the IP address of an ESP32-C3 station.
AT+CIPAP: Query/Set the IP address of an ESP32-C3 SoftAP.
AT+CWSTARTSMART: Start SmartConfig.
AT+CWSTOPSMART: Stop SmartConfig.
AT+WPS: Enable the WPS function.
AT+CWJEAP: Connect to a WPA2 Enterprise AP.
AT+CWHOSTNAME: Query/Set the host name of an ESP32-C3 station.
AT+CWCOUNTRY: Query/Set the Wi-Fi Country Code.
Introduction
Important
The default AT firmware supports all the AT commands except AT+CWJEAP mentioned on this page. If you need to modify the commands supported by ESP32-C3 by default, please compile the ESP-AT project by following the steps in Compile ESP-AT Project Locally documentation. In the project configuration during the fifth step, make the following selections (Each item below is independent. Choose it according to your needs):
Enable EAP commands (AT+CWJEAP):
Component config
->AT
->AT WPA2 Enterprise command support
Disable WPS commands (AT+WPS):
Component config
->AT
->AT WPS command support
Disable smartconfig commands (AT+CWSTARTSMART and AT+CWSTOPSMART):
Component config
->AT
->AT smartconfig command support
Disable all Wi-Fi commands (Not recommended. Once disabled, all Wi-Fi and above functions will be unusable, and you will need to implement these AT commands yourself):
Component config
->AT
->AT wifi command support
AT+CWINIT: Initialize or Deinitialize Wi-Fi Driver
Query Command
Function:
Query the Wi-Fi initialization status of ESP32-C3 device.
Command:
AT+CWINIT?
Response:
+CWINIT:<init>
OK
Set Command
Function:
Initialize or deinitialize Wi-Fi driver of ESP32-C3 device.
Command:
AT+CWINIT=<init>
Response:
OK
Parameters
<init>:
0: Deinitialize Wi-Fi driver of ESP32-C3 device.
1: Initialize Wi-Fi driver of ESP32-C3 device. (Default value)
Note
This setting is not saved to flash and will revert to the default value of 1 after restarting.
When you run out of RAM resources and Wi-Fi is not used, you can use this command to clean up the Wi-Fi driver to free up RAM resources.
Example
// Deinitialize Wi-Fi driver
AT+CWINIT=0
AT+CWMODE: Query/Set the Wi-Fi Mode (Station/SoftAP/Station+SoftAP)
Query Command
Function:
Query the Wi-Fi mode of ESP32-C3.
Command:
AT+CWMODE?
Response:
+CWMODE:<mode>
OK
Set Command
Function:
Set the Wi-Fi mode of ESP32-C3.
Command:
AT+CWMODE=<mode>[,<auto_connect>]
Response:
OK
Parameters
<mode>:
0: Null mode. Wi-Fi RF will be disabled.
1: Station mode.
2: SoftAP mode.
3: SoftAP+Station mode.
<auto_connect>: Enable or disable automatic connection to an AP when you change the mode of the ESP32-C3 from the SoftAP mode or null mode to the station mode or the SoftAP+Station mode. Default: 1. If you omit the parameter, the default value will be used, i.e. automatically connecting to an AP.
0: The ESP32-C3 will not automatically connect to an AP.
1: The ESP32-C3 will automatically connect to an AP if the configuration to connect to the AP has already been saved in flash before.
Note
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
If you have previously used the Bluetooth function, it is recommended to send the following commands to deinitialize the initialized functions before using the SoftAP or SoftAP+Station functions:
AT+BLEINIT=0 (Deinitialize Bluetooth LE)
AT+BLUFI=0 (Disable BluFi)
For more details, please refer to the RF Coexistence documentation.
Example
AT+CWMODE=3
AT+CWSTATE: Query the Wi-Fi state and Wi-Fi information
Query Command
Function:
Query the Wi-Fi state and Wi-Fi information of ESP32-C3.
Command:
AT+CWSTATE?
Response:
+CWSTATE:<state>,<"ssid">
OK
Parameters
<state>: current Wi-Fi state.
0: ESP32-C3 station has not started any Wi-Fi connection.
1: ESP32-C3 station has connected to an AP, but does not get an IPv4 address yet.
2: ESP32-C3 station has connected to an AP, and got an IPv4 address.
3: ESP32-C3 station is in Wi-Fi connecting or reconnecting state.
4: ESP32-C3 station is in Wi-Fi disconnected state.
<”ssid”>: the SSID of the target AP.
Note
When ESP32-C3 station is not connected to an AP, it is recommended to use this command to query Wi-Fi information; after ESP32-C3 station is connected to an AP, it is recommended to use AT+CWJAP to query Wi-Fi information.
AT+CWJAP: Connect to an AP
Query Command
Function:
Query the AP to which the ESP32-C3 Station is already connected.
Command:
AT+CWJAP?
Response:
+CWJAP:<ssid>,<bssid>,<channel>,<rssi>,<pci_en>,<reconn_interval>,<listen_interval>,<scan_mode>,<pmf>
OK
Set Command
Function:
Connect an ESP32-C3 station to a targeted AP.
Command:
AT+CWJAP=[<ssid>],[<pwd>][,<bssid>][,<pci_en>][,<reconn_interval>][,<listen_interval>][,<scan_mode>][,<jap_timeout>][,<pmf>]
Response:
WIFI CONNECTED
WIFI GOT IP
OK
[WIFI GOT IPv6 LL]
[WIFI GOT IPv6 GL]
or
+CWJAP:<error code>
ERROR
Execute Command
Function:
Connect an ESP32-C3 station to a targeted AP with last Wi-Fi configuration.
Command:
AT+CWJAP
Response:
WIFI CONNECTED
WIFI GOT IP
OK
[WIFI GOT IPv6 LL]
[WIFI GOT IPv6 GL]
or
+CWJAP:<error code>
ERROR
Parameters
<ssid>: the SSID of the target AP.
Escape character syntax is needed if SSID or password contains special characters, such as
,
,"
, or\
.Chinese SSID is supported. Chinese SSID of some routers or hotspots is not encoded in UTF-8 encoding format. You can scan SSID first, and then connect using the scanned SSID.
<pwd>: password, MAX: 63-byte ASCII.
<bssid>: the MAC address of the target AP. It cannot be omitted when multiple APs have the same SSID.
<channel>: channel.
<rssi>: signal strength.
<pci_en>: PCI Authentication.
0: The ESP32-C3 station will connect APs with all encryption methods, including OPEN and WEP.
1: The ESP32-C3 station will connect APs with all encryption methods, except OPEN and WEP.
<reconn_interval>: the interval between Wi-Fi reconnections. Unit: second. Default: 1. Maximum: 7200.
0: The ESP32-C3 station will not reconnect to the AP when disconnected.
[1,7200]: The ESP32-C3 station will reconnect to the AP at the specified interval when disconnected.
<listen_interval>: the interval of listening to the AP’s beacon. Unit: AP beacon intervals. Default: 3. Range: [1,100].
<scan_mode>:
0: fast scan. It will end after finding the targeted AP. The ESP32-C3 station will connect to the first scanned AP.
1: all-channel scan. It will end after all the channels are scanned. The device will connect to the scanned AP with the strongest signal.
<jap_timeout>: maximum timeout for AT+CWJAP command. Unit: second. Default: 15. Range: [3,600].
<pmf>: Protected Management Frames. Default: 1.
0 means disable PMF.
bit 0: PMF capable, advertizes support for protected management frame. Device will prefer to connect in PMF mode if other device also advertizes PMF capability.
bit 1: PMF required, advertizes that protected management frame is required. Device will not associate to non-PMF capable devices.
<error code>: (for reference only)
1: connection timeout.
2: wrong password.
3: cannot find the target AP.
4: connection failed.
others: unknown error occurred.
Notes
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
This command requires Station mode to be enabled.
After ESP32-C3 station is connected to an AP, it is recommended to use this command to query Wi-Fi information; when ESP32-C3 station is not connected to an AP, it is recommended to use AT+CWSTATE to query Wi-Fi information.
The parameter
<reconn_interval>
of this command is the same as<interval_second>
of the command AT+CWRECONNCFG. Therefore, if you omit<reconn_interval>
when running this command, the interval between Wi-Fi reconnections will use the default value 1.If the
<ssid>
and<password>
parameter are omitted, AT will use the last configuration.Execute command has the same maximum timeout to setup command. The default value is 15 seconds, but you can change it by setting the parameter
<jap_timeout>
.The authentication method via WAPI is not supported for connecting to the router.
To get an IPv6 address, you need to set AT+CIPV6=1.
Response
OK
means that the IPv4 network is ready, but not the IPv6 network. At present, ESP-AT is mainly based on IPv4 network, supplemented by IPv6 network.WIFI GOT IPv6 LL
represents that the linklocal IPv6 address has been obtained. This address is calculated locally through EUI-64 and does not require the participation of the AP. Because of the parallel timing, this print may be before or afterOK
.WIFI GOT IPv6 GL
represents that the global IPv6 address has been obtained. This address is combined by the prefix issued by AP and the suffix calculated internally, which requires the participation of the AP. Because of the parallel timing, this print may be before or afterOK
, or it may not be printed because the AP does not support IPv6.
Example
// If the target AP's SSID is "abc" and the password is "0123456789", the command should be:
AT+CWJAP="abc","0123456789"
// If the target AP's SSID is "ab\,c" and the password is "0123456789"\", the command should be:
AT+CWJAP="ab\\\,c","0123456789\"\\"
// If multiple APs all have the SSID of "abc", the target AP can be found by BSSID:
AT+CWJAP="abc","0123456789","ca:d7:19:d8:a6:44"
// If esp-at is required that connect to a AP by protected management frame, the command should be:
AT+CWJAP="abc","0123456789",,,,,,,3
AT+CWRECONNCFG: Query/Set the Wi-Fi Reconnecting Configuration
Query Command
Function:
Query the configuration of Wi-Fi reconnect.
Command:
AT+CWRECONNCFG?
Response:
+CWRECONNCFG:<interval_second>,<repeat_count>
OK
Set Command
Function:
Set the configuration of Wi-Fi reconnect.
Command:
AT+CWRECONNCFG=<interval_second>,<repeat_count>
Response:
OK
Parameters
<interval_second>: the interval between Wi-Fi reconnections. Unit: second. Default: 0. Maximum: 7200.
0: The ESP32-C3 station will not reconnect to the AP when disconnected.
[1,7200]: The ESP32-C3 station will reconnect to the AP at the specified interval when disconnected.
<repeat_count>: the number of attempts the ESP32-C3 makes to reconnect to the AP. This parameter only works when the parameter
<interval_second>
is not 0. Default: 0. Maximum: 1000.0: The ESP32-C3 station will always try to reconnect to AP.
[1,1000]: The ESP32-C3 station will attempt to reconnect to AP for the specified times.
Example
// The ESP32-C3 station tries to reconnect to AP at the interval of one second for 100 times.
AT+CWRECONNCFG=1,100
// The ESP32-C3 station will not reconnect to AP when disconnected.
AT+CWRECONNCFG=0,0
Notes
The parameter
<interval_second>
of this command is the same as the parameter[<reconn_interval>]
of the command AT+CWJAP.This command works for passive disconnection from APs, Wi-Fi mode switch, and Wi-Fi auto connect after power on.
AT+CWLAPOPT: Set the Configuration for the Command AT+CWLAP
Set Command
Command:
AT+CWLAPOPT=<reserved>,<print mask>[,<rssi filter>][,<authmode mask>]
Response:
OK
or
ERROR
Parameters
<reserved>: reserved item.
<print mask>: determine whether the following parameters are shown in the result of AT+CWLAP. Default: 0x7FF. If you set them to 1, it means showing the corresponding parameters; if you set them as 0, it means NOT showing the corresponding parameters.
bit 0: determine whether <ecn> will be shown.
bit 1: determine whether <ssid> will be shown.
bit 2: determine whether <rssi> will be shown.
bit 3: determine whether <mac> will be shown.
bit 4: determine whether <channel> will be shown.
bit 5: determine whether <freq_offset> will be shown.
bit 6: determine whether <freqcal_val> will be shown.
bit 7: determine whether <pairwise_cipher> will be shown.
bit 8: determine whether <group_cipher> will be shown.
bit 9: determine whether <bgn> will be shown.
bit 10: determine whether <wps> will be shown.
[<rssi filter>]: determine whether the result of the command AT+CWLAP will be filtered according to
rssi filter
. In other words, the result of the command will NOT show the APs whose signal strength is belowrssi filter
. Unit: dBm. Default: -100. Range: [-100,40].[<authmode mask>]: determine whether APs with the following authmodes are shown in the result of AT+CWLAP. Default: 0xFFFF. If you set
bit x
to 1, the APs with the corresponding authmode will be shown. If you setbit x
to 0, the APs with the corresponding authmode will NOT be shown;bit 0: determine whether APs with
OPEN
authmode will be shown.bit 1: determine whether APs with
WEP
authmode will be shown.bit 2: determine whether APs with
WPA_PSK
authmode will be shown.bit 3: determine whether APs with
WPA2_PSK
authmode will be shown.bit 4: determine whether APs with
WPA_WPA2_PSK
authmode will be shown.bit 5: determine whether APs with
WPA2_ENTERPRISE
authmode will be shown.bit 6: determine whether APs with
WPA3_PSK
authmode will be shown.bit 7: determine whether AP with
WPA2_WPA3_PSK
authmode will be shown.bit 8: determine whether AP with
WAPI_PSK
authmode will be shown.bit 9: determine whether AP with
OWE
authmode will be shown.
Example
// The first parameter is 1, meaning that the result of the command AT+CWLAP will be ordered according to RSSI;
// The second parameter is 31, namely 0x1F, meaning that the corresponding bits of <print mask> are set to 1. All parameters will be shown in the result of AT+CWLAP.
AT+CWLAPOPT=1,31
AT+CWLAP
// Just show the AP which authmode is OPEN
AT+CWLAPOPT=1,31,-100,1
AT+CWLAP
AT+CWLAP: List Available APs
Set Command
Function:
Query the APs with specified parameters, such as the SSID, MAC address, or channel.
Command:
AT+CWLAP=[<ssid>,<mac>,<channel>,<scan_type>,<scan_time_min>,<scan_time_max>]
Execute Command
Function:
List all available APs.
Command:
AT+CWLAP
Response:
+CWLAP:(<ecn>,<ssid>,<rssi>,<mac>,<channel>,<freq_offset>,<freqcal_val>,<pairwise_cipher>,<group_cipher>,<bgn>,<wps>)
OK
Parameters
<ecn>: encryption method.
0: OPEN
1: WEP
2: WPA_PSK
3: WPA2_PSK
4: WPA_WPA2_PSK
5: WPA2_ENTERPRISE
6: WPA3_PSK
7: WPA2_WPA3_PSK
8: WAPI_PSK
9: OWE
<ssid>: string parameter showing SSID of the AP.
<rssi>: signal strength.
<mac>: string parameter showing MAC address of the AP.
<channel>: channel.
<scan_type>: Wi-Fi scan type. Default: 0.
0: active scan
1: passive scan
<scan_time_min>: the minimum active scan time per channel. Unit: millisecond. Range [0,1500]. If the scan type is passive, this parameter is invalid.
<scan_time_max>: the maximum active scan time per channel. Unit: millisecond. Range [0,1500]. If this parameter is 0, the firmware will use the default time: 120 ms for active scan; 360 ms for passive scan.
<freq_offset>: frequency offset (reserved item).
<freqcal_val>: frequency calibration value (reserved item).
<pairwise_cipher>: pairwise cipher type.
0: None
1: WEP40
2: WEP104
3: TKIP
4: CCMP
5: TKIP and CCMP
6: AES-CMAC-128
7: Unknown
<group_cipher>: group cipher type, same enumerated value to
<pairwise_cipher>
.<bgn>: 802.11 b/g/n. If the corresponding bit is 1, the corresponding mode is enabled; if the corresponding bit is 0, the corresponding mode is disabled.
bit 0: bit to identify if 802.11b mode is enabled or not
bit 1: bit to identify if 802.11g mode is enabled or not
bit 2: bit to identify if 802.11n mode is enabled or not
<wps>: wps flag.
0: WPS disabled
1: WPS enabled
Example
AT+CWLAP="Wi-Fi","ca:d7:19:d8:a6:44",6,0,400,1000
// Search for APs with a designated SSID:
AT+CWLAP="Wi-Fi"
AT+CWQAP: Disconnect from an AP
Execute Command
Command:
AT+CWQAP
Response:
OK
AT+CWSAP: Query/Set the configuration of an ESP32-C3 SoftAP
Query Command
Function:
Query the configuration parameters of an ESP32-C3 SoftAP.
Command:
AT+CWSAP?
Response:
+CWSAP:<ssid>,<pwd>,<channel>,<ecn>,<max conn>,<ssid hidden>
OK
Set Command
Function:
Set the configuration of an ESP32-C3 SoftAP.
Command:
AT+CWSAP=<ssid>,<pwd>,<chl>,<ecn>[,<max conn>][,<ssid hidden>]
Response:
OK
Parameters
<ssid>: string parameter showing SSID of the AP.
<pwd>: string parameter showing the password. Length: 8 ~ 63 bytes ASCII.
<channel>: channel ID.
<ecn>: encryption method; WEP is not supported.
0: OPEN
2: WPA_PSK
3: WPA2_PSK
4: WPA_WPA2_PSK
[<max conn>]: maximum number of stations that ESP32-C3 SoftAP can connect. Range: refer to max_connection description.
[<ssid hidden>]:
0: broadcasting SSID (default).
1: not broadcasting SSID.
Notes
This command works only when AT+CWMODE=2 or AT+CWMODE=3.
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
The default SSID varies from devices to device as it consists of the MAC address of the device. You can use AT+CWSAP? to query the default SSID.
Example
AT+CWSAP="ESP","1234567890",5,3
AT+CWLIF: Obtain IP Address of the Station That Connects to an ESP32-C3 SoftAP
Execute Command
Command:
AT+CWLIF
Response:
+CWLIF:<ip addr>,<mac>
OK
Parameters
<ip addr>: IP address of the station that connects to the ESP32-C3 SoftAP.
<mac>: MAC address of the station that connects to the ESP32-C3 SoftAP.
Note
This command cannot get a static IP. It works only when DHCP of both the ESP32-C3 SoftAP and the connected station are enabled.
AT+CWQIF: Disconnect Stations from an ESP32-C3 SoftAP
Execute Command
Function:
Disconnect all stations that are connected to the ESP32-C3 SoftAP.
Command:
AT+CWQIF
Response:
OK
Set Command
Function:
Disconnect a specific station from the ESP32-C3 SoftAP.
Command:
AT+CWQIF=<mac>
Response:
OK
Parameter
<mac>: MAC address of the station to disconnect.
AT+CWDHCP: Enable/Disable DHCP
Query Command
Command:
AT+CWDHCP?
Response:
+CWDHCP:<state>
OK
Set Command
Function:
Enable/disable DHCP.
Command:
AT+CWDHCP=<operate>,<mode>
Response:
OK
Parameters
<operate>:
0: disable
1: enable
<mode>:
Bit0: Station DHCP
Bit1: SoftAP DHCP
<state>: the status of DHCP
Bit0:
0: Station DHCP is disabled.
1: Station DHCP is enabled.
Bit1:
0: SoftAP DHCP is disabled.
1: SoftAP DHCP is enabled.
Bit2:
0: Ethernet DHCP is disabled.
1: Ethernet DHCP is enabled.
Notes
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
This Set Command correlates with the commands that set static IP, such as AT+CIPSTA and AT+CIPAP:
If DHCP is enabled, static IPv4 address will be disabled;
If static IPv4 address is enabled, DHCP will be disabled;
The last configuration overwrites the previous configuration.
Example
// Enable Station DHCP. If the last DHCP mode is 2, the current DHCP mode will be 3.
AT+CWDHCP=1,1
// Disable SoftAP DHCP. If the last DHCP mode is 3, the current DHCP mode will be 1.
AT+CWDHCP=0,2
AT+CWDHCPS: Query/Set the IPv4 Addresses Allocated by an ESP32-C3 SoftAP DHCP Server
Query Command
Command:
AT+CWDHCPS?
Response:
+CWDHCPS:<lease time>,<start IP>,<end IP>
OK
Set Command
Function:
Set the IPv4 address range of the ESP32-C3 SoftAP DHCP server.
Command:
AT+CWDHCPS=<enable>,<lease time>,<start IP>,<end IP>
Response:
OK
Parameters
<enable>:
1: Enable DHCP server settings. The parameters below have to be set.
0: Disable DHCP server settings and use the default IPv4 address range.
<lease time>: lease time. Unit: minute. Range [1,2880].
<start IP>: start IPv4 address of the IPv4 address range that can be obtained from ESP32-C3 SoftAP DHCP server.
<end IP>: end IPv4 address of the IPv4 address range that can be obtained from ESP32-C3 SoftAP DHCP server.
Notes
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
This AT command works only when both SoftAP and DHCP server are enabled for ESP32-C3.
The IPv4 address should be in the same network segment as the IPv4 address of ESP32-C3 SoftAP.
Example
AT+CWDHCPS=1,3,"192.168.4.10","192.168.4.15"
AT+CWDHCPS=0 // Disable the settings and use the default IPv4 address range.
AT+CWAUTOCONN: Query/Set Automatic Connection to an AP When Powered on
Query Command
Command:
AT+CWAUTOCONN?
Response:
+CWAUTOCONN:<enable>
OK
Set Command
Command:
AT+CWAUTOCONN=<enable>
Response:
OK
Parameters
<enable>:
1: Enable automatic connection to an AP when powered on. (Default)
0: Disable automatic connection to an AP when powered on.
Note
The configuration changes will be saved in the NVS area.
Example
AT+CWAUTOCONN=1
AT+CWAPPROTO: Query/Set the 802.11 b/g/n Protocol Standard of SoftAP Mode
Query Command
Command:
AT+CWAPPROTO?
Response:
+CWAPPROTO:<protocol>
OK
Set Command
Command:
AT+CWAPPROTO=<protocol>
Response:
OK
Parameters
<protocol>:
bit0: 802.11b protocol standard.
bit1: 802.11g protocol standard.
bit2: 802.11n protocol standard.
Note
See Wi-Fi Protocol Mode for the PHY mode supported by the ESP32-C3 device.
By default, PHY mode of ESP32-C3 is 802.11bgn mode.
AT+CWSTAPROTO: Query/Set the 802.11 b/g/n Protocol Standard of Station Mode
Query Command
Command:
AT+CWSTAPROTO?
Response:
+CWSTAPROTO:<protocol>
OK
Set Command
Command:
AT+CWSTAPROTO=<protocol>
Response:
OK
Parameters
<protocol>:
bit0: 802.11b protocol standard.
bit1: 802.11g protocol standard.
bit2: 802.11n protocol standard.
Note
See Wi-Fi Protocol Mode for the PHY mode supported by the ESP32-C3 device.
By default, PHY mode of ESP32-C3 is 802.11bgn mode.
AT+CIPSTAMAC: Query/Set the MAC Address of an ESP32-C3 Station
Query Command
Function:
Query the MAC address of the ESP32-C3 Station.
Command:
AT+CIPSTAMAC?
Response:
+CIPSTAMAC:<mac>
OK
Set Command
Function:
Set the MAC address of an ESP32-C3 station.
Command:
AT+CIPSTAMAC=<mac>
Response:
OK
Parameters
<mac>: string parameter showing MAC address of an ESP32-C3 station.
Notes
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
The MAC address of ESP32-C3 Station is different from that of the ESP32-C3 SoftAP. Please make sure that you do not set the same MAC address for both of them.
Bit 0 of the ESP32-C3 MAC address CANNOT be 1. For example, a MAC address can be “1a:…” but not “15:…”.
FF:FF:FF:FF:FF:FF and 00:00:00:00:00:00 are invalid MAC address and cannot be set.
Example
AT+CIPSTAMAC="1a:fe:35:98:d3:7b"
AT+CIPAPMAC: Query/Set the MAC Address of an ESP32-C3 SoftAP
Query Command
Function:
Query the MAC address of the ESP32-C3 SoftAP.
Command:
AT+CIPAPMAC?
Response:
+CIPAPMAC:<mac>
OK
Set Command
Function:
Set the MAC address of the ESP32-C3 SoftAP.
Command:
AT+CIPAPMAC=<mac>
Response:
OK
Parameters
<mac>: string parameter showing MAC address of the ESP32-C3 SoftAP.
Notes
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
The MAC address of ESP32-C3 SoftAP is different from that of the ESP32-C3 station. Please make sure that you do not set the same MAC address for both of them.
Bit 0 of the ESP32-C3 MAC address CANNOT be 1. For example, a MAC address can be “18:…” but not “15:…”.
FF:FF:FF:FF:FF:FF and 00:00:00:00:00:00 are invalid MAC and cannot be set.
Example
AT+CIPAPMAC="18:fe:35:98:d3:7b"
AT+CIPSTA: Query/Set the IP Address of an ESP32-C3 Station
Query Command
Function:
Query the IP address of the ESP32-C3 Station.
Command:
AT+CIPSTA?
Response:
+CIPSTA:ip:<"ip">
+CIPSTA:gateway:<"gateway">
+CIPSTA:netmask:<"netmask">
+CIPSTA:ip6ll:<"ipv6 addr">
+CIPSTA:ip6gl:<"ipv6 addr">
OK
Set Command
Function:
Set the IPv4 address of the ESP32-C3 station.
Command:
AT+CIPSTA=<"ip">[,<"gateway">,<"netmask">]
Response:
OK
Parameters
<”ip”>: string parameter showing the IPv4 address of the ESP32-C3 station.
<”gateway”>: gateway.
<”netmask”>: netmask.
<”ipv6 addr”>: string parameter showing the IPv6 address of the ESP32-C3 station.
Notes
For the query command, only when the ESP32-C3 station is connected to an AP or the static IP address is configured can its IP address be queried.
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
The Set Command correlates with the commands that set DHCP, such as AT+CWDHCP.
If static IPv4 address is enabled, DHCP will be disabled;
If DHCP is enabled, static IPv4 address will be disabled;
The last configuration overwrites the previous configuration.
Example
AT+CIPSTA="192.168.6.100","192.168.6.1","255.255.255.0"
AT+CIPAP: Query/Set the IP Address of an ESP32-C3 SoftAP
Query Command
Function:
Query the IP address of the ESP32-C3 SoftAP.
Command:
AT+CIPAP?
Response:
+CIPAP:ip:<"ip">
+CIPAP:gateway:<"gateway">
+CIPAP:netmask:<"netmask">
+CIPAP:ip6ll:<"ipv6 addr">
OK
Set Command
Function:
Set the IPv4 address of the ESP32-C3 SoftAP.
Command:
AT+CIPAP=<"ip">[,<"gateway">,<"netmask">]
Response:
OK
Parameters
<”ip”>: string parameter showing the IPv4 address of the ESP32-C3 SoftAP.
<”gateway”>: gateway.
<”netmask”>: netmask.
<”ipv6 addr”>: string parameter showing the IPv6 address of the ESP32-C3 SoftAP.
Notes
The set command is just applied to the IPv4 network, but not the IPv6 network.
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
The set command correlates with the commands that set DHCP, such as AT+CWDHCP.
If static IPv4 address is enabled, DHCP will be disabled;
If DHCP is enabled, static IPv4 address will be disabled;
The last configuration overwrites the previous configuration.
Example
AT+CIPAP="192.168.5.1","192.168.5.1","255.255.255.0"
AT+CWSTARTSMART: Start SmartConfig
Execute Command
Function:
Start SmartConfig of the type ESP-TOUCH+AirKiss.
Command:
AT+CWSTARTSMART
Set Command
Function:
Start SmartConfig of a designated type.
Command:
AT+CWSTARTSMART=<type>[,<auth floor>][,<"esptouch v2 key">]
Response:
OK
Parameters
<type>:
1: ESP-TOUCH
2: AirKiss
3: ESP-TOUCH+AirKiss
4: ESP-TOUCH v2
<auth floor>: Wi-Fi authentication mode floor. ESP-AT will not connect to the AP whose authmode is lower than this floor.
0: OPEN (Default)
1: WEP
2: WPA_PSK
3: WPA2_PSK
4: WPA_WPA2_PSK
5: WPA2_ENTERPRISE
6: WPA3_PSK
7: WPA2_WPA3_PSK
<”esptouch v2 key”>: ESP-TOUCH v2 decrypt key. It is used to decrypt Wi-Fi password and reserved data. Length: 16 bytes.
Notes
For more details on SmartConfig, please see ESP-TOUCH User Guide.
SmartConfig is only available in the ESP32-C3 station mode.
The message
Smart get Wi-Fi info
means that SmartConfig has successfully acquired the AP information. ESP32-C3 will try to connect to the target AP.Message
+SCRD:<length>,<rvd data>
means that ESP-Touch v2 has successfully acquired the reserved data information.Message
Smartconfig connected Wi-Fi
is printed if the connection is successful.When AT returns
Smartconfig connected Wi-Fi
, it is recommended to delay more than6
seconds before executing AT+CWSTOPSMART because the ESP32-C3 needs to synchronize the SmartConfig results to the mobile phone.Use command AT+CWSTOPSMART to stop SmartConfig before running other commands. Please make sure that you do not execute other commands during SmartConfig.
Example
AT+CWMODE=1
AT+CWSTARTSMART
AT+CWSTOPSMART: Stop SmartConfig
Execute Command
Command:
AT+CWSTOPSMART
Response:
OK
Note
Irrespective of whether SmartConfig succeeds or not, please always call AT+CWSTOPSMART before executing any other AT commands to release the internal memory taken up by SmartConfig.
Example
AT+CWMODE=1
AT+CWSTARTSMART
AT+CWSTOPSMART
AT+WPS: Enable the WPS Function
Set Command
Command:
AT+WPS=<enable>[,<auth floor>]
Response:
OK
Parameters
<enable>:
1: Enable WPS (Wi-Fi Protected Setup) that uses PBC (Push Button Configuration) mode.
0: Disable WPS that uses PBC mode.
<auth floor>: Wi-Fi authentication mode floor. ESP-AT will not connect to the AP whose authmode is lower than this floor.
0: OPEN (Default)
1: WEP
2: WPA_PSK
3: WPA2_PSK
4: WPA_WPA2_PSK
5: WPA2_ENTERPRISE
6: WPA3_PSK
7: WPA2_WPA3_PSK
Notes
WPS can only be used when the ESP32-C3 station is enabled.
WPS does not support WEP (Wired-Equivalent Privacy) encryption.
Example
AT+CWMODE=1
AT+WPS=1
AT+CWJEAP: Connect to a WPA2 Enterprise AP
Query Command
Function:
Query the configuration information of the Enterprise AP to which the ESP32-C3 station is already connected.
Command:
AT+CWJEAP?
Response:
+CWJEAP:<ssid>,<method>,<identity>,<username>,<password>,<security>
OK
Set Command
Function:
Connect to the targeted Enterprise AP.
Command:
AT+CWJEAP=<ssid>,<method>,<identity>,<username>,<password>,<security>[,<jeap_timeout>]
Response:
OK
or
+CWJEAP:Timeout
ERROR
Parameters
<ssid>: the SSID of the Enterprise AP.
Escape character syntax is needed if SSID or password contains any special characters, such as
,
,"
, or\\
.
<method>: WPA2 Enterprise authentication method.
0: EAP-TLS.
1: EAP-PEAP.
2: EAP-TTLS.
<identity>: identity for phase 1. String limited to 1 ~ 32.
<username>: username for phase 2. Range: 1 ~ 32 bytes. For the EAP-PEAP and EAP-TTLS method, you must set this parameter. For the EAP-TLS method, you do not need to.
<password>: password for phase 2. Range: 1 ~ 32 bytes. For the EAP-PEAP and EAP-TTLS method, you must set this parameter. For the EAP-TLS method, you do not need to.
<security>:
Bit0: Client certificate.
Bit1: Server certificate.
[<jeap_timeout>]: maximum timeout for AT+CWJEAP command. Unit: second. Default: 15. Range: [3,600].
Example
// Connect to EAP-TLS mode Enterprise AP, set identity, verify server certificate and load client certificate
AT+CWJEAP="dlink11111",0,"example@espressif.com",,,3
// Connect to EAP-PEAP mode Enterprise AP, set identity, username and password, not verify server certificate and not load client certificate
AT+CWJEAP="dlink11111",1,"example@espressif.com","espressif","test11",0
Error Code:
The WPA2 Enterprise error code will be prompt as ERR CODE:0x<%08x>
.
AT_EAP_MALLOC_FAILED |
0x8001 |
---|---|
AT_EAP_GET_NVS_CONFIG_FAILED |
0x8002 |
AT_EAP_CONN_FAILED |
0x8003 |
AT_EAP_SET_WIFI_CONFIG_FAILED |
0x8004 |
AT_EAP_SET_IDENTITY_FAILED |
0x8005 |
AT_EAP_SET_USERNAME_FAILED |
0x8006 |
AT_EAP_SET_PASSWORD_FAILED |
0x8007 |
AT_EAP_GET_CA_LEN_FAILED |
0x8008 |
AT_EAP_READ_CA_FAILED |
0x8009 |
AT_EAP_SET_CA_FAILED |
0x800A |
AT_EAP_GET_CERT_LEN_FAILED |
0x800B |
AT_EAP_READ_CERT_FAILED |
0x800C |
AT_EAP_GET_KEY_LEN_FAILED |
0x800D |
AT_EAP_READ_KEY_FAILED |
0x800E |
AT_EAP_SET_CERT_KEY_FAILED |
0x800F |
AT_EAP_ENABLE_FAILED |
0x8010 |
AT_EAP_ALREADY_CONNECTED |
0x8011 |
AT_EAP_GET_SSID_FAILED |
0x8012 |
AT_EAP_SSID_NULL |
0x8013 |
AT_EAP_SSID_LEN_ERROR |
0x8014 |
AT_EAP_GET_METHOD_FAILED |
0x8015 |
AT_EAP_CONN_TIMEOUT |
0x8016 |
AT_EAP_GET_IDENTITY_FAILED |
0x8017 |
AT_EAP_IDENTITY_LEN_ERROR |
0x8018 |
AT_EAP_GET_USERNAME_FAILED |
0x8019 |
AT_EAP_USERNAME_LEN_ERROR |
0x801A |
AT_EAP_GET_PASSWORD_FAILED |
0x801B |
AT_EAP_PASSWORD_LEN_ERROR |
0x801C |
AT_EAP_GET_SECURITY_FAILED |
0x801D |
AT_EAP_SECURITY_ERROR |
0x801E |
AT_EAP_METHOD_SECURITY_UNMATCHED |
0x801F |
AT_EAP_PARAMETER_COUNTS_ERROR |
0x8020 |
AT_EAP_GET_WIFI_MODE_ERROR |
0x8021 |
AT_EAP_WIFI_MODE_NOT_STA |
0x8022 |
AT_EAP_SET_CONFIG_FAILED |
0x8023 |
AT_EAP_METHOD_ERROR |
0x8024 |
Note
The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
This command requires Station mode to be active.
TLS mode will use client certificate. Please make sure it is enabled.
AT+CWHOSTNAME: Query/Set the Host Name of an ESP32-C3 Station
Query Command
Function:
Query the host name of ESP32-C3 Station.
Command:
AT+CWHOSTNAME?
Response:
+CWHOSTNAME:<hostname>
OK
Set Command
Function:
Set the host name of ESP32-C3 Station.
Command:
AT+CWHOSTNAME=<hostname>
Response:
OK
If the Station mode is not enabled, the command will return:
ERROR
Parameters
<hostname>: the host name of the ESP32-C3 Station. Maximum length: 32 bytes.
Note
The configuration changes are not saved in the flash.
Example
AT+CWMODE=3
AT+CWHOSTNAME="my_test"
AT+CWCOUNTRY: Query/Set the Wi-Fi Country Code
Query Command
Function:
Query Wi-Fi country code information.
Command:
AT+CWCOUNTRY?
Response:
+CWCOUNTRY:<country_policy>,<country_code>,<start_channel>,<total_channel_count>
OK
Set Command
Function:
Set the Wi-Fi country code information.
Command:
AT+ CWCOUNTRY=<country_policy>,<country_code>,<start_channel>,<total_channel_count>
Response:
OK
Parameters
<country_policy>:
0: will change the county code to be the same as the AP that the ESP32-C3 is connected to.
1: the country code will not change, always be the one set by command.
<country_code>: country code. Maximum length: 3 characters. Refer to ISO 3166-1 alpha-2 for country codes.
<start_channel>: the channel number to start. Range: [1,14].
<total_channel_count>: total number of channels.
Note
See Wi-Fi Country Code for more details.
The configuration changes are not saved in the flash.
Example
AT+CWMODE=3
AT+CWCOUNTRY=1,"CN",1,13