ESP8266 WiFi AT Command List

Test command

Command Response Parameter
AT OK -

 

Reset

Command Response Parameter
AT+RST OK -

 

Get firmware version

Command Response Parameter
AT+GMR VERSION:<Param>

OK

Param : firmware version

 

WiFi mode

Command Response Parameter
AT+CWMODE=? +CWMODE:(1-3)

OK

-
AT+CWMODE? +CWMODE: <Param>

OK

Param:

1 -- station mode (client)

2 -- AP mode (host)

3 -- AP+station mode

AT+CWMODE=<Param> OK Same as above

 

List APs

Command Response Parameter
AT+CWLAP AT+CWLAP: <Param1>,<Param2>,<Param3>,<Param4>,<Param5>

OK

Param1 -- auth (authentication)

0 -- OPEN

1 -- WEP

2 -- WPA_PSK

3 -- WPA2_PSK

4 -- WPA_WPA2_PSK

Param2 -- ssid

Param3 -- rssi (signal strength)

Param4 -- mac (MAC address)
Param5 -- channel

AT+CWLAP=<Param1>,<Param2>,<Param3> AT+CWLAP: <Param1>,<Param2>,<Param3>,<Param4>,<Param5>

OK

Same as above

Example Response:

+CWLAP:(3,”this_is_my_wifi”,-65,”40-8D-5C-E8-EB-49”,11)

 

Connect to AP

Command Response Parameter
AT+CWJAP? +CWJAP: <Param1>

OK

Param1 -- ssid

Param2 -- password

AT+CWJAP=<Param1>,<Param2> OK Same as above

Example:

AT+CWJAP=”this_is_my_wifi”,”1234”

 

Disconnect from AP

Command Response Parameter
AT+CWQAP OK -

 

Enable Multiple Connections

Command Response Parameter
AT+CIPMUX=<Param> OK Param -- mode

0 -- single connection

1 -- multiple connection (up to 4)

AT+CIPMUX? +CIFSR:<Param>

OK

Same as above

Configure SoftAP

Command Response Parameter
AT+CWSAP? +CWSAP: <Param1>, <Param2>, <Param3>,<Param4>

OK

Param1 -- ssid

Param2 -- password

Param3-- channel

Param4 -- auth

0 -- OPEN

2 -- WPA_PSK

3 -- WPA2_PSK

4 -- WPA_WPA2_PSK

AT+CWSAP=<Param1>,<Param2>, <Param3>, <Param4> OK Same as above

Example:

AT+CWSAP=”this_is_my_wifi”,”1234”,11,3

 

Show Clients Connected to SoftAP

Command Response Parameter
AT+CWLIF [<Param1>, <Param2>]

OK

Param1 -- IP address

Param2 -- mac address (32-bit for ESP-01, 8-bit for ESP-12)

Example Response:

AT+CWLIF
192.168.1.5, 3fff5040:3fff508D:3fff505C:3fff50E8:3fff50EB:3fff5049

Set IP Address in SoftAP Mode

Command Response Parameter
AT+CIPAP? +CIPAP?: <Param1>

+CIPAP?: <Param2>

+CIPAP?: <Param3>

OK

Param1 -- IP address

Optional:

Param2 -- gateway address

Param3 -- netmask address

AT+CIPAP=<Param1>,[<Param2>,<Param3>] OK Same as above

Example:

AT+CIPAP=”192.168.1.5”,”192.168.1.1”,”255.255.255.0”

Set IP Address in Station Mode

Command Response Parameter
AT+CIPSTA? +CIPSTA?: <Param1>

+CIPSTA?: <Param2>

+CIPSTA?: <Param3>

OK

Param1 -- IP address

Optional:

Param2 -- gateway address

Param3 -- netmask address

AT+CIPSTA=<Param1>,[<Param2>,<Param3>] OK Same as above

Example:

AT+CIPSTA=”192.168.1.3”,”192.168.1.1”,”255.255.255.0”

 

Set MAC Address in Station Mode

Command Response Parameter
AT+CIPSTAMAC? +CIPSTAMAC?: <Param>

OK

Param -- mac address
AT+CIPSTAMAC=<Param> OK Same as above

Example:

AT+CIPSTAMAC=”40-8C-5C-E8-EA-48”

Notes:

  • When setting the MAC address of the ESP8266, make sure that LSB (bit 0) of each byte is not 1 (see example MAC address above)
  • The SoftAP MAC address must be different from the Station Mode MAC address

Set MAC Address in SoftAP Mode

Command Response Parameter
AT+CIPAPMAC? +CIPSTAMAC?: <Param>

OK

Param -- mac address
AT+CIPAPMAC=<Param> OK Same as above

Example:

AT+CIPAPMAC=”40-8C-5C-E8-EA-48”

See same notes on previous command

Get Connection Status

Command Response Parameter
AT+CIPSTATUS STATUS: <Param1>

+CIPSTATUS: <Param2>, <Param3>, <Param4>, <Param5>, <Param6>

OK

Param1 -- status

2 -- Has IP

3 -- Connected

4 -- Not Connected

Param2 -- id (0 to 4)

Param3 -- type (“TCP” or “UDP”)

