Wi-Fi AT Command Set

This chapter introduces the Wi-Fi AT command set. Adaptations may vary across different modules. For details, see Firmware Versions and Feature Differences.

AT+WMODE query or set Wi-Fi operating mode

Set Command

Command:

AT+WMODE=<MODE>,<save_flash>

Response:

OK

Parameters

  • <MODE>: Wi-Fi operating mode
    • 0: Uninitialized or Wi-Fi disabled

    • 1: STA

    • 2: AP

    • 3: AP+STA

  • <save_flash>: Whether to save to flash
    • 0: Do not save

    • 1: Save

Description

  • Set Wi-Fi operating mode

Example

AT+WMODE=1,1  //设置STA模式,保存到FLASH
OK

Query Command

Command:

AT+WMODE?

Response:

+WMODE:<MODE>
OK

Parameters

  • <MODE>: Wi-Fi operating mode
    • 0: Uninitialized or Wi-Fi disabled

    • 1: STA

    • 2: AP

    • 3: AP+STA

Example

AT+WMODE? //查询Wi-Fi工作模式
+WMODE:<1>
OK

AT+WSCAN scan Wi-Fi list

Execute Command

Command:

AT+WSCAN

Response:

+WSCAN:index SSID,CH,SECURITY,RSSI,BSSID
<index> <SSID>,<CH>,<SECURITY>,<RSSI>,<BSSID>
...
OK

Parameters

  • <index>: Scan sequence ID

  • <SSID>: Wi-Fi SSID

  • <CH>: Wi-Fi channel

  • <SECURITY>: Security mode

  • <RSSI>: Wi-Fi received signal strength

  • <BSSID>: Wi-Fi BSSID

Description

  • Must be in STA mode.

Example

AT+WSCAN
+WSCAN:index SSID,CH,SECURITY,RSSI,BSSID
1 IoT-Connect,9,WPA/WPA2 Mixed,-19,cc:81:da:1f:45:80
2 IoT-Connect_5G,44,WPA/WPA2 Mixed,-30,cc:81:da:1f:45:88
3 super_2G,1,WPA/WPA2 AES,-32,54:75:95:4f:74:5e
...
30 ChinaNet-uL5X,1,WPA/WPA2 Mixed,-71,ca:50:e9:8b:5a:0c

OK

Set Command

Command:

AT+WSCAN=[<ssid>,<mac>,<channel>,<rssi>]   带过滤参数进行 Wi-Fi 扫描

Response:

+WSCAN:index SSID,CH,SECURITY,RSSI,BSSID
<index> <SSID>,<CH>,<SECURITY>,<RSSI>,<BSSID>
...
OK

Parameters

  • <ssid>: Scan specified SSID

  • <mac>: Scan specified MAC address

  • <channel>: Scan specified channel number

  • <rssi>: Filter out APs with signal strength below this value in dBm. Default: -100, range: [-100, 40]

Description

  • 1,为空代表跳过参数。

  • 2,可与 AT+WSCANOPT 组合使用。

Example

AT+WSCAN=AXK
+WSCAN:index,SSID,CH,SECURITY,RSSI,BSSID
1,AXK,149,WPA/WPA2 Mixed,-50,f8:8c:21:b4:40:22
2,AXK,48,WPA/WPA2 Mixed,-57,f8:8c:21:b4:4a:39
3,AXK,161,WPA/WPA2 Mixed,-75,f8:8c:21:b4:3f:62
4,AXK,157,WPA/WPA2 Mixed,-84,f8:8c:21:b4:2d:89
OK

AT+WSDHCP query or set DHCP parameters in STA mode

Set Command

Command:

AT+WSDHCP=<MODE>[,<IP>,<MASK>,<GATEWAY>]

Response:

OK

Parameters

  • <MODE>: IP acquisition mode
    • 0: Disable DHCP, use static IP

    • 1: Use DHCP to obtain IP

  • <IP>: Module IP address; required for static IP

  • <MASK>: Subnet mask; required for static IP

  • <GATEWAY>: Gateway; required for static IP

Example

