RS232 485 TO WIFI ETH User Manual EN
RS232 485 TO WIFI ETH User Manual EN
1 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
1. OVERVIEW
Features:
Wide-range voltage DC 6-36V input, supporting screw terminals and power supply methods.
The operating modes can be selected as transparent transmission mode, serial command mode,
HTTP Client Mode, Modbus mode, and AT command mode.
Supports custom heartbeat packets, socket distribution protocols, and Modbus polling functions.
Support MQTT function, can access Ali cloud and other IoT cloud platforms.
Supports serial port free framing and automatic framing, resulting in higher forwarding
efficiency.
Support Websocket function to achieve real-time interaction between serial ports and web
pages.
Support four parameter configuration methods: web page, software settings, serial AT command,
and network AT command.
Supports one click (pressing the RELOAD button for more than 5 seconds) to restore factory
settings.
Long communication distance, with two serial servers transmitting 150 meters to each other.
2 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
CATALOGUE
1. Overview ................................................................................................................................................2
3. Overview ..............................................................................................................................................10
3 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
4 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
5 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
This chapter provides a quick start introduction for the RS232/485 to WiFi Ethernet (B) serial
server. We recommend users to seriously read this chapter and follow the instructions step by step.
This will give you a comprehensive understanding of the product. Users can also choose to read
specific chapters based on their interests and needs. For specific details and explanations, please refer
to the following chapters.
This section primarily provides a quick start guide for the RS232/485 TO WIFI ETH (B) device in
AP mode.
6 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Additionally, the WiFi of the serial server will be connected to the WiFi of the computer. If the
desktop does not have its own serial port and WIFI, it can be replaced by USB TO RS232/485/422/TTL
and wireless network card. Hardware connection diagram as shown below:
According to the above figure, simply connect the antenna, power supply, and RS232 or RS485
cable to the serial server interface according to the label instructions.
Let's take WIFI connection as an example to introduce the network connection process.
Open the wireless network connection and search for the network. As shown in the figure below,
"Waveshareuxxxx" (xxxx is the last four digits of the MAC address) is the default network name (SSID)
for the serial server.
7 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Join the network, choose to automatically obtain IP, RS232/485 TO WIFI ETH (B) serial port
server supports DHCPServer function and is enabled by default.
8 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
At this point, the Link indicator on the module changes from flashing once every 1 second to
flashing once every 2 seconds.
The initial parameters for RS232/485 to WiFi Ethernet (B) are as follows:
The default SSID is "Waveshare_xxxx" ("xxxx" represents the last four digits of the module's MAC
address).
We just need to follow the appropriate parameter settings for network communication, and
then bidirectional communication between the serial port and Wi-Fi can be achieved. The operation
steps are as follows:
Open the testing software "SSCOM.exe". Connect to the computer's COM5 (select the
appropriate port based on your situation). Choose the RS232/485 TO WIFI ETH (B) serial server's
default baud rate of 57600, and click "Open Port".
Open another instance of "SSCOM.exe". In the network settings section, choose TCP Client mode.
Enter the server IP address as 10.10.100.254, which is the default IP address of the module. Enter the
server port number as 8899, which is the default TCP port number the module listens on. Click
"Connect" to establish a TCP connection.
By now, we can test data transmission between the serial ports and network:
Computer serial port → RS232/485 TO WIFI ETH (B) serial port → WIFI/Ethernet of RS232/485
TO WIFI ETH (B) → Computer network.
The data flow from the network to the serial port is:
Computer network -> RS232/485 TO WIFI ETH (B) WiFi/Ethernet -> RS232/485 TO WiFi ETH (B)
serial port -> Computer serial port. The specific demonstration is shown in the following figure:
9 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
3. OVERVIEW
3.1 INTRODUCTION
The RS232/485 TO WIFI ETH (B) serial server supports UART-to-Wi-Fi, allowing you to convert a
serial port (RS232 or RS485) into a TCP/IP network port. This enables bidirectional transparent data
transmission between the serial interface (RS232 or RS485) and Wi-Fi. This enables serial devices to
immediately have TCP/IP network interface functions, connect to the network for data
communication, greatly expanding the communication distance of serial devices, as shown in the
following figure:
Users do not need to worry about specific details. The module completes protocol conversion
internally, and can achieve bidirectional data transmission between the serial port and WIFI through
simple settings.
10 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
11 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The following image shows the appearance of RS232/485 TO WIFI ETH (B):
There are 4 indicator on the device, from left to right they are:
RELOAD key:
This button is the Factory Reset button. To perform a factory reset while the device is in its
normal operational state (indicated by the flashing Link LED), press and hold the button for at least 5
12 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
seconds, then release it. Wait for about 10 seconds, and the RS232/485 TO WIFI ETH (B) device will
automatically complete the reset process. During this process, all indicator lights except the PWR
indicator will turn off, and then the Link LED will begin flashing again. This will indicate that the
device's settings have been restored to their factory configuration.
Ethernet port: RJ45 interface, RS232/485 TO WIFI ETH (B) is the version without PoE function.
13 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
RS232 interface: DB9 male interface. See the above figure for the cable sequence.
RS485 interface: RS485 interface, which is A, B and G from right to left according to the logo.
Power interface (terminal): 5.08*2P terminal power interface. The product power input has TVS
and anti-reverse connection protection, and supports wide voltage range: 6~36V power supply.
Power interface (DC jack): DC 5.5 jack, supporting wide voltage range: 6~36V power supply.
The connection of the network port, the network port of the module is 10M/100M adaptive,
supporting AUTOMDI/MDIX, which means that you can use the direct network cable to directly
connect with the computer for testing. The RS232/485 TO WIFI ETH (B) serial server disables the
network port by default, and can be enabled by AT command or webpage setting if it is necessary to
use the network port.
14 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
WIFI remote control in the field of toys such as airplanes and cars.
Wi-Fi body fat scale, smart card terminal and smart home.
Other wireless related secondary development and application in modern agriculture and
military fields;
Smart factories, smart homes, smart medical care and other fields.
15 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
When using RS232/485 TO WIFI ETH (B) serial server for the first time, it is necessary to
configure the WIFI serial server. You can connect the AP interface of RS232/485 TO WIFI ETH (B)
through a PC and configure it with a web management page.
By default, the AP interface SSID of RS232/485 TO WIFI ETH (B) is Waveshare_xxxx, and the IP
address, user name and password are as follows:
Specifications Default
SSID Waveshare_xxxx
IP Address 10.10.100.254
subnet mask 255.255.255.0
user name admin
password admin
Then; The RS232/485 TO WIFI ETH (B) management page supports Chinese and English, and can
be set in the upper right corner. It is divided into 9 pages, namely, quick configuration, mode selection,
16 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
wireless access point settings, wireless terminal settings, serial port and network settings, Ethernet
function settings, HTTPDClient mode, advanced settings and module management.
The quick configuration page provides a method for users to quickly configure RS232/485 TO
WIFI ETH (B) serial server. After configuring the parameters according to the steps on the page and
restarting the WIFI serial server, the WIFI serial server can work normally, which reduces the steps
and time of configuration. Of course, there are fewer options on this page, and the detailed
configuration should be configured on the corresponding page.
This page has five options to configure and a restart item, which are explained below:
Ethernet setting: Enable/disable Ethernet port and set corresponding working mode.
Serial port configuration: configure serial port parameters, including serial port baud rate, parity
bit, 485 function and so on.
MQTT setting: configure MQTT enabling and MQTT connection server related parameters.
17 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Device management: When all the above parameters are configured, click Restart to restart the
module.
"Data transmission mode" the working modes of WIFI serial server are transparent transmission
mode, serial command mode, HTTPDClient mode and ModbusTCP<=>ModbusRTU mode.
18 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The settings on this page include two tables. The top one is the wireless settings for STA,
including the SSID of the AP to be connected, security settings, etc. The following table shows the
network connection mode settings, including DHCP and static connection mode.
19 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
20 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
<Note>:
Network parameters can be set in four modes: TCP Server, TCP Client, UDP Server, and UDP
Client.
When the RS232/485 TO WIFI ETH (B) serial server is configured as a UDPServer, the RS232/485
TO WIFI ETH (B) serial server will remember the UDPClient end of the last communication and
communicate with the last UDPClient end. The UDPClient mode only communicates with the target IP
and port. When set to TCP Server, there is no need to enter an IP address. For other settings, it is
necessary to fill in the IP address of the other party that needs to be connected. Fill in the protocol
port number at the port, and the port numbers on both ends of the communication must be the
same.
TCP connection password verification: When RS232/485 TO WIFI ETH (B) is working in TCP Server
mode, perform password verification on the connected TCPClient.
Note: This verification only works when the RS232/485 TO WIFI ETH (B) serial server is used as
the TCP Server. When enabled, TCPClient connects to the TCPServer of the WIFI serial port server, the
first data sent to RS232/485 TO WIFI ETH (B) serial server is password plus carriage return. The
password is the password when logging in to the webpage, and the default is "admin". For example,
the first data sent by default should be "0x610x640x6D0x690x6E0x0D0x0A" (hexadecimal).
21 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
22 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
23 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
24 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
25 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
<Note>:
“Restart Module" Button: After users have configured parameters on various pages and clicked
"OK" to confirm the settings, these changes will only take effect after the user clicks "Restart" on the
module management page. After clicking “Reboot”, the RS232/485 TO WIFI ETH (B) serial server reset
and reboot, refreshing the previous configuration information stored in the memory.
Batch parameter configuration setting and firmware upgrade interface as shown below:
27 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The RS232/485 TO WIFI ETH (B) serial server supports two communication methods: wireless
WIFI and wired Ethernet, providing a very flexible networking method and network topology.
<Note>:
AP: Wireless access point, which is the central node of a wireless network. The commonly used
wireless router is an AP, and other wireless terminals can connect to each other through the AP.
STA: refers to a wireless station, which is a terminal of a wireless network. Such as notebook
computer, PDA, etc.
Item Note
1 WMODE Set/query WIFI operation mode (AP, STA)
2 WSSSID Set/query the SSID of the associated AP.
3 WSKEY Set/query the encryption parameters in WIFISTA
mode.
4 WANN Set/query the network parameters of STA.
5 WSLK Query the wireless connection status of STA
6 WAP Set/query parameters in WIFIAP mode.
7 WAKEY Set/query the encryption parameters in WIFIAP
mode.
8 LANN Set/query module IP in AP mode
9 FAPSTA Enable/disable module AP+STA mode
Item Note
1 NETP Set/query network protocol parameters for TCPA
2 TCPB Enable/disable TCPB function
28 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The RS232/485 TO WIFI ETH (B) serial port server can be configured as either a wireless STA or
an AP. There are AT commands and web page settings that can be set, as follows:
(1) AT command setting mode: it can be set by AT+WMODE, which can be set as AP or STA.
Example: Set the WIFI serial server to STA mode, and after entering AT command mode, send
the following command:
AT+WMODE=STA
restart
AT+Z
29 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
For example, log in to the built-in webpage of the serial port server, enter the mode selection
page, and select the Station mode (set the WIFI serial port server to STA mode), as follows:
After clicking OK, enter the module management page and restart to complete the work mode
settings.
The module enables the AP+STA function, which can be set through the AT command
(AT+FAPSTA) or customized to the factory default.
30 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The WIFI serial server operates in AP mode, and the above application can be set using the
following AT command:
AT+WMODE=AP
(2) Parameters under the WiFi serial server's Access Point (AP) mode can be selected and
configured based on your requirements or you can use the default parameters. Here's an example of
parameter settings:
AT+WAKEY=WPA2PSK,AES,12345678 (optional)
AT+Z
Note:
1. All settings set to the AT command need to enter the AT command mode (please refer to
“RS232/485 TO WIFI ETH (B) AT instruction set” for details).
2. After the parameters are set, they need to be "restarted" to take effect, so as to refresh the
original configuration information in the memory and restart the operation, which will not be
described in detail later.
31 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
AT+WMODE=STA
(2) Set the SSID, encryption mode algorithm and password of the router to be connected
(assuming that the routing SSID in the above figure is: Waveshare-TEST, encryption mode algorithm:
WPA2PSK,AES, password: Waveshare), set as follows:
AT+WSSSID=Waveshare-TEST
AT+WSKEY=WPA2PSK,AES,Waveshare
AT+Z
AT+FAPSTA=on
AT+RELD
(3) Set the WIFI serial server to STA mode, and at this time, the WIFI serial server AP interface is
still valid:
AT+WMODE=STA
(4) Set the parameters for the WIFI serial server to connect to the route (assuming the route
SSID in the figure above is WAVESHARE-WIFI-TEST, the encryption mode algorithm is WPA2PSK, AES,
and the password is www.waveshare. com), as follows:
AT+WSSSID=WAVESHARE-WIFI-TEST
Set the IP and port number of the server to connect to (based on actual parameters)
AT+TCPADDB=192.168.1.100
AT+TCPPTB=18899
AT+Z
Precautions:
When the AP+STA function is enabled, the STA port needs to be connected to other routers.
Otherwise, the STA port will constantly scan the router, which will have a certain impact on the AP
port, such as data loss. If the user determines that the STA cannot connect to the AP at this time, he
can use the command to stop scanning the STA port:
AT+STTC=on/off
“On” means to scan the router, and “off” means not to scan. This command will not be saved
after restarting.
AT+FSTTC=on/off
33 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
This command can be saved and will take effect after restarting.
The whole AP+STA application can also refer to our official website
FAQ:http://www.waveshare.com/Faq/45.html
Web Page Configuration: Access the built-in web page, navigate to the wireless terminal settings
page, and enable the AP+STA functionality to configure AP+STA settings.
AT+TCPPTB=18899
34 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The No.1 WIFI serial server works in STA mode and No. 2 works in AP mode:
AT+WMODE=STA
AT+WMODE=AP
(3) No.1 WIFI serial server is connected to AP(WIFI serial server 2) as a STA, so the SSID and password
to be connected to WIFI serial server 1 are the AP parameters of WIFI serial server 2.
The SSID and password of No.2 WIFI serial server can be queried by using the following AT
instructions:
AT+WAP
AT+WAKEY
You can also choose settings as required, or use default parameters. Examples of parameter
settings for WIFI serial server 2 are as follows:
AT+WAKEY=WPA2PSK,AES,12345678 (optional)
An example of parameter setting for No.1 WIFI serial server is as follows (set the SSID and
password of WIFI serial server 2 corresponding to the connected AP parameters), as follows:
AT+WSKEY=WPA2PSK,AES,12345678
AT+Z
Item Note
1 WMODE Set/query WIFI operation mode (AP, STA)
2 WSSSID Set/query the SSID of the associated AP
3 WSKEY Set/query the encryption parameters in WIFISTA mode
35 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Item Note
1 NETP Set/query TCPA network protocol parameters
2 TCPB Enable/disable TCPB function
3 TCPPTB Set/query TCPB port number:
4 TCPADDB Set/query TCPB server
36 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The RS232/485 TO WIFI ETH (B) serial server offers a 100M Ethernet interface that allows users
to achieve bi-directional communication between WiFi, serial, and Ethernet interfaces. Through this
100M Ethernet interface, seamless interaction is possible among the three interfaces, enabling
effective data exchange. In terms of networking, the RS232/485 TO WIFI ETH (B) serial server's
Ethernet port can be configured as either a LAN port or a WAN port. Additionally, it supports both
bridge mode and router mode to cater to different specific applications.
AT+FEPHY=on
(2) Restore the factory settings to make the above settings take effect.
AT+RELD
Note that the AT+RELD command will not restore the above settings.
AT+WMODE=AP
(4) LAN parameters of serial port server need not be set by default, and IP address (DHCP
gateway) and subnet mask of serial port server can also be modified as needed. The default values are
used here:
AT+LANN=10.10.100.254,255.255.255.0
37 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
After the serial server is connected to the AP, it obtains the IP address from the AP (as shown in
Figure 192.168.1.10). The serial server itself forms a subnet (default is 10.10.100.254), and the
devices on the Ethernet port are assigned addresses by the serial server (as shown in Figure
10.10.100.100, as shown below):
AT+FEPHY=on
(2) Set the serial server Ethernet port to work in WAN port mode
AT+FVEW=enable
(3) Restore factory settings for the above settings to take effect
AT+RELD
Note: The AT+RELD command will not restore the above settings.
(4) The serial server is operating in AP mode and DHCP is enabled (default, select settings).
AT+WMODE=ap
AT+DHCPDEN=on
(5) Considering security, you can modify the AP name and encryption parameters (optional).
(5) You can choose to set the LAN parameters of the serial server, including IP address (DHCP
gateway) and subnet mask (optional).
AT+LANN=192.168.2.1,255.255.255.0
Note: it is necessary to ensure that the set LANIP address cannot be in the same network segment as the WANIP
address obtained by the serial server from the AP!
AT+FVER=n
AT+FEPHY=on
(3) Restore factory settings for the above settings to take effect.
AT+RELD
Note that the AT+RELD command will not restore the above settings.
AT+WMODE=STA
39 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(5) Set the SSID and password of the route to be connected to the serial server (according to the
actual parameters of the route).
Example: AT+WSSSID=WAVESHARE-WIFI-TEST
AT+WSKEY=WPA2PSK,AES,www.waveshare.com
(6) Set the serial server LAN parameters, IP address (DHCP gateway) and subnet mask.
Inquire about the IP obtained by the serial port server from the AP:
AT+WANN
Set the LAN parameters of the serial server to ensure that the LANIP address cannot be in the
same network segment as the WAN IP address obtained by the serial server from the AP. In this case,
since it is not in the same network segment, you can use the default instead of setting it.
AT+LANN=10.10.100.254,255.255.255.0 (optional)
Web Page Configuration: Access the built-in web page of the server, enter the Ethernet
functional settings page, and within the Ethernet port mode configuration, set the Ethernet port
mode to 'n'.
As shown below:
40 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Figure 192.168.1.101). At this point, the entire network treats the serial server as if it were a
transparent device. Communication between PC1 and PC2 is possible without any constraints, as if
the serial server doesn't introduce any limitations or obstacles in their interaction. However, for the
RS232/485 TO WIFI ETH (B) serial server to communicate with other devices, it requires a static LAN IP
address to be configured, such as the example address 192.168.1.10.
Upon power-up, the serial server enters a pre-configure mode. By default, it enters transparent
transmission mode. Switching between modes (1) to (4) can be configured using the serial server's
built-in web page or the AT command AT+TMODE.
In modes (1), (2), (3), and (4), the serial port sends "+++" followed by "a". Once the serial server
receives these sequences, it sequentially responds with acknowledgment codes "a" and "+ok". This
indicates the transition into mode (5), the AT command mode. To return from AT command mode to
the original operational mode, the command AT+ENTM (with a carriage return) can be used.
Specific timing requirements for entering the AT command mode can be found in the "RS232/485 TO
WIFI ETH (B) AT Command Set" documentation.
41 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
and WIFI/ Ethernet, without any parsing, so as to realize the data transmission between universal
serial port devices and network devices.
In the transparent transmission mode, it can be completely compatible with the user's original
software platform. User equipment can basically support wireless data transmission without making
software changes, as shown in the following
figure:
In this mode, when the RS232/485 TO WIFI ETH (B) serial server is used as UDPClient or TCPClient,
users are allowed to send serial data to different servers, regardless of the number of Soc0ket.
The client's MCU only needs to send data packets according to the format specified by our
company, and the serial server will parse the received data. If the data conforms to the protocol, the
serial server will send the parsed data to the designated server. If the data does not conform to the
protocol, it will be treated as a waste package without sending it to the server.
The client MCU sends the data packet according to the following format, and after the WIFI serial
server finishes parsing, only N bytes of data are sent to the target address. When data is returned, the
data is directly output from the serial port without parsing.
42 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Header:
Always 0x550xaa
Length:
The sum of all bytes from the start of the function code to the checksum (excluding the
checksum). Note: The high byte comes first.
Function code:
Bit0:(UDP:0; TCP:1)
Bit1: (Long connection: 0) Note: Only long connections are supported at present.
Bit7: (Simplified Protocol: 0; Full Protocol: 1) Note: Currently, only the simplified protocol is
supported.
Note:
For Bit1, long connection, after sending data, the connection will be maintained until the target
address is changed again.
For Bit2, it represents whether the target address is IP or domain name, and if it is IP, the target
address is 4 bytes; If it is a domain name, the length of the target address is the length of the
entire domain name string (where the last byte of the target address is 0x00, that is, the end of
the string, and the length of the domain name is indefinite).
For Bit7, under the simplified protocol, the reply frame only contains data; Under the full
protocol, the reply frame will have frame formats such as sending failure, waiting timeout, and
responding device IP under UDP broadcast.
Target port:
Little-endian format, with the low byte first. For example, the port number 33 would be
represented here as 2100.
Target address:
If it is IP, it is 4 bytes, for example, 192.168.0.133 means 8500A8C0; If it is a domain name, the
length of the address is uncertain, ending with '\0'.
Data:
43 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Checksum:
Starting from the function code and continuing until the byte just before the checksum byte,
perform a summation checksum.
Note: The serial command mode is a data transmission mode, so please pay attention to
distinguish it from the AT command mode which can query or set the parameters of the serial server!
This mode is used for RS232/485 TO WIFI ETH (B) to transmit data to or obtain data from the
HTTP server. After the user sets the specific content of HTTP header with AT command or webpage.
Every time data is sent, RS232/485 TO WIFI ETH (B) will automatically package the sent data into HTTP
protocol data and send it to the designated HTTP server. The data received from the server will be
directly transmitted to the serial port without any processing. RS232/485 TO WIFI ETH (B) handles the
complicated HTTP protocol, which is convenient for users to program the serial port without
considering too many HTTP issues. The maximum size of data sent is 1000 bytes.
44 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
In GET mode, after the serial server receives the user's serial data packet, the packaging format is
as follows:
In POST mode, after the serial server receives the user serial data packet, the packaging
format is as follows:
45 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
AT command setting:
If the data sent is 1234, Then the 80 port of test.waveshare.com will get the following data:
POST/2.php?HTTP/1.1
Connection:keep-alive
User-Agent:lwip1.3.2
Content-Length:4
Host:test.waveshare.com:80
1234
46 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
GET/1.php?data=1234HTTP/1.1
Connection:keep-alive
User-Agent:lwip1.3.2
Host:test.waveshare.com:80
When the request mode is POST or PUT, the serial data will be added to the position behind the
HTTP protocol header; When the request method is GET, the serial data will be added to the back of
the protocol header path.
Users can customize the content of HTTP headers in the new definition mode, and can add,
delete and modify the content of each HTTP header at will according to their own needs (if the HTTP
request type is POST/PUT, RS232/485 TO WIFI ETH (B) will automatically add the Content-Length).
The set instructions include AT+HTPMODE, AT+HTPSV, AT+HTPTP, AT+HTPURL and AT+HTPHEAD.
Please refer to the chapter of AT Command Set for the specific command setting process. Similarly,
there is a corresponding setting page in the webpage.
Note: The above definition method is called the old version definition method. In the new
version of the setting mode, a new definition mode of HTTP header is added. If the HTTP header is set
with AT command, please use "< < CRLF > >" instead of carriage return, and the carriage return
problem is not needed when setting the built-in webpage.
47 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(2) Under the serial port and network configuration page, select the HTTPDClient mode as
long/short.
If it is set to the short connection state, you can set the timeout of 3-65535(s).
48 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
AT+HTTPSCEN=short
(2) Set/query timeout interval (3-65535) seconds in short connection mode; Take 3 seconds as an
example;
AT+HTTPSCT=3
(1)Set the HTTPD Client POST parameter through the web page:
49 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(2)Open SSCOM serial communication assistant and send Json format through RS232/485
interface:
"apikey": "tPmAT5Ab3j888",
"value1": "33",
"value2": "3",
"value3": "22"
(3)After sending successfully, the prompt in the red box will be returned:
50 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(4)Open a web page:https://pico.wiki/esp-chart.php , you can see the POST to the server data
chart, as shown in the figure below:
51 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(1)Set the HTTPD Client GET parameter through the web page:
52 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(2)Open SSCOM serial communication assistant and send it through RS232/485 interface. You
need to get the latest value of a certain value on the webpage, for example, to get the latest value of
value3:
variable=value3
53 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
(4)It is the same as that obtained through a web browser, as shown in the following figure:
54 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Set by AT command:
AT+TMODE=modbus
In AT command mode, users can query the current status of WIFI serial server or set the
parameters of WIFI serial server by sending AT command.
When RS232/485 TO WIFI ETH (B) works in AP mode, it can be set to automatic frequency
selection mode, so when RS232/485 TO WIFI ETH (B) is started, a better wireless channel will be
selected according to the surrounding environment.
1.WPA-PSK/TKIP
2.WPA-PSK/AES
3.WPA2-PSK/TKIP
55 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
4.WPA2-PSK/AES
The working methods of SocketA include: TCP Server, TCP Client, UDP Server, and UDP Client.
Currently, SocketB supports TCP client and UDP Client.
56 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Item Note
1 NETP Set/query the network protocol parameters of
TCPA
2 TCPLK Query whether the TCP link is established.
3 TCPTO Set/query TCP timeout
4 TCPDIS Connect/disconnect TCP (valid only for TCPClient)
SocketB setting: AT+TCPB/AT+TCPPTB/TCPADDB/TCPTOB/TCPLKB/TCPDIS
Item Note
1 TCPB Enable/disable TCPB function.
2 TCPPTB Set/query the port number of TCPB
3 TCPADDB Set/query the server address of TCPB.
4 TCPTOB Set/query TCPB timeout
5 TCPLKB Query whether the TCPB link has been
established
6 TCPDIS Connect/Disconnect TCP
Please refer to the section "4.3.4. AT Command Set" in this manual for specific AT command related
parameters.
Item Parameters
Baudrate 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200,
230400, 345600, 460800
Data bit 5, 6, 7, 8
Stop bit 1, 2
Checksum byte None, Even, Odd
485 NFC: No hardware flow control
Log in to the built-in webpage and set the serial port parameters on the "Serial Port and Network
Settings" page, as follows:
57 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
AT Command Settings
If you need to change the WiFi serial server baud rate to 115200bps, use the following command:
AT+UART=115200,8,1,None,NFC
Using the example of sending data from a serial device to a serial server, let me explain the process of
free-frame assembling in a WiFi serial server:
Assuming that n is the interval for free-frame assembling, measured in milliseconds, where T1 > n, T2
< n, T3 < n, T4 < n, T5 < n, T6 > n, then Byte1 to Byte5 are treated as a single frame of data, as
illustrated
58 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
below:
The default interval time for two bytes in the WiFi serial server is 10ms, which means that when
the interval time is greater than 10ms, a frame is considered complete. This interval time can be
configured to 50ms using the following AT command to meet the customer's requirements for serial
port forwarding efficiency:
AT+FUARTTE=normal
After the setting is completed, it is necessary to enable the above settings with the command of
Restore Factory Settings:
AT+RELD
Note that the AT+RELD command will not restore the above setting.
After testing, if it is set to 10ms, the time delay from WIFI->UART->WIFI loop is about 40 ~ 50ms
if the data volume is not large.
However, if the interval time is set to 10ms and the client's MCU cannot guarantee sending the
next byte within 10ms, the serial data might be fragmented.
To restore the default free framing interval of 10ms, you can use the following AT command:
AT+FUARTTE=fast
After the setting is completed, you also need to use the Restore Factory Settings command to
enable the above settings.
For specific UART automatic framing operations, please refer to the "AT Command Set" section of this
manual, which provides information on the UARTF/UARTFT/UARTFL commands.
59 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
1. Automatic framing trigger frame length: refers to RS232/485 TO WIFI ETH (B) receiving the
specified number of bytes from the serial port, composing a data frame and forwarding it to the
network.
2. Automatic framing trigger time: It means that RS232/485 TO WIFI ETH (B) will forward the
received data to the network if the data received from the serial port is less than the length of the
automatic framing trigger frame within the trigger time.
The time of automatic framing starts from the first byte received by the WIFI serial port server
from the serial port. As shown in the figure below:
The specific UART automATic framing operATion can be set through the "serial port and network
settings-> serial port automATic framing settings" section of the built-in webpage of WIFI serial port
server or by using the at command. For the at command settings, please refer to the introduction of
UARTF/UARTFT/UARTFL commands in the "at command set" chapter of this manual.
This function is only applicable to RS232/485 TO WIFI ETH (B) as a TCPServer. When the
TCPClient connects to RS232/485 TO WIFI ETH (B), RS232/485 TO WIFI ETH (B) will authenticate every
connected TCP.
60 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
After connecting via TCPClient, the first data to be sent should be the web password of the
RS232/485 TO WIFI ETH (B), followed by a carriage return and line feed. By default, the password of
RS232/485 TO WIFI ETH (B) is admin, so the first data sent by TCPClient should be
"0x610x640x6D0x690x6e0x0D0x0A" (hexadecimal). If the password is correct, RS232/485 TO WIFI
ETH (B) returns "OK", otherwise returns "NO" and disconnects.
This function can be enabled or disabled in "TCP connection password verification" in the
webpage.
The length of the protocol is 8 bytes, and the specific content of the protocol is as follows. The
numerical value of the example is in HEX format:
61 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
connected to the WIFI network of the WIFI serial port server, and can query the SSID information list
and set the router SSID and password through the commands under UDP protocol. After the setting is
completed, the WIFI serial server will automatically restart and connect to the router, and it will work
in STA mode at this time.
Protocol format description:
Table query instruction
Number of
No. Name Note
bytes
1 Header 1 Fixed value 0xFF
The number of bytes after the length (excluding the length) and
2 Length 2
before the checksum (excluding the checksum).
Command
3 1 Command type, 0x01 is a query instruction
code
Checksum The cumulative sum of all bytes after the header (excluding the
4 1
byte header) and before the checksum (excluding the checksum).
byte header) and before the checksum byte (excluding the checksum
byte).
Example:
Mobile phone sent to WIFI serial server (hexadecimal number): FF00010102.
WIFI serial server returns to mobile phone (hexadecimal number):
FF00148102544553543100400D0A 544553543200370D0A1F
Note: The mobile phone sends a query instruction to the WIFI serial server to query the router
related information. The information returned by the WIFI serial server to the mobile phone is: there
are two routers, the SSID of router 1 is "TEST1" and the signal strength is 64%; Router 2 has an SSID of
"TEST2" and a signal strength of 55%.
Note: The router information replied by the WIFI serial server is sorted according to the signal
strength.
Table setting instruction
64 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Example:
The mobile phone is sent to the WIFI serial server (hexadecimal number):
ff000f020054455354310d0a313233343536ce.
WIFI serial server returns to mobile phone (hexadecimal number): FF000382010187.
Note: The mobile phone sends a setting instruction to the WIFI serial server, setting the SSID as
"TEST1" and the password as "123456". The information returned by the WIFI serial server to the
mobile phone is that there is a network with the SSID of "TEST1" and the password format is correct.
6.8 LOCAL AREA NETWORK SEARCH
RS232/485 TO WIFI ETH (B) supports local network search functionality. This means that when
RS232/485 TO WIFI ETH (B) is connected to a wireless router, users can obtain the IP address of the
current local network serial port server for RS232/485 TO WIFI ETH (B) by sending a UDP broadcast to
a specific fixed port. This enables device discovery and communication within the local network.
You can also directly connect the AP of RS232/485 TO WIFI ETH (B) to send the search instruction,
as shown in the following figure:
65 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Item Content
IP address xxx.xxx.xxx.xxx
MAC address xxxxxxxxxxxxxx
MID
Version number
If no setting command is received within 30 seconds after RS232/485 TO WIFI ETH (B) enters
configuration mode, RS232/485 TO WIFI ETH (B) will exit configuration mode, and the user needs to
resend the search command word to enter configuration mode.
3. Users can set and read parameters/states by sending network AT commands to this port. The AT
command format is the same as the serial port AT command.
Note: The search tool and RS232/485 TO WIFI ETH (B) must be on the same LAN. If multiple STAs
are connected to a router, the computer running the search tool is also connected to that router. This
search tool can find all the STAs.
66 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Parameters related to this function are set in the "serial port and other settings" section of the
webpage, which is disabled by default.
The relevant instruction settings are as follows:
Table Registration Package Command List
67 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The main purpose of sending to the network is to keep the connection with the server, and at
the same time, let the server that has been idle for a long time (not sending data to the server for a
long time) check whether the current connection status is valid.
In applications where servers send fixed query instructions to devices, in order to reduce
frequent interaction, users can choose to send heartbeat packets (query instructions) to the serial
device end instead of sending query instructions from the server.
To enable the custom heartbeat packet function, the AT command setting steps are as follows:
(1) Enable the function of sending heartbeat packets
AT+HEARTEN=on
(2) Set the type of heartbeat packet sending direction (NET or COM), for example, set the heartbeat
packet to be sent to the network server.
AT+HEARTTP=NET
(3) Set the heartbeat packet data (up to 40 bytes), for example, to set the data to the string
www.waveshare.com, you need to first convert it to a hexadecimal string as
7777772E7761766573686172652E636F6D。
AT+HEARTDT=7777772E7766573686172652E636F6D
(4) Set the interval time for sending heartbeat packets, with a range of 1-65535s and a default of 30s.
For example, set the transmission interval to 30 seconds.
68 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
AT+HEARTTM=30
In addition to the above settings, you should also set the network connections such as socketA
and socketB, please refer to Section 2.4. After setting, restart the serial server. When the socket or
socket is connected to the server, if there is no data transmission in the serial port of the device
within 30 seconds, the serial server will send the string www.waveshare.com to the server.
The related instructions are set as follows:
Table heartbeat packet instruction list
Header:
Always 0x550xFD0xAA
Length:
The sum of all bytes from the parameter area (including the parameter area) to the checksum
(excluding the checksum). High byte first
Parameter area:
The first byte: common parameter area, which is the connection serial number (SocktA or
SocketB); If the serial number is 0x61, it represents all the connection objects sent to SocketA, and if it
is 0x62, it represents the connection objects sent to SocketB.
Second byte: spare parameter area, which is 0x00 by default.
The common parameter area is in front, and the spare parameter area is in the back.
Data:
69 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
The length is variable, and the length of the whole data packet is not more than 4096 bytes.
Checksum:
Starting from the parameter area (including the parameter area), and counting up to the byte
before the checksum byte, calculate the sum and take the last byte as the checksum byte.
The following are specific application examples:
55FDAA00036100CC2D(Hex)
Among them,
Length byte 0003: length is 3.
Parameter byte: 6100: Send data to socketA connection.
Data area CC: The data sent is "0xCC".
Checksum calculation: 61+00+CC=2D.
(2) Data format from module to serial port device
When data (n bytes) is sent from the network, the module sends the data packet to the serial
device according to the following format; In addition, when the serial device sends data to the
module, if there is an error in sending, it will also reply to the serial device according to this format.
Table Serial Port Sending Format
Header
Always 0xAA0xFD0x55
Length:
The sum of all bytes from the parameter area (including the parameter area) to the sum check
(excluding the sum check). High byte first
Parameter area:
The first byte: common parameter area, which is the connection serial number (socket or socket
b); The data returned for SocketA is 0x61, and the data returned for SocketB is 0x62.
The second byte: spare parameter area, and the seventh bit indicates whether the reply frame is
data returned by the network or the module. (1: module returns data; 0: network returns data). Data:
If it is network data, copy the data directly to the location; The length is variable, and the length
of the whole data packet is not more than 4096 bytes.
If it is the data replied by the module, the corresponding operation reply code is returned. The
specific operation reply code is as follows:
Table Operation reply code
Checksum:
70 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
Starting from the parameter area (including the parameter area) and before the checksum byte,
add and take the last byte as the checksum byte.
The following is a specific application example: AAFD5500036100CC2D (Hex)
Among them, length byte 0004: is length 4
Reference number 6100:61- SocketA data
00- Network sends to serial devices
Data area CC: Data sent from network socket A
Checksum calculation: 61+00+CC=2D
Taking Socket as an example, the serial port device sends abc to Socket, and the network-side
Socket sends data 123 to the serial port device, as shown below:
71 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
72 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
RS232/485 TO WIFI ETH (B) MQTT's subscribe topic modes include Pure Transparent Subscribe
Mode (subscribed topic data transparently transmitted to the serial port) and Topic-Carrying
Subscribe Mode (subscribed topic data carrying the topic is transparently transmitted to the serial
port).
Command Note
MQTTEN Turn MQTT function on/off
MQTTVER Query/set MQTT version number
MQTTSVR Query/set MQTT server information
MQTTID Query/set MQTT client ID
MQTTUSR Query/set MQTT authentication user name
MQTTPWD Query/set MQTT authentication password
MQTTHEART Query/set MQTT heartbeat interval
MQTTWILLEN Query/set MQTT last will status
MQTTWILL Query/Set the MQTT last will message.
MQTTLINK Query the MQTT connection status.
MQTTPUBMOD Query/Set the MQTT topic publishing mode.
MQTTPUBLS Query the list of preconfigured MQTT publish topics.
MQTTPUBADD Add a new topic to the preconfigured publish topics.
MQTTPUBDEL Delete the topic with that name from the preconfigured
publish topics.
MQTTPUBCLR Clear the preconfigured publish topics.
MQTTSUBMOD Query/Set MQTT Topic Subscription Mode
MQTTSUBLS Query MQTT preconfigured subscription topic list
MQTTSUBADD Add a new topic to a preconfigured subscription topic
MQTTSUBDEL Delete a topic with that name from the preconfigured
subscription topics.
MQTTSUBCLR Clean preconfigured subscription topics
74 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual
75 www.waveshare.com