Param4 -- IP address

Param5 -- port number

Param6 -- tetype

0 -- running as client

1 -- running as server

AT+CIPSTATUS=? OK -

 

Start Connection

Command Response Parameter
Single TCP Connection (AT+CIPMUX=0):

AT+CIPSTART=<Param1>,<Param2>,<Param3>,[<Param4>]

OK

or

ERROR

or

Already Connected

Param1 -- type (“TCP or UDP”)

Param2 -- IP address

Param3 -- port number

Optional:

Param4 -- TCP keep alive

0 -- disable TCP keep alive

1 -- 1-7200 seconds detection time interval

Multiple TCP Connection (AT+CIPMUX=1):

AT+CIPSTART=<Param1>,<Param2>,<Param3>,<Param4>,[<Param5>]

OK

or

ERROR

or

Already Connected

Param1 -- link ID (0 to 4)

Param2 -- type (“TCP or UDP”)

Param3 -- IP address

Param4 -- port number

Optional:

Param5 -- TCP keep alive

0 -- disable TCP keep alive

1 -7200 -- seconds detection time interval

Single UDP Connection (AT+CIPMUX=1):

AT+CIPSTART=<Param1>,<Param2>,[<Param3>,<Param4>]

OK

or

ERROR

or

Already Connected

Param1 -- type (“TCP or UDP”)

Param2 -- IP address

Param3 -- port number

Optional:

Param4 -- UDP local port

Param5 -- UDP mode

Multiple UDP Connection (AT+CIPMUX=1):

AT+CIPSTART=<Param1>,<Param2>,<Param3>,[<Param4>,<Param5>]

OK

or

ERROR

or

Already Connected

Param1 -- link ID (0 to 4)

Param2 -- type (“TCP or UDP”)

Param3 -- IP address

Param4 -- port number

Optional:

Param5 -- UDP local port

Param6 -- UDP mode

Example:

AT+CIPSTART=”TCP”,”teachmemicro.com”,8080
AT+CIPSTART=”TCP”,”172.180.2.3”,80,5000
AT+CIPSTART=”UDP”,192.168.10.110”,1000,1001,1

 

Send Data

Command Response Parameter
Single Connection (AT+CIPMUX=0):

AT+CIPSEND=<Param>

Wrap return > after the Set Command. Begin

receiving serial data. When data length defined by

<length> is met, the transmission of data starts.

If the connection cannot be established or gets

disrupted during data transmission, the system

returns:

ERROR

If data is transmitted successfully, the system

returns:

SEND OK

If it failed, the system returns:

SEND FAIL

Param -- data length (up to 2048 bytes)
Multiple Connection (AT+CIPMUX=1):

AT+CIPSEND=<Param1>,<Param2>

Same response as above Param1 -- link ID (0 to 4)

Param2 -- data length (up to 2048 bytes)

Close Connection

Command Response Parameter
Single Connection:

AT+CIPCLOSE

OK -
Multiple Connection:

AT+CIPCLOSE=<Param>

OK Param -- id of connection to close. Id = 5 closes all connection

 

Enter deep-sleep mode

Command Response Parameter
AT+GLSP=<Param> <Param>

OK

Param : time in milliseconds

Example:

AT+GLSP=1000

Note: Reset pin should be high

 

Enable/Disable echo:

Command Response Parameter
ATE0 OK -
ATE1 OK -

Note: turning on echo sends back the command you sent

Enable/Disable DHCP

Command Response Parameter
AT+CWDHCP=<Param1>, <Param2> OK Param1 -- mode:

0 -- set as SoftAP

1 -- set as station

2 -- set as SoftAP + station

Param2 -- enable:

0 -- enable DHCP

1 -- disable DHCP

 

Get Local IP Address

Command Response Parameter
AT+CIFSR +CIFSR:<Param>

OK

Param -- IP address

Configure Device as Server

Command Response Parameter
AT+CIPSERVER = <Param1>,[<Param2>] OK Param1 -- mode

0 -- delete server

1 -- create server

Optional:

Param2 -- port number (default:333)

Note: Server creation is allowed only if multiple connections is enabled (AT+CIPMUX=1)

Set Max Connections to the Server

Command Response Parameter
AT+CIPSERVERMAXCONN = <Param> OK Param -- number of connections (1 to 5)

 

Set Transmission Mode

Command Response Parameter
AT+CIPMODE = <Param> OK Param -- mode

0 -- normal transmission

1 -- transparent transmission (UART-WiFi passthrough)

Note: Setting transmission mode is allowed only for single TCP connection or UDP mde where both remote IP and port do not change

Ping

Command Response Parameter
AT+PING = <Param> +<time>

OK

Param -- IP address or host name

time -- response time of ping

Example:

AT+PING = “teachmemicro.com”

Typical AT Command Sequence for Getting a Webpage

AT+CIPMUX=1
AT+CWMODE=3
AT+CWJAP=”this_is_my_wifi”,”1234”
AT+CIPSTART=0,"TCP","teachmemicro.com","80”
AT+CIPSEND=0,16
   >GET / HTTP/1.1

Leave a Reply

Your email address will not be published. Required fields are marked *