AT+WSDHCP=0,192.168.31.199,255.255.255.0,192.168.31.1

OK

Query Command

Command:

AT+WSDHCP?

Response:

+WSDHCP:<MODE>[,<IP>,<MASK>,<GATEWAY>]
OK

Parameters

  • <MODE>: IP acquisition mode
    • 0: Disable DHCP, use static IP

    • 1: Use DHCP to obtain IP

  • <IP>: Module IP address; required for static IP

  • <MASK>: Subnet mask; required for static IP

  • <GATEWAY>: Gateway; required for static IP

Example

AT+WSDHCP?
+WSDHCP:0,192.168.31.199,255.255.255.0,192.168.31.1
OK

AT+WJAP connect to AP

Set Command

Command:

AT+WJAP=<ssid>,<pwd>[,<bssid>]

Response:

OK

Parameters

  • <ssid>: SSID of AP to connect to (max 32 bytes)

  • <pwd>: Password of AP to connect to (max 32 bytes)

  • <bssid>: BSSID of AP to connect to

Example

AT+WJAP=super_2G,123456798
OK

Query Command

Command:

AT+WJAP?

Response:

+WJAP:<status>,<ssid>,<pwd>,<bssid>,<Security>,<MAC>,<ch>,<IP>,<gateway>
Client Num: <client number>
Client <id> MAC:<xx:xx:xx:xx:xx:xx>
OK

Parameters

  • <status>: Connection status
    • 0: Not connected to Wi-Fi (initial state or STA mode not enabled)

    • 1: Connecting to Wi-Fi or reconnecting

    • 2: Connected to Wi-Fi, IP not yet obtained

    • 3: Connected to Wi-Fi and IP obtained

    • 4: Wi-Fi connection failed (exceeded retry count)

  • <ssid>: SSID of connected AP

  • <pwd>: Password of connected AP

  • <bssid>: BSSID of AP to connect to

  • <Security>: Encryption type

  • Open //Open network

  • WEP

  • WPA TKIP

  • WPA AES

  • WPA Mixed

  • WPA2 AES

  • WPA2 TKIP

  • WPA2 Mixed

  • WPA/WPA2 TKIP

  • WPA/WPA2 AES

  • WPA/WPA2 Mixed

  • WPA2 Enterprise

  • WPA/WPA2 Enterprise

  • WPA3-ASE AES

  • UnknownType //Unknown type

  • <MAC>: Wi-Fi module MAC address (lowercase, colon-separated)

  • <ch>: Connection channel

  • <IP>: IP address (dotted decimal)

  • <gateway>: Gateway address (dotted decimal)

Description

  • Query Wi-Fi network information (current hardware state, not stored configuration values)

AT+WDISCONNECT disconnect current AP connection

Set Command

Command:

AT+WDISCONNECT

Response:

OK

Example

AT+WDTSCONNECT

+EVENT:WIFI DISCONNECT

OK

Query Command

Not supported yet

AT+WAUTOCONN auto-reconnect Wi-Fi on power-up

Set Command

Command:

AT+WAUTOCONN=<status>

Response:

OK

Parameters

  • <status>:
    • 0: Disabled

    • 1: Enabled

Description

  • Enable/disable auto-connect on power-up

  • Note: Connect to the router successfully before sending this command.

Example

AT+WAUTOCONN=1

OK

Query Command

Command:

AT+WAUTOCONN?

Response:

+WAUTOCONN:<status>
OK

Parameters

  • <status>:
    • 0: Disabled

    • 1: Enabled

AT+WAPDHCP DHCP parameters in AP mode

Set Command

Command:

AT+WAPDHCP=<MODE>,<start_ip>,<end_ip>,<GATEWAY>

Response:

OK

Parameters

  • <MODE>:
    • 0: Disable DHCP

    • 1: Enable DHCP

  • <start_ip>: DHCP start address. e.g. 192.168.43.100

  • <end_ip>: DHCP end address. e.g. 192.168.43.200

  • <GATEWAY>: Gateway IP (module IP equals gateway IP when DHCP is enabled). Required when DHCP is enabled. e.g. 192.168.43.1

