ESP8266 AT Command Reference
ESP8266 AT Command Reference
Communication with the ESP is via serial connection. The designers of the ESP adopted a scheme known as "AT commands" that stems from the age when computers connected to a network via modem (I am even older than that).
The commands that the ESP understands depend on the firmware version. There are a number of those; here are the ones I found a manual for:
- 0.20
- 0.22
- 0.23
- 0.24
- 0.25
- 0.30
- 1.3 At the beginning of 2017 this was the newest version when ordering from Banggood
- 1.4
- 1.5
- 1.5.4
- 2.0.0
- 2.1.0
REM: A change in FW version does not imply a change in supported AT commands.
Communication with the ESP comes in four flavors:
- test command: To query values parameters can assume, use AT+<cmd>=?
- query command: To query the current value of parameters, use AT+<cmd>?
- setup command: To set parameters, use AT+<cmd>=<x>
- execute command: To execute a function, use AT+<cmd>
This scheme does not always apply but gives you an idea.
Generally:
- Strings need to be quoted
- Parameter are separated with a comma
- Each command must be followed with CRLF
- 115200Baud is the default speed
I wrote a Java program that communicates with an ESP8266 to try out things before I put them into my AC_ESP8266 library. Testing out of Eclipse is just way faster and more convenient then uploading a new version to the Arduino each time. And, logging on the desktop offers way more possibilities.
Basic
Group | AT Command | Description | Parameters | Response | MQTT-Relevant? |
---|---|---|---|---|---|
Basic | AT | Test AT startup | - | OK | |
Basic | AT+RST | Restart module | - | OK | x, for error handling |
Basic | AT+GMR | View version info | - |
<AT version info> |
x, for issuing the correct commands |
Basic | AT+GSLP | Enter deep-sleep mode | <time in millis> | <time> OK | - |
Basic | ATE | AT | commands echo or not | ATE0, ATE1 OK |
- |
Basic | AT+RESTORE | Factory reset | - | OK | - |
Basic | AT+UART | UART configuration, [@deprecated] | - | ||
Basic | AT+UART_CUR | UART current configuration |
<baudrate 110-115200>, <databits 5-8>, <stopbits 1: 1, 2: 1.5, 3: 2>, <parity 0: none, 1: odd, 2: even>, <flow control 0: disable, 1: RTS, 2: CTS, 3: RTS + CTS> |
OK | - |
Basic | AT+UART_DEF | UART default configuration, save to flash | once | ||
Basic | AT+SLEEP | Sleep mode (station mode only) | <sleep mode 0: disable, 1: light, 2: modem> |
Query: +SLEEP:<sleep mode> Set: OK |
- |
Basic | AT+WAKEUPGPIO | Set a GPIO to wake ESP8266 up from light-sleep mode | - | ||
Basic | AT+RFPOWER | Set maximum value of RF TX Power | <power 0-82> in 0.25dBm | OK | - |
Basic | AT+RFVDD | Set RF TX Power according to VDD33 | - |
WLAN
Group | AT Command | Description | Parameters | Response | MQTT-Relevant? |
---|---|---|---|---|---|
WLAN | AT+CWMODE | Wi-Fi mode(sta/AP/sta+AP), [@deprecated] | - | ||
WLAN | AT+CWMODE_CUR | Wi-Fi mode (station/ AP/ station+AP). Settings not updated in flash. | <mode 1: station, 2: softAP, 3: softAP + station> | - | |
WLAN | AT+CWMODE_DEF | Wi-Fi default mode(station/ AP/ station+AP). Save to flash. | x - what does saving to flash provide? | ||
WLAN | AT+CWJAP | Connect to AP, [@deprecated] |
|
- | |
WLAN | AT+CWJAP_CUR | Connect to AP, won’t save to flash (station mode only) | <ssid>,<pwd>[, <bssid>] |
Query: +CWJAP_CUR:<ssid>, <bssid>, <channel>, <rssi> Set: OK or +CWJAP:<error code 1: connection timeout, 2: wrong password, 3: cannot find target AP, 4: connection failed> |
- |
WLAN | AT+CWJAP_DEF | Connect to AP, save to flash (station mode only) | x - what does saving to flash provide? | ||
WLAN | AT+CWLAPOPT | Set the configuration of command AT+CWLAP | <sort enable 0: no sort, 1: sort by rssi>,<mask b0: ECN, b1: SSID, b2: RSSI, b3: MAC, b4: chn, b5: freq offset, b6: freq calibration> | ||
WLAN | AT+CWLAP | Lists available APs | <ssid>[, <mac>, <ch>] |
+CWLAP:<ecn 0: open, 1: WEP, 2: WPA_PSK, 3: WPA2_PSK, 4: WPA_WPA2_PSK, 5: WPA2_Enterprise>, <ssid>, <rssi>, <mac>, <ch>, <freq offset>, <freq calibration> OK depending on options set with CWLAPOPT |
maybe, for selecting a WLAN |
WLAN | AT+CWQAP | Disconnect from AP | - | OK | maybe, for error handling |
WLAN | AT+CWSAP | Set configuration of ESP8266 soft-AP, [@deprecated] | - | ||
WLAN | AT+CWSAP_CUR | Set current configuration of ESP8266 soft-AP. Settings not updated in flash. |
<ssid>, <pwd>, <chl>, <ecn 0, 2, 3, 4>[, <max conn 1-4>][, <ssid hidden 0: broadcast, 1: don't broadcast>] |
Query: +CWSAP_CUR:<ssid>, <pwd>, <chl>, <ecn>, <max conn>, <ssid hidden> Set: OK or ERROR |
- |
WLAN | AT+CWSAP_DEF | Set configuration of ESP8266 soft-AP. Save changes to flash. | - | ||
WLAN | AT+CWLIF | Get station IP which is connected to ESP8266 soft-AP | - |
<IP addr>, <mac> |
- |
WLAN | AT+CWDHCP | Enable/Disable DHCP, [@deprecated] | - | ||
WLAN | AT+CWDHCP_CUR | Enable/Disable DHCP, changes not save to flash | - | ||
WLAN | AT+CWDHCP_DEF | Enable/Disable DHCP, save changes to flash | - | ||
WLAN | AT+CWDHCPS_CUR | Set IP range of DHCP server, changes not save to flash | - | ||
WLAN | AT+CWDHCPS_DEF | Set IP range of DHCP server, save changes to flash | - | ||
WLAN | AT+CWAUTOCONN | Connect to AP automatically on power-up | <enable 0: disable, 1: enable auto-connect on startup> | x - quite possibly! | |
WLAN | AT+CIPSTAMAC | Set MAC address of ESP8266 station [@deprecated] | - | ||
WLAN | AT+CIPSTAMAC_CUR | Set MAC address of ESP8266 station. Changes not save to flash. | - | ||
WLAN | AT+CIPSTAMAC_DEF | Set MAC address of ESP8266 station. Save changes to flash. | - | ||
WLAN | AT+CIPAPMAC | Set MAC address of ESP8266 soft-AP [@deprecated] | - | ||
WLAN | AT+CIPAPMAC_CUR | Set MAC address of ESP8266 soft-AP. Changes not save to flash. | - | ||
WLAN | AT+CIPAPMAC_DEF | Set MAC address of ESP8266 soft-AP. Save changes to flash. | - | ||
WLAN | AT+CIPSTA | Set IP address of ESP8266 station, [@deprecated] | - | ||
WLAN | AT+CIPSTA_CUR | Set IP address of ESP8266 station. Changes not save to flash. | x - to query | ||
WLAN | AT+CIPSTA_DEF | Set IP address of ESP8266 station. Save changes to flash. | - | ||
WLAN | AT+CIPAP | Set IP address of ESP8266 soft-AP, [@deprecated] | - | ||
WLAN | AT+CIPAP_CUR | Set IP address of ESP8266 soft-AP. Changes not save to flash. | - | ||
WLAN | AT+CIPAP_DEF | Set IP address of ESP8266 soft-AP. Save changes to flash. | - | ||
WLAN | AT+CWSTARTSMART | Start SmartConfig (for AirKiss or ESP-TOUCH) | - | ||
WLAN | AT+CWSTOPSMART | Stop SmartConfig | - | ||
WLAN | AT+CWSTARTDISCOVER | Start the mode that ESP8266 can be found by WeChat | - | ||
WLAN | AT+CWSTOPDISCOVER | Stop the mode that ESP8266 can be found by WeChat | - | ||
WLAN | AT+WPS | Set WPS function | - | ||
WLAN | AT+MDNS | Set MDNS function | - |
TCP
Group | AT Command | Description | Parameters | Response | MQTT-Relevant? |
---|---|---|---|---|---|
TCP | AT+CIPSTATUS | Get connection status |
STATUS:<stat: 2: connected to AP, obtained IP, 3: TCP or UDP connection created, 4: TCP or UDP disconnected, 5: not connected to AP> |
x | |
TCP | AT+CIPDOMAIN | DNS function | - | ||
TCP | AT+CIPSTART | Establish TCP connection, UDP transmission or SSL connection (only one at the same time, high memory consumption) | <link ID 0-4>,<type TCP, UDP, SSL>, <remote IP>, <remote port>[, <TCP keep alive>] | x | |
TCP | AT+CIPSSLSIZE | Set the size of SSL buffer | maybe, SSL would be great | ||
TCP | AT+CIPSEND | Send data | AT+CIPSEND=<link ID>, <length>
then receives serial data until length is reached, then ERROR or SEND OK |
x | |
TCP | AT+CIPSENDEX | Send data, if <length> or "\0" is met, data will be sent | |||
TCP | AT+CIPSENDBUF | Write data into TCP-send-buffer | |||
TCP | AT+CIPBUFRESET | Reset segment ID count | |||
TCP | AT+CIPBUFSTATUS | Check status of TCP-send-buffer (not for SSL connections) | |||
TCP | AT+CIPCHECKSEQ | Check if a specific segment is sent or not | |||
TCP | AT+CIPCLOSE | Close TCP/UDP/SSL connection | x | ||
TCP | AT+CIFSR | Get local IP address |
+ CIFSR:<IP address> |
x | |
TCP | AT+CIPMUX | Set multiple connections mode | x - to select single mode, but do we need single mode? | ||
TCP | AT+CIPSERVER | Configure as server | - | ||
TCP | AT+CIPMODE | Set transmission mode | - not used so far | ||
TCP | AT+SAVETRANSLINK | Save transparent transmission link to flash | - I get the impression this creates a TCP connection and after that, serial talks transparently to that connection | ||
TCP | AT+CIPSTO | Set timeout when ESP8266 runs as TCP server | - | ||
TCP | AT+CIUPDATE | Upgrade firmware through network | - | ||
TCP | AT+PING | Function PING | <IP> |
+<time> Or ERROR |
maybe, for error handling |
TCP | AT+CIPDINFO | Show remote IP and remote port with "+IPD" | - |