From IoT with AME
Jump to: navigation, search
(Created page with "=ESP8266 AT Command Reference= ==Basic== <table class="wikitable"> <tr> <th>Group</th><th>AT Command</th><th>Description</th><th>Parameters</th><th>Response</th><th>MQTT-Rel...")
 
(ESP8266 AT Command Reference)
 
Line 1: Line 1:
 
=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+&lt;cmd&gt;=?
 +
* query command: To query the current value of parameters, use AT+&lt;cmd&gt?
 +
* setup command: To set parameters, use AT+&lt;cmd&gt;=&lt;x&gt;
 +
* execute command: To execute a function, use AT+&lt;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==
 
==Basic==

Latest revision as of 18:55, 24 June 2018

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&gt?
  • 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

GroupAT CommandDescriptionParametersResponseMQTT-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>
<SDK version info>
<compile time>

OK
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
-
BasicAT+RESTORE Factory reset - OK -
BasicAT+UART UART configuration, [@deprecated] -
BasicAT+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 -
BasicAT+UART_DEF UART default configuration, save to flash once
BasicAT+SLEEP Sleep mode (station mode only) <sleep mode 0: disable, 1: light, 2: modem>

Query: <p/>+SLEEP:<sleep mode> <p/>Set: <p/>OK

-
BasicAT+WAKEUPGPIO Set a GPIO to wake ESP8266 up from light-sleep mode -
BasicAT+RFPOWER Set maximum value of RF TX Power <power 0-82> in 0.25dBm OK -
BasicAT+RFVDD Set RF TX Power according to VDD33 -

WLAN

GroupAT CommandDescriptionParametersResponseMQTT-Relevant?
WLANAT+CWMODE Wi-Fi mode(sta/AP/sta+AP), [@deprecated] -
WLANAT+CWMODE_CUR Wi-Fi mode (station/ AP/ station+AP). Settings not updated in flash. <mode 1: station, 2: softAP, 3: softAP + station> -
WLANAT+CWMODE_DEF Wi-Fi default mode(station/ AP/ station+AP). Save to flash. x - what does saving to flash provide?
WLANAT+CWJAP Connect to AP, [@deprecated]


-
WLANAT+CWJAP_CUR Connect to AP, won’t save to flash (station mode only) <ssid>,<pwd>[, <bssid>]

Query: <p/>+CWJAP_CUR:<ssid>, <bssid>, <channel>, <rssi></br/> OK <p/>Set: <p/>OK
<p/>or <p/>+CWJAP:<error code 1: connection timeout, 2: wrong password, 3: cannot find target AP, 4: connection failed>

-
WLANAT+CWJAP_DEF Connect to AP, save to flash (station mode only) x - what does saving to flash provide?
WLANAT+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>
WLANAT+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> <p/>OK <p/>depending on options set with CWLAPOPT

maybe, for selecting a WLAN
WLANAT+CWQAP Disconnect from AP - OK maybe, for error handling
WLANAT+CWSAP Set configuration of ESP8266 soft-AP, [@deprecated] -
WLANAT+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: <p/>+CWSAP_CUR:<ssid>, <pwd>, <chl>, <ecn>, <max conn>, <ssid hidden> <p/>Set: <p/>OK <p/>or <p/>ERROR

-
WLANAT+CWSAP_DEF Set configuration of ESP8266 soft-AP. Save changes to flash. -
WLANAT+CWLIF Get station IP which is connected to ESP8266 soft-AP -

<IP addr>, <mac></br>
OK

-
WLANAT+CWDHCP Enable/Disable DHCP, [@deprecated] -
WLANAT+CWDHCP_CUR Enable/Disable DHCP, changes not save to flash -
WLANAT+CWDHCP_DEF Enable/Disable DHCP, save changes to flash -
WLANAT+CWDHCPS_CUR Set IP range of DHCP server, changes not save to flash -
WLANAT+CWDHCPS_DEF Set IP range of DHCP server, save changes to flash -
WLANAT+CWAUTOCONN Connect to AP automatically on power-up <enable 0: disable, 1: enable auto-connect on startup> x - quite possibly!
WLANAT+CIPSTAMAC Set MAC address of ESP8266 station [@deprecated] -
WLANAT+CIPSTAMAC_CUR Set MAC address of ESP8266 station. Changes not save to flash. -
WLANAT+CIPSTAMAC_DEF Set MAC address of ESP8266 station. Save changes to flash. -
WLANAT+CIPAPMAC Set MAC address of ESP8266 soft-AP [@deprecated] -
WLANAT+CIPAPMAC_CUR Set MAC address of ESP8266 soft-AP. Changes not save to flash. -
WLANAT+CIPAPMAC_DEF Set MAC address of ESP8266 soft-AP. Save changes to flash. -
WLANAT+CIPSTA Set IP address of ESP8266 station, [@deprecated] -
WLANAT+CIPSTA_CUR Set IP address of ESP8266 station. Changes not save to flash. x - to query
WLANAT+CIPSTA_DEF Set IP address of ESP8266 station. Save changes to flash. -
WLANAT+CIPAP Set IP address of ESP8266 soft-AP, [@deprecated] -
WLANAT+CIPAP_CUR Set IP address of ESP8266 soft-AP. Changes not save to flash. -
WLANAT+CIPAP_DEF Set IP address of ESP8266 soft-AP. Save changes to flash. -
WLANAT+CWSTARTSMART Start SmartConfig (for AirKiss or ESP-TOUCH) -
WLANAT+CWSTOPSMART Stop SmartConfig -
WLANAT+CWSTARTDISCOVER Start the mode that ESP8266 can be found by WeChat -
WLANAT+CWSTOPDISCOVER Stop the mode that ESP8266 can be found by WeChat -
WLANAT+WPS Set WPS function -
WLANAT+MDNS Set MDNS function -

TCP

GroupAT CommandDescriptionParametersResponseMQTT-Relevant?
TCPAT+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>

+CIPSTATUS:<link ID 0-4>, <type TCP or UDP>, <remote_IP>, <remote_port>, <local_port>, <tetype 0: client, 1: server>

x
TCPAT+CIPDOMAIN DNS function -
TCPAT+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
TCPAT+CIPSSLSIZE Set the size of SSL buffer maybe, SSL would be great
TCPAT+CIPSEND Send data AT+CIPSEND=<link ID>, <length>

<p/>then receives serial data until length is reached, then <p/>ERROR <p/>or

<p/>SEND OK
x
TCPAT+CIPSENDEX Send data, if <length> or "\0" is met, data will be sent
TCPAT+CIPSENDBUF Write data into TCP-send-buffer
TCPAT+CIPBUFRESET Reset segment ID count
TCPAT+CIPBUFSTATUS Check status of TCP-send-buffer (not for SSL connections)
TCPAT+CIPCHECKSEQ Check if a specific segment is sent or not
TCPAT+CIPCLOSE Close TCP/UDP/SSL connection x
TCPAT+CIFSR Get local IP address

+ CIFSR:<IP address>

OK

x
TCPAT+CIPMUX Set multiple connections mode x - to select single mode, but do we need single mode?
TCPAT+CIPSERVER Configure as server -
TCPAT+CIPMODE Set transmission mode - not used so far
TCPAT+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
TCPAT+CIPSTO Set timeout when ESP8266 runs as TCP server -
TCPAT+CIUPDATE Upgrade firmware through network -
TCPAT+PING Function PING <IP>

+<time>

OK <p/>Or <p/>ERROR

maybe, for error handling
TCPAT+CIPDINFO Show remote IP and remote port with "+IPD" -