Microsoft 咋宎Luat Air602 WiFi模嚊AT Ex AT Command User Manual

Air602%20AT%20Command%20User%20Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 73

Air602 AT Command User Manual
V1.1
Created by Luat, translated by seeed
Air602_AT Instruction User Manual
Document version
Luat 2 /73
Version Data Modify record Author Review Approve
V1.0.0 2018-03-29 create Mrbenlu Craoy Luat
V1.0.1 2018-08-04 Improve documentation Mrbenlu Craoy Luat
V1.0.2 2018-08-05 Improve documentation Mrbenlu Craoy Luat
V1.1 2018-08-08
Improve documentation, add
examples, add MQTT Winny
V1.1 English 2018-10-24
Completed the English translation
based on version 1.1 Jelly Bill Seeed
Air602_AT Instruction User Manual
Contents
1 Introduction ......................................................................................................................................................6
1.1 Overview....................................................................................................................................................6
1.2 Control Command Protocol........................................................................................................................6
.1.2.1 Command Code..............................................................................................................................6
1.2.2 Error Code.......................................................................................................................................9
2 AT Command Protocol .............................................................................................................................. 10
2.1 Syntax Description................................................................................................................................... 10
2.2.1 Syntax Format............................................................................................................................... 10
2.1.1.1 Processing Flow................................................................................................................ 11
2.1.1.2 Example Format................................................................................................................ 12
2.2 Instruction Definition................................................................................................................................ 13
2.2.1 System Control Class Instruction................................................................................................. 13
3 /73
2.2.1.1
2.2.1.2
2.2.1.3
2.2.1.4
2.2.1.5
2.2.1.6
2.2.1.7
2.2.1.8
2.2.1.9
2.2.1.10
Null Operation InstructionAT+ ................................................................................... 13
System ResetAT+Z ...................................................................................................... 13
settings Echo AT+E ..................................................................................................... 14
Serial Port Enters Transparent Transmission Mode AT+ENTM................................. 14
Enter Energy Saving Mode AT+ENTS......................................................................... 16
Reset Factory Settings AT+RSTF................................................................................. 17
Save In-memory Parameters to FLASH AT+PMTF..................................................... 18
Get the physical address of the wireless network card in STA mode : AT+QMAC........19
Get the physical address of the wireless network card in SoftAP mode : AT+APMAC..19
Get Version AT+QVER ................................................................................................ 20
2.2.2 Parameter Setting Class Instruction............................................................................................ 21
2.2.2.1
2.2.2.2
2.2.2.3
2.2.2.4
2.2.2.5
Wireless Netoperating mode AT+WPRT.................................................................... 21
Query/set the local IP address in STA mode AT+NIP................................................ 22
Query/set the local IP address in SoftAP mode AT+APNIP....................................... 23
Network Card DNSAT+DNS......................................................................................... 24
Operating ModeAT+ATM.............................................................................................. 24
Air602_AT Instruction User Manual
2.2.2.6
2.2.2.7
2.2.2.8
2.2.2.9
2.2.2.10
2.2.2.11
2.2.2.12
2.2.2.13
2.2.2.14
2.2.2.15
2.2.2.16
2.2.2.17
2.2.2.18
2.2.2.19
2.2.2.20
2.2.2.21
2.2.2.22
2.2.2.23
2.2.2.24
2.2.2.25
4 /73
Socket connection in automatic operating mode AT+ATRM ............................. 25
Wireless Network Name AT+SSID .................................................................... 27
SoftAP Wireless Network Name AT+APSSID................................................... 27
Wireless Network Security Mode AT+ENCRY.................................................. 28
SoftAP Wireless Network Security Mode AT+APENCRY ................................. 29
Network Key AT+KEY ....................................................................................... 30
SoftAP Network Key AT+APKEY....................................................................... 31
Set/query the BSSID address of the specified AP AT+BSSID........................... 33
Set/query the specified wireless channel mode AT+CHL................................ 33
Set / Query SoftAP Wireless Channel Mode AT+APCHL .................................. 34
Wireless Channel List AT+CHLL ......................................................................... 34
Enable automatic creation of adhoc network functions AT+WATC................. 35
Turn automatic energy saving mode on/off AT+WPSM................................... 35
Enable/disable AP SSID broadcast AT+BRDSSID................................................ 37
UART Port Data FormatAT+UART ...................................................................... 37
Built-in enable WEB management server AT+WEBS ........................................ 39
Device Name AT+DNAME................................................................................... 39
System Login Password AT+PASS ....................................................................... 39
Receiving User Data AT+CUSTDATA................................................................... 40
Query the configured networking parameters AT+CNTPARAM........................ 40
2.2.3 Network Control Class Instruction.......................................................................................... 41
2.2.3.1
2.2.3.2
2.2.3.3
2.2.3.4
2.2.3.5
2.2.3.6
2.2.3.7
2.2.3.8
2.2.3.9
2.2.3.10
Network Card Interface Mode:AT+PORTM............................................................. 41
Get the IP address of the external domain name AT+SKGHBN.......................... 42
Set / Query WPS Features AT+WWPS ................................................................. 42
Join The Specified AP AT+WJOIN......................................................................... 43
Disconnect the Current Network AT+WLEAV...................................................... 45
Scan Wireless NetworkAT+WSCAN..................................................................... 46
Query the local network connection status AT+LKSTT....................................... 47
Set / Query SoftAP Status AT+APLKSTT............................................................... 48
Query the connected station AT+SLIST............................................................... 50
Build a socket connection AT+SKCT.................................................................... 50
Air602_AT Instruction User Manual
2.2.3.11 Send data through the specified socket AT+SKSND.......................................... 52
2.2.3.12 Read the data in the receive buffer of the specified socket AT+SKRCV............ 53
2.2.3.13 Get the specified socket state AT+SKSTT ........................................................... 54
2.2.3.14 Close the specified socket AT+SKCLS ................................................................. 55
2.2.3.15 Set the socket sent by the system by default. AT+SKSDF.................................. 55
2.2.3.16 Get the source IP address of the current socket received data AT+SKSRCIP…. 56
2.2.3.17 Socket actively reports receiving data AT+SKRPTM .......................................... 56
2.2.3.18 One-click configuration AT+ONESHOT ............................................................... 57
2.2.3.19 HTTP client post get function AT+HTTPC........................................................... 58
2.2.4 MQTT Instruction................................................................................................................... 59
Luat 5 /73
2.2.4.1
2.2.4.2
2.2.4.3
2.2.4.4
2.2.4.5
2.2.4.6
2.2.4.7
2.2.4.8
2.2.4.9
2.2.4.10
Set up the MQTT server AT+MSERVER.............................................................. 59
Set login account and password AT+MLOGIN................................................... 59
Set Client IDAT+MID........................................................................................... 59
Connect to the MQTT server AT+MCONNECT.................................................. 60
Subscribe to a topic AT+MSUB .......................................................................... 60
Post a message AT+MPUB................................................................................. 61
Received a message AT+MTOPIC,AT+MQD ...................................................... 61
Close the MQTT server AT+MCLOSE.................................................................. 61
MQTT Result Code................................................................................................... 62
MQTT Usage Example............................................................................................. 63
3 Common operation........................................................................................................................................ 65
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
Create a SoftAP Process............................................................................................................. 65
Scan AP Process.......................................................................................................................... 66
STA joins the AP Process............................................................................................................ 66
Create an APSTA Process........................................................................................................... 67
How the STA disconnects the AP................................................................................................ 68
SoftAP Disconnected................................................................................................................... 68
How STAs view current status..................................................................................................... 68
View current SoftAP status.......................................................................................................... 68
How to use the socket function................................................................................................... 68
Transparent transmission application in automatic operating mode........................................... 73
Air602_AT Instruction User Manual
1 Introduction
1.1 Overview
This manual describes the AT+ command communication protocol of the Luat embedded Wi-Fi module. The
AT+ command protocol uses a set of command based on ascii to communicate with the Wi-Fi chip through the
UART interface.
1.2 Control Command Protocol
1.2.1 Command Code
This section is a user command for implementing parameter configuration and networking transmission of
the product. The command list is as follows:
Luat 6 /73
Number
Instruction
Name Function
1(null) Null Operation Instruction
2ATM Set/query operating mode
3ATRM
Set/query socket connection information automatically created in
automatic operating mode
4BSSID Set/query the BSSID address of the specified AP
5BRDSSID Enable and disable the SSID broadcast of the AP
6CHL Set/query the specified wireless channel mode
7CHLL Set/Query Wireless Channel List
8CNTPARAM Query the configured networking parameters
9CUSTDATA Receive user data sent via one-click configuration tool
10 DNAME Set/query device name
11 DNS Set domain name of network card
Air602_AT Instruction User Manual
Luat 7 /73
12 ESwitch serial port character echo
13 ENCRY Set/Query Wireless Network Security Mode
14 ENTM Enter serial port transparent transmission mode
15 ENTS Set the system to enter energy saving mode
16 HTTPC HTTP post get data function
17 KEY Set/Query Wireless Network Key
18 LKSTT Query network connection status
19 LKSTT2 Query network connection status 2, valid only in APSTA mode
20 NIP Set/query the local IP address
21 ONESHOT Turn one-click configuration on or off
22 PASS Set / query system password
23 PMTF Update all parameters in memory to Flash
24 PORTM Set the interface mode of the wireless network card
25 QMAC Query physical address
26 QMAC2 Query physical address 2, valid only in APSTA mode
27 QVER Query version information
28 RSTF Reset Factory settings
29 SKCLS Close socket connection
30 SKCT Create a socket connection
31 SKGHBN Get the IP of the server
32 SKRCV Receive data via a Socket connection
Air602_AT Instruction User Manual
Luat 8 /73
33 SKRPTM Open or close the socket to actively report the receiving data function
34 SKSDF Set the default send socket connection
35 SKSND Send data over a socket connection
36 SKSRCIP Query socket data source IP address
37 SKSTT Query socket connection status
38 SLIST Query the STAs that have been connected, valid only in AP and APSTA
modes.
39 SSID Set/Query Wireless Network Name
40 SSID2 Set/query the wireless network name, valid only in APSTA mode
41 UART Set / query serial data format
42 WATC Set/Query to automatically create an Adhoc network
43 WEBS Set/Query Web Server
44 WJOIN Join/create a wireless network
45 WLEAV Disconnect wireless network
46 WPRT Set/Query Wireless Network Type
47 WPSM Turn energy saving mode on/off
48 WSCAN Scan Network
49 WWPS Set / Query WPS Features
50 ZReset
Air602_AT Instruction User Manual
1.2.2 Erro Code
The error codes supported by this system are defined as follows
ASCII Description
- Success
-1 Invalid command format
-2 Command not supported
-3 Invalid operator
-4 Invalid parameter
-5 Operation not allowed
-6 Not enough memory
-7 FLASH error
-8 System busy
-10 access the network failed
-11 No socket available
-12 Invalid socket
-13 Socket connection failed
-62 Socket failed to send
-63 Socket reception failed
-64 Undefined error
Luat 9 /73
Air602_AT Instruction User Manual
2 AT Command Protocol
2.1 Syntax Description
This module uses the AT+ command protocol as the user control protocol. The AT+ instruction protocol uses a set of
command line format instruction sets based on ascii. The syntax format and processing flow are described below.
2.2.1 Syntax format
Format Description
Luat 10 /73 page
Command Message
AT+<CMD>[op][para1],[para2],[para3],[para4]…<CR> AT+
Command message prefix
CMDCommand String
[op]Instruction operator, when the command needs to take a parameter, you can specify the operation
type of the parameter, including
=Parameter/Return value preamble
=! In the setting parameter class command, it means that the modification is synchronized to
flash, and the restart does not disappear. If there is no ! after = , it means that it is only saved in
memory, and the parameters disappear after restarting.
=?In the Set Parameter Class command, query the current settings.
<CR>Carriage Returnascii character 0x0d
Response message
+<RSP>[op][para1],[para2],[para3],[para4]…<CR><LF><CR><LF>
+Response message prefix
RSPResponse string
OK Success
ERR Failure
<>Indicates the part that must be included
[ ] Indicates the optional part
Air602_AT Instruction User Manual
<CR>Carriage Returnascii character 0x0d
<LF>Line feedascii character 0x0a
Data Type
StringStringSurrounded by double quotes, the content does not contain quotes,
e.g."this is a string"
DecDecimal number
e.g.10
HexHexadecimal number
e.g.a
Ipip address string
e.g.192.168.0.1
MACConsists of 12 hexadecimal digits
e.g.: 001EE3A80102
2.1.1.1 Processing flow
The AT+ instruction protocol takes the form of command + response. Most instructions require the receiver
to return a response message after processing. If a new command is received again during the previous
command processing, it will be silently discarded without returning. Any message, as shown below:
Luat 11 /73 page
User System
AT+Commad2
AT+Commad3
AT+Commad1
response1
response2
Processing command 1
Processing command 2
Discard command3
Air602_AT Instruction User Manual
For some special commands, such as AT+SKSND, AT+SKRCV, it is necessary to transmit binary data after the
instruction or response details. At this time, the receiver of the command transmission temporarily enters the
transparent transmission state and starts receiving the binary data stream until receiving the specified length
of data in the <size> field of the message or command, or until the waiting timeout, automatically exits the
transparent transmission state, the flow is as follows:
2.1.1.2 Example Format
exampl1Return success message
AT+UART=9600,1,1,0
+OK
Example 4: Synchronizing parameters to the Flash operator <!>
AT+
+OK
Example 2: Return error message
Luat 12 /73 page
AT+WJOIN
+ERR=-10
Example 3: Set input parameters
User User
Sys Sys
Enter transparent
reception status
and
automatically exit
after receiving
Enter transparent
reception status
and
automatically exit
after receiving
Return response
message
Return
response
message
AT+SKRCV AT+SKRCV=,<size>
+OK=<size> +OK=<size>
<data stream> <data stream>
Air602_AT Instruction User Manual
2.2 Instruction Definition
2.2.1 System Control Class Instruction
2.2.1.1 Null Operation InstructionAT+
Function: empty operation, can be used to detect whether the program is responding normally
FormatASCII):
AT+<CR>
+OK<CR><LF><CR><LF>
ParameterNull
e.g.:( indicates input, ← indicates return or acve report, the same below
AT+
+OK
2.2.1.2 System ResetAT+Z
FunctionSystem Reset .
FormatASCII):
AT+ATPT=?
+OK=500
AT+ATPT=!500
+OK
Example 5: Using the Query Operator <?>
Luat 13 /73 page
Air602_AT Instruction User Manual
AT+Z<CR>
+OK<CR><LF><CR><LF>
ParameterNull
e.g.
2.2.1.3 Set EchoAT+E
FunctionSwitch serial port command echo
FormatASCII):
AT+E<CR>
+OK<CR><LF><CR><LF>
ParameterNull
e.g.
AT+E
+OK
2.2.1.4 Serial port enters transparent transmission mode AT+ENTM
FunctionSerial port enters transparent transmission mode ;the system exits this mode when it receives
an escape character that matches the trigger condition in transparent transmission mode.
AttentionBefore entering the transparent transmission mode, the following conditions must be met:
Luat 14 /73 page
→ AT+Z
← +OK
ready
1. Connected to the Internet
2. Create a socket
3. Set the transparent connection to the currently created socket
Air602_AT Instruction User Manual
FormatASCII):
AT+ENTM<CR>
+OK<CR><LF><CR><LF>
ParameterNull
e.g.Entering the transparent mode requires the following steps:
2. Creat a socket
AT+SKCT=0,0, 36.7.87.76,1000,2000
+OK=1
3. Set the transparent connection to the currently created socket
Luat 15 /73 page
→ AT+E
← +OK
→ AT+KEY=1,0,""
← +OK
→ AT+WJOIN
+OK=3c46d82bd81e,0,11,0,"TP-LINK_ Luat_AP ",51
→ AT+SKSDF=1
← +OK
1. Connect to the internet
Air602_AT Instruction User Manual
4. Entering the transparent mode
2.2.1.5 Energy saving mode AT+ENTS
FunctionSet the system to enter the energy saving mode (Wi Fi OFF / sleep / standby state)
FormatASCII):
AT+ENTS=[ps_type],[wake_type],[delay_time],[wake_time]<CR>
+OK<CR><LF><CR><LF>
Parameter
ps_typeEnergy saving mode
Luat 16 /73 page
delay_timeDelay timeunit msValid value 100~1000
wake_timeWake timeunit msValid value 100065535
→ AT+ENTM
← +OK
Value Description
0 Wi-Fi OFF
1 Standby
2 Sleep
wake_typeWake mode
Value Wi-Fi OFF Mode Sleep /Standby Mode
0 Disable Wakeup pin wakes up
1 Enable Timer wakes up
Air602_AT Instruction User Manual
Attention
In the Wi-Fi OFF energy saving mode, the setting is valid only when the network is disconnected, and the
wake_time parameter is meaningless.
Standby and sleep power-saving modes will cause the network connection to be disconnected and the wake-up
will be reset.
Set WAKEUP pin wake mode, the wake_time parameter is meaningless.
e.g.
1. Wi-Fi OFF energy saving mode
Enter Wi-Fi OFF energy saving mode
AT+ENTS=0,1,1000,10000
Exit Wi-Fi OFF energy saving mode
AT+ENTS=0,0,100,1000
2. standy mode
Set timer wake-up mode, unit ms, (delay 1s, wake up after 10s)
AT+ENTS=1,1,1000,10000
Set WAKEUP pin wake up modewake_timeparameter is meaningless
AT+ENTS=1,0,1000,10000
3. sleep mode
2.2.1.6 Reset Reset Factory Settings AT+RSTF
FunctionRestore the factory settings in FLASH; the restored settings will not take effect until the system is
restarted.
FormatASCII):
AT+RSTF<CR>
+OK<CR><LF><CR><LF>
ParameterNull
Luat 17 /73 page
The same as standy mode
Air602_AT Instruction User Manual
E.g.
2.2.1.7 Save in-memory parameters to FLASH AT+PMTF
FunctionUpdate all parameters saved in memory to FLASH
FormatASCII):
AT+PMTF<CR>
+OK<CR><LF><CR><LF>
ParameterNull
e.g.
AT+WPRT=0
+OK
AT+SSID=TP-LINK_HyFi_1E
+OK
AT+KEY=1,0,""
+OK
AT+PMTF
← +OK
The AT+PMTF command is equivalent to saving the parameters of the above three commands to the
NV, so that these parameters do not need to be reset after the module is restarted or turned off. The
effect is equivalent to saving the parameters of each command separately (as shown below):
AT+WPRT=!0
Luat 18 /73 page
→ AT+RSTF
← +OK
Air602_AT Instruction User Manual
2.2.1.8 Get the physical address of the wireless network card in STA mode AT+QMAC
FunctionGet the physical address of the wireless network card.
FormatASCII):
AT+QMAC<CR>
+OK=<mac address><CR><LF><CR><LF>
Parameter
mac addressPhysical address, the return format is as follows
e.g.:
2.2.1.9 Get the physical address of the wireless network card in SoftAP mode. AT+APMAC
Function: Obtain the SoftAP physical address, which is valid only in SoftAP and APSTA modes.
Luat 19 /73 page
+OK
→ AT+SSID=!TP-LINK_HyFi_1E
← +OK
→ AT+KEY=!1,0,""
← +OK
→ AT+QMAC
← +OK=286dcd004e7d
Format Description
ASCII Format command a hexadecimal number of length 12, like: 001EE3A34455
Air602_AT Instruction User Manual
FormatASCII):
AT+APMAC <CR>
+OK=<mac address><CR><LF><CR><LF>
Parameter
mac addressPhysical address, the return format is as follows
e.g.:
2.2.1.10 Get version information AT+QVER
Function:Get system version information, including hardware version and firmware version.
FormatASCII):
AT+QVER<CR>
+OK=<firm><CR><LF><CR><LF>
Parameter
firmFirmware version information
String format like " AirM2M_Luat_WiFi_V008_WM "
e.g.:
Luat 20 /73 page
→ AT+APMAC
← +OK=2a6dcd004e7d
Format Description
ASCII Format command a hexadecimal number of length 12, like : 001EE3A34455
ASCII
Air602_AT Instruction User Manual
2.2.2 Parameter Setting Class Instruction
2.2.2.1 Wireless Network TypeAT+WPRT
FunctionSet/Query Wireless Network Type
FormatASCII):
AT+WPRT=[!?][type]<CR>
+OK[=type]<CR><LF><CR><LF>
Parameter
typeNetwork Type
Value Description
0infra NetworkSTA mode
1adhoc Network
2infra NetworkAP mode
3infra NetworkAPSTA mode
e.g.
Set to SoftAp mode
Luat 21 /73 page
→ AT+QVER
← +OK=AirM2M_Luat_WiFi_V008_WM
→ AT+WPRT=!2
← +OK
Air602_AT Instruction User Manual
2.2.2.2 Query/set the local IP address in STA mode AT+NIP
Function
When the wireless network card is used as a STA, this command is used to set/query the local IP address. It should be
noted that when the address type is set to DHCP Server, you cannot use this command to query the IP address
information that the wireless network card actually allocates dynamically. Queries can use the AT+LKSTT command.
FormatASCII):
AT+NIP=[!?][type],[ip],[netmask],[gateway],[dns]<CR>
+OK[=type,ip,netmask,gateway,dns]<CR><LF><CR><LF>
Parameter
TypeAddress type
ipip addressdata format "192.168.1.22"Without quotes
netmaskSubnet mask, data format is the same as ip address
gatewayGateway address, data format is the same as ip address
dnsDNS address, data format is the same as ip address
e.g.:
AT+WPRT=!0
+OK
AT+NIP=!0
+OK
AT+SSID=!TP-LINK_HyFi_1E
+OK
Luat 22 /73 page
Value Description
0 Dynamically assign/enable DHCP Server using DHCP
1 Use static IP address / disable DHCP Server
Air602_AT Instruction User Manual
Note: The above test shows that in the case of DHCP enabled, the second parameter queried by AT+NIP=? is
not the IP address actually obtained by the module, and the second parameter queried by AT+LKSTT is.
2.2.2.3 Query/set the local IP address in SoftAP mode AT+APNIP
Function
When the wireless network card is used as the SoftAP, this command is used to set/query the IP address of
the local end and enable /disable the DHCP server. When the DHCP server is enabled, the IP address of the
wireless network card can still be queried through this command.
FormatASCII):
AT+APNIP=[!?][type],[ip],[netmask],[gateway],[dns]<CR>
+OK[=type,ip,netmask,gateway,dns]<CR><LF><CR><LF>
Parameter
type: address type
Luat 23 /73 page
→ AT+KEY=!1,0,""
← +OK
→ AT+WJOIN
← +OK=3c46d82bd81e,0,11,0,"TP-LINK_HyFi_1E",59
→ AT+LKSTT
← +OK=1,"192.168.1.124","255.255.255.0","192.168.1.1","192.168.1.1","0.0.0.0"
→ AT+NIP=?
← +OK=0,192.168.1.1,255.255.255.0,192.168.1.1,192.168.1.1
Value Dscription
0 Dynamically assign/enable DHCP Server using DHCP
1 Use static IP address / disable DHCP Server
Air602_AT Instruction User Manual
ipip addressdata format "192.168.1.22"Without quotes
netmaskSubnet mask, data format is the same as ip address
gatewayGateway address, data format is the same as ip address
dnsDNS address, data format is the same as ip address
e.g.:
Please refer to this document for specific applications. Create a SoftAP process
2.2.2.4 Network Card DNS AT+DNS
Function
Set/query the NIC module domain name. This setting is valid only when the NIC is used as SoftAP.
FormatASCII):
AT+DNS=[!?][dnsname]<CR>
+OK[=dnsname]<CR><LF><CR><LF>
Parameter
dns nameNIC module domain name, 1~31 characters, surrounded by double quotes
e.g.:
Luat 24 /73 page
2.2.2.5 Operating ModeAT+ATM
Function
→ AT+APNIP=1,192.168.1.1,255.255.255.0,192.168.1.1,192.168.1.1
← +OK
→ AT+DNS="DNS-FOR-TEST"
← +OK
Air602_AT Instruction User Manual
Set / query the operating mode.
FormatASCII):
AT+ATM=[!?][mode]<CR>
+OK[=mode]<CR><LF><CR><LF>
Parameter
modeoperating mode
e.g.Query current working mode
Modify mode to automatic working mode
→ AT+ATM=!0
← +OK
2.2.2.6 Socket connection in automatic working mode AT+ATRM
Function
Set/query the socket connection information automatically created in the automatic working
mode.
FormatASCII):
AT+ATRM=[!?][protocol],[cs],[host/timeout],[port]<CR>
+OK[=protocol,cs, host/timeout,port]<CR><LF><CR><LF>
Luat 25 /73 page
Value Dscription
0 Automatic working mode
1 Command mode
→ AT+ATM=?
← +OK=1
Air602_AT Instruction User Manual
Parameter
protocolProtocol type
Luat 26 /73 page
csC/S Mode
host_timeoutaccording to protocol and csits meaning is as follows
portThe port number
e.g.
Please refer to: Transparent transmission application in automatic working mode
Value Dscription
0 TCP
1 UDP
Value Dscription
0 Client
1 Server
cs protocol Dscription
0 X
Destination server name, you can enter the domain name or ip addresse.g.
"192.168.1.100"
or
"www.sina.com.cn"
1 0
The TCP connection timeout period, that is, the client connected to the
server is automatically kicked off after sending no data for more than this
time. The valid value range is 1~10000000, the unit is seconds, 0 means
never, the default is 120 seconds.
1 1 Meaningless
→ AT+ATRM=!0,0,180.97.81.180,51950
← +OK
Air602_AT Instruction User Manual
2.2.2.7 Wireless network name AT+SSID
Function
Set/Query the name of the wireless network to be joined in STA mode i.e.ssid
FormatASCII):
AT+SSID=[!?][ssid]<CR>
+OK[=ssid]<CR><LF><CR><LF>
Parameter
ssid: Wireless network name, 1~32 characters, with or without double quotes
e.g.
Please refer to this part for details. STA joins the AP process
2.2.2.8 SoftAP wireless network name AT+APSSID
Function
The SoftAP wireless network name, SSID, is valid in SoftAP and APSTA modes.
FormatASCII):
AT+APSSID=[!?][ssid]<CR>
+OK[=ssid]<CR><LF><CR><LF>
Parameter
ssid: Wireless network name, 1~32 characters, with or without double quotes
e.g.
Luat 27 /73 page
AT+SSID=! Air_Test_WiFi
← +OK
Air602_AT Instruction User Manual
Please refer to this part for specific applications. Create a SoftAP process
2.2.2.9 Wireless network security mode AT+ENCRY
Function
Set/query wireless network security mode. It is important to note that in addition to the OPEN mode, other
security modes need to be set with the correct network key in conjunction with the AT+KEY command. In
addition, in AP or AD-HOC mode, the module only supports setting OPEN, WEP64, and WEP128.
FormatASCII):
AT+ENCRY=[!?][encry mode]<CR>
+OK[=encry mode]<CR><LF><CR><LF>
Parameter
encry mode : security mode
Value Dscription
0 OPEN
1 WEP64
2 WEP128
3 WPA-PSK(TKIP)
4 WPA-PSK(CCMP/AES)
5 WPA2-PSK(TKIP)
6 WPA2-PSK(CCMP/AES)
Luat 28 /73 page
→ AT+APSSID=!"AAAA-Test-Wifi"
← +OK
Air602_AT Instruction User Manual
e.g.Query network security mode
Set the network security mode to WEP64:
2.2.2.10 SoftAP wireless network security mode AT+APENCRY
Function
Set/Query SoftAP Wireless Network Security Mode. In addition to the OPEN mode, other security modes
require the correct network key to be set with the AT+APKEY command.
FormatASCII):
AT+ENCRY=[!?][encry mode]<CR>
+OK[=encry mode]<CR><LF><CR><LF>
Parameter
encry mode: security mode
Value Dscription
0 OPEN
1 WEP64
2 WEP128
3 WPA-PSK(TKIP)
Luat 29 /73 page
→ AT+ENCRY=?
← +OK=0
→ AT+ENCRY=!1
← +OK
Air602_AT Instruction User Manual
e.g.
Set the network security mode to WEP64
2.2.2.11 Network key AT+KEY
Function
Set/query the network key. It should be noted that before using this command to set the network key, you
sometimes need to set the network security mode using the AT+ENCRY command.
FormatASCII):
AT+KEY=[!?][format],[index],[key]<CR>
+OK[=format,index,key]<CR><LF><CR><LF>
Parameter
FormatKey format
Value Dscription
0HEX
1 ASCII
Index: Key index number, 1 to 4 is used for WEP encryption key. Other encryption methods are fixed at 0.
keyKey string, with or without quotes, ccording to different security modes, the length and format
requirements of the key usage are defined as follows:
Luat 30 /73 page
4 WPA-PSK(CCMP/AES)
5 WPA2-PSK(TKIP)
6 WPA2-PSK(CCMP/AES)
→ AT+APENCRY=!1
← +OK
Air602_AT Instruction User Manual
Note1The hexadecimal characters are 0~9, a~f (not case sensitive), e.g. "11223344dd".
Note2: ASCII characters refer to the numbers in the standard ASCII character set specified by the International
Organization for Standardization (ISO) 0~9 and the letters a~z (case sensitive)e.g. "14u6E".
e.g.
2.2.2.12 SoftAP network key AT+APKEY
Function
Set/Query the SoftAP wireless network key. It should be noted that you must first set the wireless
network security mode using the AT+APENCRY command before setting the network key using this
command.
FormatASCII):
AT+APKEY=[!?][format],[index],[key]<CR>
+OK[=format,index,key]<CR><LF><CR><LF>
Luat 31 /73 page
→ AT+KEY=!1,0,"A123456"
← +OK
Safe Mode
Key Format
HEX ASCII
WEP64 10 hexadecimal characters(note1) 5 ASCII characters(note2)
WEP128 26 hexadecimal characters 13 ASCII characters
WPA-PSK(TKIP) 64 hexadecimal characters 8~63 ASCII characters
WPA-PSK(CCMP/AES) 64 hexadecimal characters 8~63 ASCII characters
WPA2-PSK(TKIP) 64 hexadecimal characters 8~63 ASCII characters
WPA2-PSK(CCMP/AES) 64 hexadecimal characters 8~63 ASCII characters
Air602_AT Instruction User Manual
Parameter
format: Key Format
Luat 32 /73 page
Index: Key index number, 1 to 4 is used for WEP encryption key. Other encryption methods are fixed at 0.
keyKey string, with or without quotes , according to different security modes, the length and format
requirements of the key usage are defined as follows:
Note1The hexadecimal characters are 0~9, a~f (not case sensitive), e.g. "11223344dd".
Note2: ASCII characters refer to the numbers in the standard ASCII character set specified by the
International Organization for Standardization (ISO) 0~9 and the letters a~z (case sensitive)e.g. "14u6E".
e.g.
Value Dscription
0 HEX
1 ASCII
→ AT+APKEY=!1,1,123456
← +OK
Safe Mode
Key Format
HEX ASCII
WEP64 10 hexadecimal characters(note1) 5 ASCII characters(note2)
WEP128 26 hexadecimal characters 13 ASCII characters
WPA-PSK(TKIP) 64 hexadecimal characters 8~63 ASCII characters
WPA-PSK(CCMP/AES) 64 hexadecimal characters 8~63 ASCII characters
WPA2-PSK(TKIP) 64 hexadecimal characters 8~63 ASCII characters
WPA2-PSK(CCMP/AES) 64 hexadecimal characters 8~63 ASCII characters
Air602_AT Instruction User Manual
2.2.2.13 Set/query the BSSID address of the specified AP AT+BSSID
Function
Set/query the BSSID address of the specified AP. This setting is valid only on the infra
network when the module functions as a STA.
FormatASCII):
AT+BSSID=[!?][mode],[bssid]<CR>
+OK[=mode,bssid]<CR><LF><CR><LF>
Parameter
modeBSSID Mode
bssidNetwork BSSIDA hexadecimal number of 12 in the format 001EE3A34455
2.2.2.14 Set/query the specified wireless channel mode AT+CHL
FunctionSet/query the specified wireless channel mode .
FormatASCII):
AT+CHL=[!?][ mode],[channel]<CR>
+OK[=mode,channel]<CR><LF><CR><LF>
Parameter
modeChannel mode
Value Dscription
Luat 33 /73 page
Value Dscription
0 automatic
1 Designation
Air602_AT Instruction User Manual
channel: Wireless channel number , effective range 1~14 .
2.2.2.15 Set / Query SoftAP Wireless Channel Mode AT+APCHL
Function
Set / Query SoftAP Wireless Channel Mode .
FormatASCII):
AT+APCHL=[!?][ mode],[channel]<CR>
+OK[=mode,channel]<CR><LF><CR><LF>
Parameter
modeChannel mode
channel: Wireless channel number , effective range 1~14 .
2.2.2.16 Wireless Channel ListAT+CHLL
FunctionSet/query the list of wireless channels. The wireless channel list parameter is used to specify the
working channel range of the module. Channels not included in the list will not be scanned. Reasonable use of
this parameter can speed up the scanning and networking speed of the module.
FormatASCII):
AT+CHLL=[!?][channel list]<CR>
+OK[=channel list]<CR><LF><CR><LF>
Luat 34 /73 page
0 automatic
1 Designation
Value Dscription
0 automatic
1 Designation
Air602_AT Instruction User Manual
Parameter
channel listThe list of wireless channels, in hexadecimal format, starting from the lowest bit, each bit
representing a channel, the default is 3fff, indicating 1~14 all channels
2.2.2.17 Enable automatic creation of adhoc network functions AT+WATC
Function
Set/Query whether to enable the automatic creation of the adhoc network function. This setting is valid only when the
wireless network type is set to adhoc, indicating whether an adhoc network with the same name is automatically
created when the network join fails.
FormatASCII):
AT+WATC=[!?][enable]<CR>
+OK[=enable]<CR><LF><CR><LF>
Parameter
enableEnable flag
Value Dscription
0Not enabled
1Enable
2.2.2.18 Turn automatic energy saving mode on/off AT+WP
FunctionTurn automatic energy saving mode on/off
Luat 35 /73 page
Note:
This power-saving mode is the energy-saving mode of the wifi protocol. It only turns off the wireless transceiver
and reduces the CPU frequency. This mode CPU does not sleep, so it can receive AT/RI commands. After the
power-saving mode is turned on, the WiFi module enters the WiFi_off state after wireless idle. If there is no
Air602_AT Instruction User Manual
external wake-up, the WiFi is turned on when the time period indicated by the TIM information element
of the beacon frame [minimum 100ms] comes, according to the TIM in the Beacon frame. The domain
determines whether there is data to be received [including broadcast frames and unicast frames]. If there
is no data, it will immediately enter the WiFi_off state. If there is data after processing, the wireless
access will enter the WiFi_off state. If there is external wake-up during WiFi_off, it will open. WiFi, until
the next wireless idle and then enter the WiFi_off state.
Ways to wake up the module: AT port directly sends data will wake up the module
FormatASCII):
AT+WPSM=[!?][enable]<CR>
+OK[=enable]<CR><LF><CR><LF>
Parameter
enableEnable flag
Luat 36 /73 page
e.g.
Turn on the power save mode (Note: AT+WPSM=1 is valid only after the module joins the hotspot):
AT+WPSM=1
+OK
Turn off power save mode
AT+WPSM=0
+OK
Value Dscription
0 Not enabled
1 Enable
Air602_AT Instruction User Manual
2.2.2.19 Enable/disable AP SSID broadcast AT+BRDSSID
Function
Enable/disable AP SSID broadcast. This setting is valid only when the module is an AP.
FormatASCII):
AT+BRDSSID=[!?][enable]<CR>
+OK[=enable]<CR><LF><CR><LF>
Parameter
enableWhether to enable SSID broadcast
2.2.2.20 UART port data format AT+UART
FunctionSet/query the uart interface data format.
FormatASCII):
AT+UART=[!?][baudrate],[databit],[stopbit],[parity],[flowcontrol]<CR>
+OK[=baudrate,databit,stopbit,parity]<CR><LF><CR><LF>
Parameter
baud rateBaud rate, RMS range 1200~115200bps
Luat 37 /73 page
Value Dscription
0 Ban AP SSID broadcast
1 Enable AP SSID broadcast
Value Dscription
115200 115200 bps
57600 57600 bps
Air602_AT Instruction User Manual
data bitdata bit
stop bitStop bit
Value Dscription
01 bit
1not support
22 bit
parityparity
Value Dscription
0No parity
1Odd parity
2Even parity
Luat 38 /73 page
38400 38400 bps
19200 19200 bps
9600 9600 bps
4800 4800 bps
2400 2400 bps
1200 1200 bps
Value Dscription
0 8 bit
1 7 bit
Air602_AT Instruction User Manual
2.2.2.21 Built-in enable WEB management server AT+WEBS
FunctionSet/Query whether built-in enabled WEB Management Server
FormatASCII):
AT+WEBS=[!?][enable],[port]<CR>
+OK[=enable,port]<CR><LF><CR><LF>
Parameter
enableEnable flag
portServer port number, default is 80
2.2.2.22 Device name AT+DNAME
FunctionSet/query the device name.
FormatASCII):
AT+DNAME=[!?][devicename] <CR>
+OK[=devicename]<CR><LF><CR><LF>
Parameter
devicenameDevice name, 1~32 characters
Luat 39 /73 page
2.2.2.23 System login password AT+PASS
FunctionSet / query the system login password.
FormatASCII):
Value Dscription
0 Not enabled
1 enable
Air602_AT Instruction User Manual
AT+PASS=[!?][pass] <CR>
+OK[=pass]<CR><LF><CR><LF>
Parameter
pass6 ASCII characters
2.2.2.24 Receiving user data AT+CUSTDATA
Function
Receive the user data sent by the one-click configuration tool. Send the AT+ONESHOT=1 command before use
to configure the module in one-button configuration mode.
Format
AT+CUSTDATA[=?]<CR>
+OK=data<CR><LF><CR><LF>
ParameterNull
2.2.2.25 Query the configured networking parameters AT+CNTPARAM
FunctionQuery the configured networking parameters.
FormatASCII):
AT+CNTPARAM[=?]<CR>
+OK=<bssid_en>,[bssid],[ssid],<key><CR><LF><CR><LF>
ParameterNull
返回值:bssid_en 值的含
Luat 40 /73 page
Air602_AT Instruction User Manual
2.2.3 Network control class
2.2.3.1 NIC interface mode :AT+PORTM
FunctionSet/query the interface mode of the Network Card.
FormatASCII):
AT+PORTM=[!?][mode]<CR>
+OK[=mode]<CR><LF><CR><LF>
Parameter
modeInterface mode
Value Dscription
0Low speed UART
1High speed UART
2 H-SPI
3 H-SDIO
e.g.
Query the NIC interface mode:
Luat 41 /73 page
0 BSSID is not enabled
1 Enable BSSID networking
Value Dscription
If the BSSID is enabled, it returns 1, bssid, key
If BSSID is not enabled ,returns 0, ssid, key
Air602_AT Instruction User Manual
2.2.3.2 Get the IP address of the external domain name AT+SKGHBN
FunctionObtain the IP of the external domain name.
FormatASCII):
AT+SKGHBN =[!?][URL] <CR>
+OK[=IP]<CR><LF><CR><LF>
Parameter
URLExternal domain name
IPCorresponding IP address
e.g.After the network is successfully added, the IP address of the external domain name can be
queried as follows.
→ AT+WJOIN
+OK=3c46d82bd81e,0,11,0,"TP-LINK_HyFi_1E",49
AT+SKGHBN=www.baidu.com
+OK="115.239.211.112"
2.2.3.3 Set / Query WPS Features AT+WWPS
Function
Set/Query WPS function.
FormatASCII):
Luat 42 /73 page
→ AT+PORTM=?
← +OK=0
Air602_AT Instruction User Manual
AT+WWPS=[!?][mode],[pin]<CR>
+OK[=mode],[pin]<CR><LF><CR><LF>
Parameter
modeWPS function selection, empty parameters do not need to be filled out.
pinPIN code of the wireless router
2.2.3.4 Join the specified AP AT+WJOIN
Function
Join/create the specified network depending on the type of network you have set up. If the current network type is
STA, this command functions to connect to the AP. If the current network type is SoftAP, this command functions to
create a SoftAP. If the current network type is Adhoc, this command function specifies the Adhoc network for the
connection, and can choose whether to automatically create the network if the network with the specified SSID is not
detected according to the setting parameters. If the current network is already connected or created, return the
network connection information directly. For ASCII format, the system returns a response message after the network
connection is successful.
FormatASCII):
AT+WJOIN<CR>
+OK=<bssid>,<type>,<channel>,<encry>,<ssid>,<rssi><CR><LF><CR><LF>
Parameter
Bssid:Network BSSID,A hexadecimal number of length 12 in the format 001EE3A34455
type: Network Type
Luat 43 /73 page
mode pin Dscription
get_pin Get the pin code
set_pin Pin Code Set the pin code
start_pin Start networking
start_pbc Start networking
Air602_AT Instruction User Manual
channel: Channel number
b_encry: Encryption mode
SSID: Wireless network name, 1~32 characters, surrounded by double quotes
rssiNetwork signal strength, without negative sign, unit Db, ie 50 means signal strength is -50Db
e.g.
AT+SSID=TP-LINK_HyFi_1E
+OK
AT+KEY=1,0,""
+OK
AT+WJOIN
+OK=3c46d82bd81e,0,11,0,"TP-LINK_HyFi_1E",53
Luat 44 /73 page
Value Dscription
0 STA Mode
1 Adhoc Mode
2 SoftAP Mode
3 APSTA Mode
Value Dscription
0 Open
1 Encryption
Air602_AT Instruction User Manual
2.2.3.5 Disconnect the current network AT+WLEAV
Function
This command is only valid when the module is acting as a STA and is used to disconnect the
current wireless network.
FormatASCII):
AT+WLEAV<CR>
+OK<CR><LF><CR><LF>
ParameterNull
e.g.Query the connection status after screening, and then query the connection
status after exiting the network.
- AT+SSID=TP-LINK_HyFi_1E
← +OK
→ AT+KEY=1,0,""
← +OK
- AT+WJOIN
+OK=3c46d82bd81e,0,11,0,"TP-LINK_HyFi_1E",53
AT+LKSTT
+OK=1,"192.168.1.109","255.255.255.0","192.168.1.1","192.168.1.1","0.0.0.0"
AT+WLEAV
+OK
AT+LKSTT
+OK=0
Luat 45 /73 page
Air602_AT Instruction User Manual
2.2.3.6 Scan wireless networkAT+WSCAN
Function
This command is valid only when the module is acting as a STA. It is used to scan the wireless network and
return after completion.
FormatASCII):
AT+WSCAN<CR>
+OK=<bssid>,<type>,<channel>,<encry>,<ssid>,<rssi><CR><LF>
<bssid>,<type>,<channel>,<encry>,<ssid>,<rssi><CR><LF>
……
<CR><LF>
Parameter
The same as AT+WJOIN
e.g.
Luat 46 /73 page
→ AT+WSCAN
← +OK=828917C49D9A,2,1,1,"AirM2M_WiFi",70
C4CAD90B1592,2,1,1,"qianyue-lan",86
68DB540CC142,2,4,1,"O2@PHICOMM",76
64098014661A,2,6,1,"Xiaomi_6619",64
7C11CB04F7B5,2,6,0,"",74
0E5415290C52,2,6,1,"LAPTOP-JNPMKPQP 7565",56
104400631C69,2,6,1,"",84
EC26CAB3094E,2,6,1,"Black Ship Corp",74
7C11CB04F7B4,2,6,1,"HUAWEI-UM57MQ",76
8825930EAEAF,2,6,1,"GST_2.4G",84
0E26CAB3094E,2,6,1,"Doge Smart Office",74
286C0764C470,2,7,1,"FB715",66
2A6C0764C470,2,7,0,"",64
3C46D82BD81E,2,11,0,"TP-LINK_HyFi_1E",60
AC9E176C8AF8,2,10,1,"Finejoint_sec",80
Air602_AT Instruction User Manual
789682A20C18,2,11,1,"xiaoman-ZTE-2.4G-A20C18",62
00226C68DDE8,2,11,0,"RT8580_DDE8",78
08107999C460,2,11,1,"Netcore_air",76
A8574ED51AFE,2,12,1,"MEVIUS",82
30FC68606128,2,11,1,"Carebao717",72
2.2.3.7 Query the local network connection status AT+LKSTT
FunctionQuery the status of the local network connection.
FormatASCII):
AT+LKSTT<CR>
+OK[=status,ip,netmask,gateway,dns1,dns2]<CR><LF><CR><LF>
Parameter
status: Connection Status
IpIp address, the data format is "192.168.1.22“, without quotes
netmaskSubnet mask, data format is the same as ip address
gatewayGateway address, data format is the same as ip address
dns1DNS1 address, data format is the same as ip address
dns2DNS2 address, data format is the same as ip address
e.g.
Query the connection status after screening, and then query the connection status after exiting
the network.
→ AT+SSID=TP-LINK_HyFi_1E
Luat 47 /73 page
Value Dscription
0 disconnect
1 connection
Air602_AT Instruction User Manual
2.2.3.8 Set / Query SoftAP Status AT+APLKSTT
Function
Set/query SoftAP wireless channel status, valid only in SoftAP and APSTA modes.
Format
AT+APLKSTT<CR>
+OK[=status,ip,netmask,gateway,dns1,dns2]<CR><LF><CR><LF>
Parameter
status : Connection Status
Luat 48 /73 page
← +OK
→ AT+KEY=1,0,""
← +OK
→ AT+WJOIN
← +OK=3c46d82bd81e,0,11,0,"TP-LINK_HyFi_1E",53
→ AT+LKSTT
← +OK=1,"192.168.1.109","255.255.255.0","192.168.1.1","192.168.1.1","0.0.0.0"
→ AT+WLEAV
← +OK
→ AT+LKSTT
← +OK=0
Value Dscription
0 disconnection
Air602_AT Instruction User Manual
1 connection
IpIp address, the data format is "192.168.1.22“, without quotes
netmaskSubnet mask, data format is the same as ip address
gatewayGateway address, data format is the same as ip address
dns1DNS1 address, data format is the same as ip address
dns2DNS2 address, data format is the same as ip address
e.g.
The module acts as a SoftAP, the phone joins the AP, and then queries the module
status:
- AT+WPRT=!2
← +OK
- AT+APSSID=!Luat_TEST_AP
← +OK
- AT+APENCRY=!1
← +OK
→ AT+APKEY=!1,1,"12345"
← +OK
AT+APNIP=1,192.168.1.1,255.255.255.0,192.168.1.1,192.168.1.1
+OK
AT+WJOIN
+OK=2a6dcd004e7d,2,11,1,"Luat_TEST_AP",30
AT+APLKSTT
Luat 49 /73 page
Air602_AT Instruction User Manual
+OK=1,"192.168.1.1","255.255.255.0","192.168.1.1","192.168.1.1","0.0.0.0"
9. Query the connected station AT+SLIST
Function
Query the station that is connected.
Format
AT+SLIST<CR>
+OK[=sta_number,sta_mac1,sta_ip1,sta_mac2,sta_ip2…]<CR><LF><CR><LF>
Parameter
sta_number: Number of stations that have been connected
sta_mac: mac address of station
sta_ip: ip address of station
e.g.
Follow the example in Setting/Querying SoftAP Status: AT+APLKSTT. Query AT+SLIST before any mobile phone
joins the hot spot Luat_TEST_AP:
- AT+SLIST
← +OK=0
Then, the phone joins Luat_TEST_AP and queries AT+SLIST:
- AT+SLIST
← +OK=1,,94-FE-22-9A-B5-28,192.168.1.2
2.2.3.10 Build a socket connection AT+SKCT
Function
Luat 50 /73 page
Air602_AT Instruction User Manual
Create a socket. In client mode, it returns after waiting for the connection to complete (success or failure); in
server mode, it returns directly after the creation is completed.
FormatASCII):
AT+SKCT=[protocol],[cs],[host_timeout],<remote_port>,<local_port><CR>
+OK=<socket><CR><LF><CR><LF>
Parameter
protocolprotocol type
csC/S mode
host_timeoutAccording to protocol and cs, the dscriptions are as follows
cs protocol Dscription
0 X Destination server name, you can enter the
domain name or ip address, such as
"192.168.1.100" or "www.sina.com.cn"
1 0
The TCP connection timeout period, that is, the client
connected to the server is automatically kicked off after
sending no data at this time. The valid value range is
1~10000000, the unit is seconds, 0 means never, the
default is 120 seconds.
1 1
remote_portRemote port number
Luat 51 /73 page
Meaningless
Value Dscription
0 TCP
1 UDP
Value Dscription
0 Client
1 Server
Air602_AT Instruction User Manual
local_portLocal port number
socketsocket number
e.g.
1 is socket id
2.2.3.11 Send data through the specified socket AT+SKSND
Function
Send data through the specified socket and return when finished. This command sends data in binary format
and the user should start sending the raw data after receiving the response message (+OK) from the module.
After the module receives the specified length of data, it automatically ends the data transmission phase and
sends the data to the network. The excess data will be discarded. Otherwise, after waiting for the timeout (1s),
the module forces the end of the data transfer phase and sends the received data to the network.
FormatASCII):
AT+SKSND=<socket>,<size><CR>
+OK=<actualsize><CR><LF><CR><LF>
[data steam]
Parameter
e.g.
Luat 52 /73 page
→ AT+SKCT=0,0,180.97.81.180,51950,37189
← +OK=1
socketsocket number
sizeThe length of the data to be sent, bytes
actualsizeThe length of data allowed to be sent, bytes
data steamRaw data
Air602_AT Instruction User Manual
2.2.3.12 Read the data in the receive buffer of the specified socket AT+SKRCV
Function
Reads the data in the receive buffer of the specified socket and returns after completion. After receiving this
command, the module will transfer the specified length data in binary format after sending the
corresponding message (+OK).
FormatASCII):
AT+SKRCV=<socket>,<maxsize><CR>
+OK=<size><CR><LF><CR><LF>
[data steam]
Parameter
e.g.
Luat 53 /73 page
→ AT+SKSND=1,5
← +OK=1
→ abcde
→ AT+SKRCV=2,20
← +OK=17
HELLO WIFI MODULE
Socket: socket number
Maxsize: the maximum data length that can be received
Size: the actual length of the received data
Data steam: raw data
Air602_AT Instruction User Manual
2.2.3.13 Get the specified socket state AT+SKSTT
Function
Gets the specified socket state. The first line of the return value indicates the status information of the socket
specified by the user. If the socket type is a TCP server, each line from the next line indicates the socket state
of an accessed client.
FormatASCII):
AT+SKSTT=<socket><CR>
+OK=<socket>,<status>,[host],[HostPort],[LocalPort],[rx_data]<CR><LF>
[socket],[status],[host],[HostPort],[ LocalPort],[rx_data]<CR><LF>
...
<CR><LF>
Parameter
socket:socket number
Value Dscription
0disconnect
1monitor
2connect
host:对端ip 地址
HostPortcounterpart port number
LocalPortLocal port number
rx_dataData length in the receive buffer
e.g.
Luat 54 /73 page
status:socket status
Air602_AT Instruction User Manual
2.2.3.14 Close the specified socket AT+SKCLS
Function
Close the specified socket.
FormatASCII):
AT+SKCLS=<socket><CR>
+OK<CR><LF><CR><LF>
Parameter
socketsocket number
e.g.
2.2.3.15 Set the socket sent by the system by defaultAT+SKSDF
Function
Set the socket that the system sends by default. When the user needs to enter the transparent transmission
mode in the command mode, use this command to specify the destination for sending transparent data of the
serial port.
FormatASCII):
AT+SKSDF=<socket><CR>
+OK<CR><LF><CR><LF>
Parameter
Luat 55 /73 page
→ AT+SKSTT=1
← +OK=1,2,"36.7.87.100",6100,59749,0
→ AT+SKCLS=1
← +OK
Air602_AT Instruction User Manual
socketsocket number
e.g.Please refer to Serial port enters transparent transmission mode: AT+ENTM demo
2.2.3.16 Get the source IP address of the current socket received data AT+SKSRCIP
Function
Get the source IP address of the current socket received data.
FormatASCII):
AT+SKSRCIP=?<CR>
+OK=[host]<CR><LF><CR><LF>
Parameter
HostSource IP address of the data
e.g.
2.2.3.17 Socket actively reports receiving data AT+SKRPTM
Function
Turn the socket on and off to actively report the receive data function.
FormatASCII):
AT+SKRPTM=<mode><CR>
+OK<CR><LF><CR><LF>
Parameter
Luat 56 /73 page
→ AT+SKSRCIP=?
← +OK=36.7.87.106
Air602_AT Instruction User Manual
Mode
e.g.
2.2.3.18 One-click configuration AT+ONESHOT
FunctionTurns the one-click configuration feature on or off.
FormatASCII):
AT+ONESHOT=<status><CR>
+OK<CR><LF><CR><LF>
Parameter
status
Value Dscription
0close
1open
e.g.
Connect the mobile phone WIFI to the target router A, and then open the one-key
configuration function , as follows
Luat 57 /73 page
Value Dscription
0 Close
1 Open
AT+ SKRPTM=1
← +OK
Air602_AT Instruction User Manual
2.2.3.19 HTTP client post get function AT+HTTPC
Function
Http client post get function.
FormatASCII):
AT+HTTPC=<url>,<verb>,<postdata><CR>
+OK<CR><LF><CR><LF>
Parameter
urlRemote http server address
verb
Value Dscription
0 http get
1 -
2 http post
3 http put
post dataWhen verb is 2 or 3, it is used to upload data for http.
Note: You need to open the socket active reporting function AT+SKRPTM=1 before using
the httpc command.
Luat 58 /73 page
→ AT+ONESHOT=1
← +OK
Then the mobile phone opens the one-click configuration APP, enters the user name and
password of the router A in the APP, and then, enters the one-click configuration process.
After the one-click configuration is successful, the APP will prompt, the mobile phone will
automatically exit the one-click configuration function at this time, or you can manually exit, as
follows
→ AT+ONESHOT=0
← +OK
Air602_AT Instruction User Manual
2.2.4 MQTT Instruction
2.2.4.1 Set up the MQTT server AT+MSERVER
FunctionSet the MQTT server IP address and port.
FormatASCII):
AT+MSERVER=<port>,<ipaddr><CR>
+OK<CR><LF><CR><LF>
Parameter
<port>MQTT server port number, without double quotes
<ipaddr>MQTT server IP address (Do not support domain name address), do not need to add double quotes
2.2.4.2 Set login account and password AT+MLOGIN
FunctionSet the MQTT username and password.
FormatASCII):
AT+MLOGIN=<user>,<password><CR>
+OK<CR><LF><CR><LF>
Parameter
<user>Username, no double quotes
<password>Password, no double quotes
Luat 59 /73 page
2.2.4.3 Set client idAT+MID
FunctionSet the client id of the MQTT.
FormatASCII):
Air602_AT Instruction User Manual
AT+MID=<client_id><CR>
+OK<CR><LF><CR><LF>
Parameter
<client_id>client idno need to add double quotes
2.2.4.4 Connect to the MQTT server AT+MCONNECT
FunctionConnect to the MQTT server.
FormatASCII):
AT+MCONNECT<CR>
+OK<CR><LF><CR><LF>
Success+MQTT:CONNECTED <CR><LF><CR><LF>
Failure+MQTT:FAIL<CR><LF><CR><LF>
2.2.4.5 Subscribe to a topic AT+MSUB
FunctionSubscribe to a topic.
FormatASCII):
AT+MSUB=<topics>,<qos><CR>
+OK<CR><LF><CR><LF>
Success +MSUB:OK
Failure +MSUB:<result>
Parameter
<result>:Result Code
Luat 60 /73 page
Parameter:
Null
Air602_AT Instruction User Manual
2.2.4.6 Post a message AT+MPUB
FunctionPost a message.
FormatASCII):
AT+MPUB=<topics>,<qos>,< retatin>,<mssage><CR>
+OK<CR><LF><CR><LF>
Success+MPUB:OK
Failure+MPUB:<result>
Parameter
<result>:Result Code
2.2.4.7 Received a message AT+MTOPIC,AT+MQD
FunctionReceived a message.
FormatASCII):
+MTOPIC:<topiclen>,<topic>
+MQD:<len>,<data>
Parameter
<topiclen>Subject length
<topic>Subject content
<len>Length of message content
<data>Message content
Luat 61 /73 page
2.2.4.8 Shut down the MQTT server AT+MCLOSE
FunctionShut down the MQTT server.
Air602_AT Instruction User Manual
-FormatASCII):
AT+MCLOSE<CR>
+OK<CR><LF><CR><LF>
Parameter
Null
2.2.4.9 MQTT Result Code
Result Code Definition
0 everything OK
-1 Out of memory error
-2 Buffer error
-3 Timeout
-4 Routing problem
-5 Operation in progress
-6 Illegal value
-7 Operation would block
-8 Address in use
-9 Already connecting
-10 Connection already established
-11 Not connected
-12 Low-level netif error
-13 Connection aborted
-14 Connection reset
-15 Connection closed
Luat 62 /73 page
Air602_AT Instruction User Manual
10. MQTT usage example
Note: Currently, the MQTT server address in the MSERVER command does not support domain names at
present, only IP addresses are supported.
-AT+WPRT=0
← +OK
- AT+SSID=TP-LINK_HyFi_1E
← +OK
→ AT+KEY=1,0,""
← +OK
- AT+WJOIN
← +OK=3c46d82bd81e,0,11,0,"TP-LINK_HyFi_1E",53
- AT+LKSTT
+OK=1,"192.168.1.109","255.255.255.0","192.168.1.1","192.168.1.1","0.0.0.0"
AT+MSERVER=1883,120.55.137.106
+OK
AT+MLOGIN=user,password
+OK
AT+MID=TEST_MQTT
+OK
AT+MCONNECT
-16 Illegal argument
Luat 63 /73 page
Air602_AT Instruction User Manual
Luat 64 /73 page
← +OK
+MQTT:CONNECTED
→ AT+MSUB=HELLO_WORLD
← +OK
→ AT+MPUB=Fred,0,0,888AAA
← +OK
+MPUB:OK
+MTOPIC:11, HELLO_WORLD
+MQD:10,12345_test
Note: Received an MQTT
message
→ AT+MCLOSE
← +OK
Air602_AT Instruction User Manual
3Common operation
3.1 Create a SoftAP process
1WPRT sets the wireless network card working mode to SoftAP:
AT+WPRT=2
2APSSID Set the AP SSID for the STA to MyAP:
AT+APSSID=MyAp
3APENCRYSet the wireless network card security mode to WEP64:
AT+APENCRY=1
Parameteropen0WEP641WEP1282
4APKEY Set the wireless network card key to 12345
AT+APKEY=1,1,12345
Parameter1Key format0 means HEX, 1 means ASCII
Parameter2index: Key index number1 to 4 are used for WEP encryption keys, and other encryption
methods are fixed to 0.
Parameter 3wireless key, e.g.12345
5APNIP Set the ip address and subnet mask
AT+APNIP=1,192.168.1.1,255.255.255.0,192.168.1.1,192.168.1.1
Parameter 1address type, 0 means dynamic allocation using DHCP, 1 means static address
parameter2ip:192.168.1.1
parameter3netmask255.255.255.0
parameter4gateway192.168.1.1
parameter5dns192.168.1.1
Luat 65 /73 page
Air602_AT Instruction User Manual
6PMTF saves the above parameters to spi flash, just start from step 7 with the next boot.
AT+PMTF
7WJOIN Create wireless network MyAp
AT+WJOIN
8SLIST Query the STA information which connected to your SoftAP.
AT+SLIST
Luat 66 /73 page
3.2 Scan AP Process
Wireless network card scanning AP's AT command is
AT+WSCAN
3.3 STA joins the AP process
1WPRT Set the working mode to STA
AT+WPRT=0
2SSID Set the AP name to join. e.g. TEST_AP
AT+SSID=TEST_AP
3KEY Set the wireless key of the AP you want to join. e.g. 12345678
AT+KEY=1,0,12345678
parameter1:,0 means HEX, 1 means ASCII
parameter2index: The key index number, 1 to 4, is used for the WEP encryption key. The other
encryption methods are fixed to 0.
parameter3Wireless key e.g.12345678
4NIP Enable DHCP
AT+NIP=0
Air602_AT Instruction User Manual
5PMTF Save the above parameters to spi flash Just start from step 6 with the next boot
AT+PMTF
6WJOIN Join the wireless network TEST_AP
AT+WJOIN
Luat 67 /73 page
3.4 Create an APSTA process
1WPRT Set the working mode to APSTA
AT+WPRT=3
2SSID Set the AP name to be joined, such as TEST_AP
AT+SSID=TEST_AP
3KEY Set the wireless key of the AP you want to join. e.g.
12345678 AT+KEY=1,0,12345678
parameter1:,0 means HEX, 1 means ASCII
parameter2index: The key index number, 1 to 4, is used for the WEP encryption key. The other
encryption methods are fixed to 0.
parameter3Wireless key e.g.12345678
4APSSID Set the network name of the created SOFTAP
AT+APSSID=”MYSoftAP”
5APENCRY Set the encryption type of SoftAP (such as WPA2-TKIP)
AT+APENCRY=5
6APKEY Set the password for SoftAP (e.g. ASCII code 87654321)
AT+APKEY=1,0,87654321
7APNIP Set the IP address and subnet mask
AT+APNIP=1,192.168.1.1,255.255.255.0,192.168.1.1,192.168.1.1
Air602_AT Instruction User Manual
8PMTF Save the above parameters to spi flash, just start from step 9
AT+PMTF
9WJOIN Join the wireless network TEST_AP
AT+WJOIN
Luat 68 /73 page
5. How the STA disconnects the AP
The wireless network card disconnects the AP's AT command:
AT+WLEAV
6. SoftAP disconnected
The AT command of SoftAP disconnected network is:
AT+WLEAV=2
3.7 How STA view current status
The AT command for the wireless network card to view the status of the current network card is:
AT+LKSTT
3.8 View current SoftAP status
The AT command to view the current SoftAP status is:
AT+APLKSTT
3.9 How to use the socket function
1Create a TCP server on the PC side. For example, if you use the TCP debugging assistant, the TCP server
address is 192.168.1.100 and the listening port is 1000.
Air602_AT Instruction User Manual
2Create a Socket:
TX: AT+SKCT=0,0,192.168.1.100,1000,1000
RX: +OK=1 ---> 1 is the socket number
NoteBefore sending SKCT, please ensure that the module is connected to a WIFI hotspot
with an INTERNET connection.
3send data
Luat 69 /73 page
Air602_AT Instruction User Manual
TX: AT+SKSND=1,5
kevin
RX+OK=5
TCP server Received the data interface as
4Receive data
Enter hello on the TCP Debugging Assistant interface and click Send
Luat 70 /73 page
Air602_AT Instruction User Manual
TXAT+SKRCV=1,5
RX+OK=5
hello
5) 查询Socket 状态:
TXAT+SKSTT=1
RX+OK=1,2,"192.168.1.100",1000,1024,0
Luat 71 /73 page
Air602_AT Instruction User Manual
6Close Socket connection
TXAT+SKCLS=1 RX+OK
Luat 72 /73 page
Air602_AT Instruction User Manual
3.10 Transparent transmission application in automatic working mode
1WPRT sets the wireless network card working mode to STA AT+WPRT=0
Luat 73 /73 page
2SSID Set the name of the AP you want to join, such as airm2m_wifi
AT+SSID=airm2m_wifi
3KEY Set the wireless key of the AP you want to join, for example 12345678
AT+KEY=1,0,12345678
4NIP Enable DHCP
AT+NIP=0
5ATM Set to automatic working mode
AT+ATM=0
6ATRM Set the socket connection in automatic working mode
AT+ATRM=0,0,192.168.1.100,1000
7PMTF Save parameters to spi
AT+PMTF
8ZReset the wireless network card to make the configuration take effect
AT+Z
After reset, the module automatically establishes a socket connection set by ATRM. If you use
the process interrupt chain, it will automatically reconnect.
flash

Navigation menu