Wi-Fi AT command set

This chapter introduces the command set for driving Wi-Fi. This command set will be adapted differently for different modules. Please follow the steps for specific differences: doc:../instruction/other/firmware_differences

AT+WMODE Inquire or set the Wi-Fi working mode.

setting command

command:

AT+WMODE=<MODE>,<save_flash>

response:

OK

Parameter

  • <MODE>:Wi-Fi working mode
    • 0:Wi-Fi is not initialized or turned off.

    • 1:STA

    • 2:AP

    • 3:AP+STA

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

    • 1:Save

Instruction

  • Set Wi-Fi working mode

Example

AT+WMODE=1,1  //set STA mode,save to FLASH
OK

Query command

command:

AT+WMODE?

response:

+WMODE:<MODE>
OK

Parameter

  • <MODE>:Wi-Fi working mode
    • 0:Wi-Fi is not initialized or turned off.

    • 1:STA

    • 2:AP

    • 3:AP+STA

Example

AT+WMODE? //Query Wi-Fi working mode
+WMODE:<1>
OK

AT+WSCAN scan Wi-Fi list


command:

AT+WSCAN

response:

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

Parameter

  • <index>:Scanning sequence id

  • <SSID>:Wi-Fi SSID

  • <CH>:Wi-Fi channel

  • <SECURITY>:safe mode

  • <RSSI>:Wi-Fi received signal strength

  • <BSSID>:Wi-Fi BSSID

Instruction

  • Need to 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 scanning with filter parameters

response:

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

Parameter

  • <ssid>:scan the specified SSID

  • <mac>:scan the specified mac address

  • <channel>:Scan the specified channel number.

  • <rssi>:Filter out AP with signal strength lower than rssi parameter value, unit: dBm, default value: -100, range: [-100,40].

Instruction

  • 1,Empty means to skip parameters.

  • 2,Can be used in combination with 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

Parameter

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

    • 1:Use DHCP to obtain IP

  • <IP>:The IP address of the module, which needs to be set for static IP.

  • <MASK>:Subnet mask, which needs to be set for static IP.

  • <GATEWAY>:Gateway, static IP needs to be set.

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

Parameter

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

    • 1:Use DHCP to obtain IP

  • <IP>:The IP address of the module, which needs to be set for static IP.

  • <MASK>:Subnet mask, which needs to be set for static IP.

  • <GATEWAY>:Gateway, static IP needs to be set.

Example

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

AT+WJAP connect AP

Set command

command:

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

response:

OK

Parameter

  • <ssid>:SSID of the connected AP.

  • <pwd>:Password of the connected AP.

  • <bssid>:BSSID of the connected AP

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

Parameter

  • <status>:connection status
    • 0:Wi-Fi is not connected (initial state or STA mode is not turned on)

    • 1:Connecting Wi-Fi or reconnecting Wi-Fi.

    • 2:Wi-Fi is connected, and IP has not been obtained yet.

    • 3:Connect to Wi-Fi and have obtained the IP.

    • 4:Wi-Fi connection failed (the state that the connection has not been successful after the reconnection number has exceeded).

  • <ssid>:SSID of the connected AP.

  • <pwd>:Password of the connected AP.

  • <bssid>:BSSID of the connected AP

  • <Security>:Encryption mode

  • 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>:MAC address of Wi-Fi module (lowercase characters, colon separated)

  • <ch>:Connecting channel

  • <IP>:IP address (dotted format)

  • <gateway>:Gateway address (dotted format)

Instruction

  • Inquire about Wi-Fi networking information (this is the current status obtained from hardware, not directly reading our settings)

AT+WDISCONNECT disconnect current AP connection

Setting command

command:

AT+WDISCONNECT

response:

OK

Example

AT+WDTSCONNECT

+EVENT:WIFI DISCONNECT

OK

Query command

Not support

AT+WAUTOCONN power-on automatic reconnection Wi-Fi

Setting command

cmmand:

AT+WAUTOCONN=<status>

response:

OK

Parameter

  • <status>
    • 0:Forbidden

    • 1:Enable

Instruction

  • Enable/disable the power-on automatic connection function.

Example

AT+WAUTOCONN=1

OK

Query command

command:

AT+WAUTOCONN?

response:

+WAUTOCONN:<status>
OK

Parameter

  • <status>
    • 0:Forbidden

    • 1:Enable

AT+WAPDHCP DHCP parameters in AP mode

Set command

command:

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

response:

OK

Parameter

  • <MODE>
    • 0:Forbidden DHCP

    • 1:Enable DHCP

  • <start_ip>:DHCP start address. eg:192.168.43.100

  • <end_ip>:DHCP end address.eg:192.168.43.200

  • <GATEWAY>:Gateway IP (module IP is gateway IP when DHCP is used), which needs to be set when DHCP is enabled.eg:192.168.43.1

Instruction

  • Set DHCP parameters in AP mode.

Example

AT+WAPDHCP=1,192.168.43.100,192.168.43.200,192.168.43.1

OK

command:

AT+WAPDHCP?

response:

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

Parameter

  • <MODE>
    • 0:Forbidden DHCP

    • 1:Enable DHCP

  • <start_ip>:DHCP start address. eg:192.168.43.100

  • <end_ip>:DHCP end address. eg:192.168.43.200

  • <GATEWAY>:Gateway IP (module IP is gateway IP when DHCP is used), which needs to be set when DHCP is enabled.eg: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