Description

  • Set DHCP parameters in AP mode

Example

AT+WAPDHCP=1,192.168.43.100,192.168.43.200,192.168.43.1

OK

Query Command

Command:

AT+WAPDHCP?

Response:

+WAPDHCP:<MODE>[,<start_ip>,<end_ip>,<GATEWAY>]
OK

Parameters

  • <MODE>:
    • 0: Disable DHCP

    • 1: Enable DHCP

  • <start_ip>: DHCP start address. e.g. 192.168.43.100

  • <end_ip>: DHCP end address. e.g. 192.168.43.200

  • <GATEWAY>: Gateway IP (module IP equals gateway IP when DHCP is enabled). Required when DHCP is enabled. e.g. 192.168.43.1

AT+WAP Wi-Fi parameters in AP mode

Set Command

Command:

AT+WAP=<ssid>,<pwd>,<channel>,<max conn>,<ssid hidden>

Response:

OK

Parameters

  • <ssid>: Wi-Fi name (max 32 bytes)

  • <pwd>: Wi-Fi password; empty string means no password (max 32 bytes)

  • <channel>: Wi-Fi channel

  • <max conn>: Maximum connections (default 3 if omitted)

  • <ssid hidden>: Hide SSID; 0: visible, 1: hidden

Example

AT+WAP=MY_Wi-Fi,12345678,1,3,0
OK

Query Command

Command:

AT+WAP?

Response:

+WAP:<ssid>,<pwd>,<security>,<channel>,<max conn>,<ssid hidden>,<mac>,<IP>,<Gateway>
OK

Parameters

  • <ssid>: AP SSID

  • <pwd>: AP password

  • <Security>: Encryption type

  • Open //Open network

  • WEP

  • WPA TKIP

  • WPA AES

  • WPA Mixed

  • WPA2 AES

  • WPA2 TKIP

  • WPA2 Mixed

  • WPA/WPA2 TKIP

  • WPA/WPA2 AES

  • WPA/WPA2 Mixed

  • WPA2 Enterprise

  • WPA/WPA2 Enterprise

  • WPA3-ASE AES

  • UnknownType //Unknown type

  • <channel>: AP channel

  • <max conn>: Maximum STA connections supported by AP

  • <ssid hidden>: Whether AP SSID is hidden

  • <mac>: MAC address of the network interface running the AP hotspot

  • <IP>: AP IP address (dotted decimal)

  • <Gateway>: Gateway address (dotted decimal)

Description

  • Query AP parameter information (current hardware state, not stored configuration values)

AT+PING perform Ping operation

Set Command

Command:

AT+PING=<addr>[,<count>]

Response:

//成功
+PING:<time>
OK
//失败
+PING:TIMEOUT
ERROR
//返回值描述
time:平均延时ms

Parameters

  • <addr>: IP address or domain name

  • <count>: Ping count; default 3; loop means continuous ping without return (module restart required)

Example

AT+PING=192.168.4.134
+PING:<30>
OK

AT+CIPSTAMAC_DEF Wi-Fi station MAC address

Set Command

Command:

AT+CIPSTAMAC_DEF=<MAC>

Response:

OK

Parameters

  • <MAC>: MAC address to set; format 84f3ebdd9e63 (lowercase, no separators)

Example

AT+CIPSTAMAC_DEF=84f3ebdd9e63

OK

Query Command

Command:

AT+CIPSTAMAC_DEF?

Response:

+CIPSTAMAC_DEF:<MAC>
OK

Parameters

  • <MAC>: MAC address to set; format 84f3ebdd9e63 (lowercase, no separators)

Example

AT+CIPSTAMAC_DEF
+CIPSTAMAC_DEF:84f3ebdd9e63
OK

AT+WCOUNTRY Wi-Fi country code

Set Command

Command:

AT+WCOUNTRY=<country_code>

Response:

OK

