Microcontroller Tutorials

Arduino, Raspberry Pi, PIC, Beaglebone Resources

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:

 

Connect to AP

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

OK

Param1 -- ssid

Param2 -- password

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

Example:

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:

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:

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:

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:

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:

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:

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:

 

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:

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:

Typical AT Command Sequence for Getting a Webpage

Leave a Reply

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