Parameter

  • <ssid>:Wi-Fi name

  • <pwd>:Wi-Fi Password, empty string means no password.

  • <channel>:Wi-Fi channel

  • <max conn>:Maximum number of connections (default is 3 if not written)

  • <ssid hidden>:Whether to hide the SSID, 0 is not hidden, 1 is 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

Parameter

  • <ssid>:AP的SSID

  • <pwd>:Password of AP

  • <Security>:Encryption mode

  • 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>:Channel of AP

  • <max conn>:Maximum number of connected stas supported by AP.

  • <ssid hidden>:Is the SSID of AP hidden?

  • <mac>:Open the MAC address of the network card of AP hotspot.

  • <IP>:IP address of AP (dotted format)

  • <Gateway>:Gateway address (dotted format)

Instruction

  • Query AP parameter information (this is the current status obtained from hardware, not directly reading our setting values)

AT+PING Process PING.

Set command

command:

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

response:

//Succeed
+PING:<time>
OK
//Faild
+PING:TIMEOUT
ERROR
//Return value description
time:Average delay ms

Parameter

  • <addr>:Ip address or domain name

  • <count>:Ping times, the default is 3 times, and loop means ping all the time and never returning (only the module can be restarted at this time).

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

Parameter

  • <MAC>:The MAC address to be set, MAC format 84f3ebdd9e63 (lowercase undivided).

Example

AT+CIPSTAMAC_DEF=84f3ebdd9e63

OK

Query command

command:

AT+CIPSTAMAC_DEF?

response:

+CIPSTAMAC_DEF:<MAC>
OK

Parameter

  • <MAC>:The MAC address to be set, MAC format 84f3ebdd9e63 (lowercase undivided).

Example

AT+CIPSTAMAC_DEF
+CIPSTAMAC_DEF:84f3ebdd9e63
OK

AT+WCOUNTRY Wi-Fi country code

Set command

command:

AT+WCOUNTRY=<country_code>

response:

OK

Parameter

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

    • 1:JP Japan

    • 2:AS American Samoa

    • 3:CA Canada

    • 4:US USA

    • 5:CN China

    • 6:HK China Hongkong

    • 7:TW Taiwan, China

    • 8:MO China Macau

    • 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

Parameter

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

    • 1:JP Japan

    • 2:AS American Samoa

    • 3:CA Canada

    • 4:US USA

    • 5:CN China

    • 6:HK China Hongkong

    • 7:TW Taiwan, China

    • 8:MO China Macau

    • 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 phone network configue

Set command

command:

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

response:

OK

Parameter

  • <status>

  • 0:Turn off the mobile phone distribution task

  • 1:Turn on the Wi-Fi distribution network once (successful distribution/overtime distribution will automatically return to the closed state)

  • 2:Turn on the Bluetooth distribution network once (successful distribution/overtime distribution will automatically return to the closed state)

  • 3:Open the AirKiss distribution network once.

  • BW16 module

  • 1:Realtek Simple Config

  • 2:Realtek Wi-Fi Config

  • Ai-WB2 series module

  • 1:Wi-Fi cnfigue(touch)

  • 2:Bluetooth distribution network (BluFi)

  • 3:Wechat AirKiss distribution network

  • <name>:This is used to customize the broadcast name of distribution network. Currently, only BluFi protocol supports this parameter distribution network protocol.

Example

AT+WCONFIG=1

OK

Query command

command:

AT+WCONFIG?

response:

+WCONFIG:<status>
OK

Parameter

  • <status>

  • 0:Turn off the mobile phone distribution task

  • 1:Turn on the Wi-Fi distribution network once (successful distribution/overtime distribution will automatically return to the closed state)

  • 2:Turn on the Bluetooth distribution network once (successful distribution/overtime distribution will automatically return to the closed state)

Example

AT+WCONFIG?
+WCONFIG:1
OK

AT+WSCANOPT Filter the information displayed by Wi-Fi scanning.

Set command

command:

AT+WSCANOPT=<option>

response:

OK

Parameter

  • <option>:Whether the Wi-Fi scanning results show the following parameters, the default value is 0xFF. If a bit is set to 1, the corresponding parameters will be displayed; if it is set to 0, the corresponding parameters will not be displayed. Option has two input methods (hexadecimal 0xXY and decimal).

  • bit 0: If show <ssid>

  • bit 1: If show <channel>

  • bit 2: If show <security>

  • bit 3: If show <rssi>

  • bit 4: If show <MAC>

Example

AT+WSCANOPT=15

+WSCANOPT:0x0f

OK

AT+WSCANOPT=0x0f

+WSCANOPT:0x0f

OK

Query command

command:

AT+WSCANOPT?

response:

+WSCANOPT:<option>
OK

Parameter

  • <option>:Whether the Wi-Fi scanning results show the following parameters, the default value is 0xFF. If a bit is set to 1, the corresponding parameters will be displayed; if it is set to 0, the corresponding parameters will not be displayed. Option has two input methods (hexadecimal 0xXY and decimal).

  • bit 0: If show <ssid>

  • bit 1: If show <channel>

  • bit 2: If show <security>

  • bit 3: If show <rssi>

  • bit 4: If show <MAC>

Example

AT+WSCANOPT?
+WSCANOPT:0xff
OK

AT+WRSSI Quiry Wi-Fi connection signal strength

Query command

command:

AT+WRSSI or AT+WRSSI?

response:

+WRSSI :<rssi>
OK

Parameter

  • <rssi>:Wi-Fi connection signal strength

Example

AT+WRSSI
+WSCANOPT:-50
OK