Parameters

  • <country_code>: Wi-Fi country code
    • 0: Do not specify country code; use SDK default

    • 1: JP Japan

    • 2: AS American Samoa

    • 3: CA Canada

    • 4: US United States

    • 5: CN China

    • 6: HK Hong Kong, China

    • 7: TW Taiwan, China

    • 8: MO Macao, China

    • 9: IL Israel

    • 10: SG Singapore

    • 11: KR South Korea

    • 12: TR Turkey

    • 13: AU Australia

    • 14: ZA South Africa

    • 15: BR Brazil

Example

AT+WCOUNTRY=5

OK

Query Command

Command:

AT+WCOUNTRY?

Response:

+WCOUNTRY:<country_code>
OK

Parameters

  • <country_code>: Wi-Fi country code
    • 0: Do not specify country code; use SDK default

    • 1: JP Japan

    • 2: AS American Samoa

    • 3: CA Canada

    • 4: US United States

    • 5: CN China

    • 6: HK Hong Kong, China

    • 7: TW Taiwan, China

    • 8: MO Macao, China

    • 9: IL Israel

    • 10: SG Singapore

    • 11: KR South Korea

    • 12: TR Turkey

    • 13: AU Australia

    • 14: ZA South Africa

    • 15: BR Brazil

Example

AT+WCOUNTRY?
+WCOUNTRY:5
OK

AT+WCONFIG mobile provisioning

Set Command

Command:

AT+WCONFIG=<status>[,<name>]

Response:

OK

Parameters

  • <status>:

  • 0: Disable mobile provisioning task

  • 1: Start one Wi-Fi provisioning session (auto-disables on success or timeout)

  • 2: Start one Bluetooth provisioning session (auto-disables on success or timeout)

  • 3: Start one AirKiss provisioning session

  • BW16 module

  • 1: Realtek Simple Config

  • 2: Realtek Wi-Fi Config

  • Ai-WB2 series modules

  • 1: Wi-Fi provisioning (touch)

  • 2: Bluetooth provisioning (BluFi)

  • 3: WeChat AirKiss provisioning

  • <name>: Custom provisioning broadcast name; currently only BluFi protocol supports this parameter

Example

AT+WCONFIG=1

OK

Query Command

Command:

AT+WCONFIG?

Response:

+WCONFIG:<status>
OK

Parameters

  • <status>:

  • 0: Disable mobile provisioning task

  • 1: Start one Wi-Fi provisioning session (auto-disables on success or timeout)

  • 2: Start one Bluetooth provisioning session (auto-disables on success or timeout)

Example

AT+WCONFIG?
+WCONFIG:1
OK

AT+WSCANOPT filter Wi-Fi scan display information

Set Command

Command:

AT+WSCANOPT=<option>

Response:

OK

Parameters

  • <option>: Whether Wi-Fi scan results show the following parameters. Default: 0xFF. Set a bit to 1 to show the parameter, 0 to hide. Two input formats: hexadecimal 0xXY or decimal.

  • bit 0: Show <ssid>

  • bit 1: Show <channel>

  • bit 2: Show <security>

  • bit 3: Show <rssi>

  • bit 4: Show <MAC>

Example

AT+WSCANOPT=15

+WSCANOPT:0x0f

OK

AT+WSCANOPT=0x0f

+WSCANOPT:0x0f

OK

Query Command

Command:

AT+WSCANOPT?

Response:

+WSCANOPT:<option>
OK

Parameters

  • <option>: Whether Wi-Fi scan results show the following parameters. Default: 0xFF. Set a bit to 1 to show the parameter, 0 to hide. Two input formats: hexadecimal 0xXY or decimal.

  • bit 0: Show <ssid>

  • bit 1: Show <channel>

  • bit 2: Show <security>

  • bit 3: Show <rssi>

  • bit 4: Show <MAC>

Example

AT+WSCANOPT?
+WSCANOPT:0xff
OK

AT+WRSSI query Wi-Fi connection signal strength

Query Command

Command:

AT+WRSSI or AT+WRSSI?

Response:

+WRSSI :<rssi>
OK

Parameters

  • <rssi>: Wi-Fi connection signal strength

Example

AT+WRSSI
+WSCANOPT:-50
OK