Set wifi mode:
AT+CWMODE=3 // softAP+station mode
Response:OK
Reboot to take effect:
AT+RST
Response:OK
Connect to router
AT+CWJAP="ssid","password" // ssid and password of router
Response:OK
Query device’s IP
AT+CIFSR
Response:192.168.3.106 // Device got an IP from router.
Using a network tool (eg: ”NetAssist.exe”) on the computer to create a server.
For example, server ip address:192.168.3.116, port 8080
ESP8266EX connect to server as a client
AT+CIPSTART="TCP","192.168.3.116",8080 //protocol、server IP & port
Response:OK
Send data
AT+CIPSEND=4 // set date length which will be sent, such as 4 bytes
>DGFY // enter the data, no CR
Response:SEND OK
Note: If the number of bytes sent is bigger than the size defined (n), will reply busy, and after sending n number of bytes, reply SEND OK.
Receive data:
+IPD,n:xxxxxxxxxx // received n bytes, data=xxxxxxxxxxx
Transparent transmission
Set wifi mode:
AT+CWMODE=3 // softAP+station mode
Response:OK
Connect to router
AT+CWJAP="ssid","password" // ssid and password of router
Response:OK
Query device’s IP
AT+CIFSR
Response:192.168.101.105 // Device’s ip that got from router.
Using a network tool (eg: ”NetAssist.exe”) on the computer to create a server.
For example, server ip address:192.168.101.110, port 8080
Device connect to server
AT+CIPSTART="TCP","192.168.101.110",8080 // protocol、server IP & port
Response:OK
Linked
Setup server
AT+CIPSERVER=1 // default port = 333
Response:OK
PC connects to ESP8266EX softAP as station, then PC connects to ESP8266EX server as client.
NOTE: ESP8266EX acting as server has a timeout mechanism. When connection is established and no data is transmitted within a period of time, it will disconnect the client. Please setup a recurring packet transmission every 5s on the computer to ensure connection is maintained.
Send data
AT+CIPSEND=4 // set date length which will be sent, such as 4 bytes
>iopd // enter the data, no CR
Response:SEND OK
Note: If the number of bytes sent is bigger than the size defined (n), will reply busy, and after sending n number of bytes, reply SEND OK.
Receive data:
+IPD,n:xxxxxxxxxx // received n bytes, data = xxxxxxxxxx
UDP transmission
Set wifi mode:
AT+CWMODE=3 // softAP+station mode
Response:OK
Connect to router
AT+CWJAP="ssid","password" // ssid and password of router
Response:OK
Query device’s IP
AT+CIFSR
Response:+CIFSR:STAIP,"192.168.101.104" // IP address of ESP8266 station
PC connects to the same router which ESP8266 connects to. Using a network tool (eg: ”NetAssist.exe”) on the computer to create UDP .
Create a UDP transmission, for example, id is 4.
AT+CIPSTART=4,"UDP","192.168.101.110",8080,1112,0
Response:4,CONNECT OK
Note:
"192.168.101.110",8080 here is the remote ip and port of UDP transmission which create on PC in step 4;
1112 is the local port of ESP8266, user-define, if user does not define it, it will be a random value;
0 means destination peer entity of UDP will not change. For example, in this case, if another PC also creates a UDP entity and sends data to ESP8266 port 1112, ESP8266 can receive these data, but when we send data with command “AT+CIPSEND=4,X”, it will still be sent to the first PC. If this parameter is not 0, it will send to the new PC.
Send data
AT+CIPSEND=4,5 // Send 5 bytes to transmission NO.4
Response > DGFYQ // enter the data, no CR
SEND OK
Note: If the number of bytes sent is bigger than the size defined (n), will reply busy, and after sending n number of bytes, reply SEND OK.
Receive data:
+IPD,4,n:xxxxxxxxxx // received n bytes, data=xxxxxxxxxxx
Delete transmission NO.4
AT+CIPCLOSE=4
Response:4,CLOSED OK
Something went wrong with that request. Please try again.