This is the AT firmware for the ESP8266 WROOM-02. It provides a WIFI and MQTT interface with AT commands.
Generic AT command has four types:
| Type | Command Format | Description |
|---|---|---|
| Test Command | AT+=? | Queries the Set Commands’ internal parameters and their range of values. |
| Query Command | AT+? | Returns the current value of parameters. |
| Set Command | AT+=<…> | Sets the value of user-defined parameters in commands, and runs these commands. |
| Execute Command | AT+ | Runs commands with no user-defined parameters. |
-
Square brackets [ ] designate parameters that may be omitted; default value of the parameter will be used instead.
Below are examples of entering command AT+CWJAP with some parameters omitted:
AT+CWJAP="ssid","password" AT+CWJAP="ssid","password","11:22:33:44:55:66"
-
If the parameter which is not the last one is omitted, you can give a , to indicate it.
Example:
AT+CWJAP="ssid","password",,1
-
String values need to be included in double quotation marks, for example: AT+CWSAP="ESP756290","21030826",1,4.
-
Escape character syntax is needed if a string contains any special characters, such as ,, " or :
-
\\: escape backslash itself -
\,: escape comma which is used to separate each parameter -
\": escape double quotation marks which used to mark string input -
\<any>: escape<any>character means that drop backslash symbol and only use<any>characterExample:
AT+CWJAP="comma\,backslash\\ssid","1234567890" AT+MQTTPUB=0,"topic","\"{\"sensor\":012}\"",1,0
-
-
The default baud rate of AT command is 115200.
-
AT commands are ended with a new-line (CR-LF), so the serial tool should be set into “New Line Mode”.
Command:
ATResponse:
OKCommand:
AT+RSTResponse:
OKCommand:
AT+GMRResponse:
<AT version info>
<Bin version>
OKParameters:
<AT version info>: information about the AT library version<Bin version>: firmware version
Example:
AT+GMR
AT version:1.0.0
Bin version:0.0.1
OKQuery Command:
AT+CMD?Response:
+CMD=<index>,<AT command name>,<support test command>,<support query command>,<support set command>,<support execute command>
OKParameters:
<index>: AT command sequence number.<AT command name>: AT command name.<support test command>: 0 means not supported, 1 means supported.<support query command>: 0 means not supported, 1 means supported.<support set command>: 0 means not supported, 1 means supported.<support execute command>: 0 means not supported, 1 means supported.
Command:
AT+CWMODE?Response:
+CWMODE:<mode>
OKParameters:
<mode>: 0: Null mode. Wi-Fi RF will be disabled. 1: Station mode. 2: SoftAP mode. 3: SoftAP+Station mode.
Command:
AT+CWSTATE?Response:
+CWSTATE:<state>,<ssid>
OKParameters:
<state>: current Wi-Fi state. 0: The station has not started any Wi-Fi connection. 1: The station has connected to an AP, but does not get an IPv4 address yet. 2: The station has connected to an AP, and got an IPv4 address. 3: The station is in Wi-Fi connecting or reconnecting state. 4: The station is in Wi-Fi disconnected state.<ssid>: the SSID of the target AP.
Query Command:
Query the AP to which the Station is already connected.
AT+CWJAP?Response:
+CWJAP:<ssid>,<bssid>,<channel>,<rssi>
OKSet Command:
Query the AP to which the Station is already connected.
AT+CWJAP=[<ssid>],[<pwd>]Response:
DISCONNECTED
CONNECTED
OKor
DISCONNECTED
ERRORParameters:
<ssid>: the SSID of the target AP. Escape character syntax is needed if SSID or password contains special characters, such,,", or\\.<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.
Query Command:
AT+CWRECONNCFG?Response:
+CWRECONNCFG:<reconncfg>
OKSet Command:
Query the AP to which the Station is already connected.
AT+CWRECONNCFG=<reconncfg>Response:
OKParameters:
<reconncfg>: the reconnecting configuration. 0: auto-reconnect is disabled. 1: auto-reconnect is enabled.
Execute Command:
AT+CWLAPResponse:
+CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<channel>
OKParameters:
<ecn>: encryption method. 0: OPEN 1: WEP 2: WPA PSK 3: WPA2 PSK 4: WPA WPA2 PSK<ssid>: string parameter showing SSID of the AP.<rssi>: signal strength.<mac>: string parameter showing MAC address of the AP.<channel>: channel.
Execute Command:
AT+CWQAPResponse:
OKQuery Command:
AT+CWSAP?Response:
+CWSAP:<ssid>,<pwd>,<channel>
OKSet Command:
AT+CWSAP=<ssid>,<pwd>,<chl>,<ecn>,<max conn>,<ssid hidden>Response:
OKParameters:
<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 SoftAP can connect. Range: [1,10]. - [
<ssid hidden>]:- 0: broadcasting SSID (default).
- 1: not broadcasting SSID.
Execute Command:
AT+CWLIFResponse:
+CWLIF:<ip addr>,<mac>
OKParameters:
<ip addr>: IP address of the station that connects to the SoftAP.<mac>: MAC address of the station that connects to the SoftAP.
Execute Command:
AT+CWQIFResponse:
OKQuery Command:
AT+CWDHCP?Response:
+CWDHCP:<state>
OKSet Command:
AT+CWDHCP=<operate>,<mode>Response:
OKParameters:
<operate>: 0: disable 1: enable<mode>: 0: Station DHCP 1: 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.
Query Command:
AT+CIPSTA?Response:
+CIPSTA:ip:<ip>
+CIPSTA:gateway:<gateway>
+CIPSTA:netmask:<netmask>
OKParameters:
<ip>: string parameter showing the IPv4 address of the station.<gateway>: gateway.<netmask>: netmask.
Query Command:
AT+CWHOSTNAME?Response:
+CWHOSTNAME:<hostname>
OKSet Command:
AT+CWHOSTNAME=<hostname>Response:
OKParameters:
<hostname>: the host name of the Station. Maximum length: 32 bytes.
Query Command:
AT+CIPSERVER?Response:
+CIPSERVER:<mode>,<port>
OKSet Command:
AT+CIPSERVER=<mode>,<port>Response:
OKParameters:
<mode>: 0: delete a server. 1: create a server.<port>: represents the port number. Range: [1024,65535].
Query Command:
AT+CIPRECVLEN?Response:
+CIPRECVLEN:<chan>,<len>
OKParameters:
<chan>: the channel identifier [0-3].<len>: length of the entire data buffered for the connection.
Set Command:
AT+CIPRECVDATA=<chan>,<r_len>Response:
AT+CIPRECVDATA=<chan>,<a_len>,<remote_ip>,<remote_port>,<data>
OKParameters:
<chan>: the channel identifier [0-3].<r_len>: length of the requested buffer.<a_len>: length of the data you actually obtain. If the actual length of the received data is less than len, the actual length will be returned.<remote_ip>: string parameter showing the remote IPv4 address.<remote_port>: the remote port number.
Query Command:
AT+CIPSTATE?Response:
+CIPSTATE:<channel>,<remote_ip>,<remote_port>,<local_port>
OKParameters:
<chan>: the channel identifier [0-3].<remote_ip>: string parameter showing the remote IPv4 address.<remote_port>: the remote port number.<local_port>: the local port number.
Set Command:
AT+CIPSEND=<chan>,<len>Response:
OK
>This response indicates that AT is ready for receiving serial data. You should enter the data, and when the data length reaches the <len> value, the transmission of data starts.
If the connection cannot be established or is disrupted during data transmission, the system returns:
ERRORIf data is transmitted successfully, the system returns:
SEND OK
OKParameters:
<chan>: the channel identifier [0-3].<len>: length of the data to send.