[go: up one dir, main page]

0% found this document useful (0 votes)
62 views75 pages

RS232 485 TO WIFI ETH User Manual EN

The RS232/485 to WiFi ETH (B) User Manual provides comprehensive instructions for using a serial server that converts RS232/485 signals to WiFi and Ethernet, supporting various communication modes and protocols. It includes features such as wide voltage input, multiple configuration methods, and support for MQTT and Modbus, along with detailed setup instructions for hardware connections, network configurations, and data transmission tests. The manual also outlines the device's specifications, operating indicators, and interface descriptions to facilitate user understanding and application.

Uploaded by

p8oa1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views75 pages

RS232 485 TO WIFI ETH User Manual EN

The RS232/485 to WiFi ETH (B) User Manual provides comprehensive instructions for using a serial server that converts RS232/485 signals to WiFi and Ethernet, supporting various communication modes and protocols. It includes features such as wide voltage input, multiple configuration methods, and support for MQTT and Modbus, along with detailed setup instructions for hardware connections, network configurations, and data transmission tests. The manual also outlines the device's specifications, operating indicators, and interface descriptions to facilitate user understanding and application.

Uploaded by

p8oa1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

RS232/485 TO WIFI ETH (B) User Manual

RS232/485 TO WIFI ETH (B)


User Manual

Figure RS232/485 TO WIFI ETH (B)

1 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

1. OVERVIEW
Features:

 Support 802.11b/g/n wireless standard.

 Supports fast networking protocol.

 Support router and bridge modes.

 Supports communication via RS232/485 to WiFi and Ethernet interfaces.

 Rich status indicator: PWR, LINK, RXD, TXD.

 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.

 Support registering MAC, transparent cloud, and customized registration packets.

 Supports custom heartbeat packets, socket distribution protocols, and Modbus polling functions.

 Support timeout reboot, timed reboot function and so on.

 Support MQTT function, can access Ali cloud and other IoT cloud platforms.

 Support hardware watchdog, making the system more stable.

 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.

 Guide rail design for easy and convenient installation.

2 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

CATALOGUE
1. Overview ................................................................................................................................................2

2. Quick get start ....................................................................................................................................... 6

2.1 Hardware Connection ..................................................................................................................6

2.2 network connections ...................................................................................................................7

2.3 Data transmission test .................................................................................................................9

3. Overview ..............................................................................................................................................10

3.1 Introduction ...............................................................................................................................10

3.2 electrical parameter .................................................................................................................. 10

3.3 Product appearance .................................................................................................................. 12

3.4 Operating indicator and key ......................................................................................................12

3.5 Interface description ................................................................................................................. 13

3.6 Outline dimensions ....................................................................................................................14

3.7 Application scenarios .................................................................................................................15

4. Product Parameters Setting ................................................................................................................ 16

4.1 Web management page ............................................................................................................ 16

4.1.1 Open the management page ..........................................................................................16

4.1.2 Quick configuration page ............................................................................................... 17

4.1.3 Mode selection page ...................................................................................................... 18

4.1.4 Wireless access point settings page ............................................................................... 18

4.1.5 Wireless terminal settings page ..................................................................................... 19

4.1.6 Serial port and network settings page ........................................................................... 20

4.1.7 Ethernet function settings ..............................................................................................22

4.1.8 HTTPDClient mode page .................................................................................................22

4.1.9 MQTT function settings page ......................................................................................... 24

4.1.10 Module Management Page ..........................................................................................25

4.2 Software configuration ..............................................................................................................26

4.2.1 Download link .................................................................................................................26

4.2.2 Software introduction .................................................................................................... 26

3 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

5. Product networking application .......................................................................................................... 28

5.1 Wireless networking settings .................................................................................................... 28

5.2 Wireless networking applications ............................................................................................. 30

5.2.1 Wireless Networking Applications (AP) ..........................................................................30

5.2.2 Wireless networking application (STA) .......................................................................... 31

5.2.3 Wireless networking application (AP+STA) .................................................................... 32

5.2.4 Wireless networking application (AP, STA) .................................................................... 34

5.3 Wired networking setup ............................................................................................................35

5.4 Wired networking application ...................................................................................................37

5.4.1 Wired networking application (APLAN) ......................................................................... 37

5.4.2 Wired networking application (APWAN) ........................................................................38

5.4.3 Wired networking application (routing) .........................................................................39

5.4.4 Wired networking application (bridge) .......................................................................... 40

6. Product function description ...............................................................................................................41

6.1 Working mode ........................................................................................................................... 41

6.1.1 Transparent transmission mode .................................................................................... 41

6.1.2 Serial command mode ....................................................................................................42

6.1.3 HTTPDCLIENT mode ........................................................................................................44

6.1.4 ModbusTCP<=>ModbusRTU conversion mode ............................................................. 54

6.2 Wireless characteristics .............................................................................................................55

6.2.1 Automatic frequency selection function ........................................................................55

6.2.2 Security mechanism ....................................................................................................... 55

6.2.3 STA joins the routing function ........................................................................................56

6.2.4 STA address binding function ......................................................................................... 56

6.3 Socket communication .............................................................................................................. 56

6.4 UART framing mechanism ......................................................................................................... 57

6.4.1 Serial Parameters ........................................................................................................... 57

6.4.2 UART Free-Frame Mode .................................................................................................58

6.4.3 UART automatic framing mode ......................................................................................59

4 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

6.5 Password authentication when TCP establishes connection ....................................................60

6.6 Description of RFC2217 protocol .............................................................................................. 61

6.7 Fast Networking Protocol ..........................................................................................................62

6.8 Local area network search .........................................................................................................65

6.9 Registration packet function ..................................................................................................... 66

6.10 Customized heartbeat packets ................................................................................................67

6.11 Socket distribution function .................................................................................................... 69

6.12 Timeout reboot function ......................................................................................................... 72

6.13 Timed reboot function ............................................................................................................ 72

6.14 MOD BUS polling ..................................................................................................................... 72

6.15 KeepALIVE Function .................................................................................................................73

6.16 Websocket function ................................................................................................................ 73

6.17 MQTT function .........................................................................................................................73

6.17.1 MQTT function introduction ........................................................................................ 73

6.17.2 RS232/485 TO WIFI ETH (B) Parameter Configuration ................................................ 74

5 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

2. QUICK GET START


The RS232/485 TO WIFI ETH (B) serial server supports the functions of UART to WIFI, UART to
Ethernet, and Ethernet to WIFI. It can convert the RS485 serial port into a TCP/IP network interface
and achieve bidirectional transparent data transmission between the RS485 serial port and
WIFI/Ethernet.

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.

The following software is involved: SSCOM.exe: Serial Debugging Assistant.

2.1 HARDWARE CONNECTION

The default configuration for RS232/485 to WiFi Ethernet (B) is as follows:

Figure RS232/485 TO WIFI ETH (B) default configuration

In order to test the communication conversion of RS232/485 to WiFi/Ethernet, we will connect


the serial port of the RS232/485 to WiFi Ethernet (B) serial server to the serial port of the computer.

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:

Figure Hardware Connection

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.

2.2 NETWORK CONNECTIONS

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

Figure Wireless Network SSID Search

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

Figure Wireless Network Connection

At this point, the Link indicator on the module changes from flashing once every 1 second to
flashing once every 2 seconds.

2.3 DATA TRANSMISSION TEST

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).

 The default encryption method is "open” and “none”.

 The default user serial parameters: 57600,8,1,None;

 The default value of network parameters: TCP,Server,8899,10.10.100.254;

 Local IP address: 10.10.100.254

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:

Data flow from the serial port to the 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

Figure Serial port/network transmission test

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:

Figure Basic functions of serial server

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.

3.2 ELECTRICAL PARAMETER

Table Electrical Parameters

10 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Name Item Index


Wireless 802.11b/g/n
standards
Frequency range 2.412GHz-2.484GHz
Transmitting 802.11b:+19dBm(Max.@11Mbps)
power 802.11g:+18dBm(Max.@54Mbps)
WIRELESS +17dBm(Max.@HT20,MCS7)
SPECIFICATION +17dBm(Max.@HT40,MCS7)
Configured by users
Receiving 802.11b:-89dBm(@11Mbps)
sensitivity 802.11g:-81dBm(@54Mbps)
802.11n:-73dBm(@HT20,MCS7)
-71dBm(@HT40,MCS7)

Data port RS232, RS485: 300~460.8Kbps


RS232 port(ESD/EFT protection)
RS232 port(ESD/EFT/surge protection)
Network port Ethernet: 10Mbps/100Mbps
Operating DC6~36V
voltage
Operating -40℃~85℃
temperature
Dimensions 109.66*28*64.71mm(L*W*H)
Wireless network Station/AP/AP+Station mode
Security WPA PSK/WPA2 PSK
mechanism
Encryption type TKIP/AES
Operating mode transparent transmission mode, protocol
transmission mode
Command setting AT+Command Structure
Protocol TCP/UDP/ARP/ICMP/DHCP/DNS/HTTP/MQTT
Maximum TCP 24
connections
User Web Server+AT Command Configuration
Configuration
Customer Support customer customization of application
application software
software

11 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

3.3 PRODUCT APPEARANCE

The following image shows the appearance of RS232/485 TO WIFI ETH (B):

Figure Product Appearance

3.4 OPERATING INDICATOR AND KEY

There are 4 indicator on the device, from left to right they are:

Indicator Function Note


RXD Receiving data Blinks when the serial port of the device
receives data
TXD Sending data The device flashes when sending data through
the serial port.
LINK Operating indicator The green indicator remains off and blinks once
Network connection every 1 second. During firmware upgrades, it
blinks once every 0.5 seconds. Once a WiFi
connection is established, the blinking pattern
changes to once every 2 seconds.
PWR Power indicator Always on when power input is correct

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.

3.5 INTERFACE DESCRIPTION

The hardware interfaces are as follows:

 Antenna connector: 3dbi antenna.

 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.

 RJ45 network port:

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.

3.6 OUTLINE DIMENSIONS

14 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Outline dimensions

3.7 APPLICATION SCENARIOS

The application scenarios of RS232/485 to WiFi/Ethernet is as shown below:

 The serial port (RS232/485) to WiFi ETH (B) are as follows:

 WiFi remote control/monitor, TCP/IP AND WiFi co-processor.

 WIFI remote control in the field of toys such as airplanes and cars.

 WIFI network radio, camera, digital photo frame.

 Medical instrument, data acquisition device, handheld devices.

 Wi-Fi body fat scale, smart card terminal and smart home.

 Instruments and meters, equipment parameter monitoring, wireless POS machine;

 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

4. PRODUCT PARAMETERS SETTING


The RS232/485 TO WIFI ETH (B) serial server supports AT command and Web parameter setting.
For the setting of AT command, please refer to the chapter of "AT instruction set" in the document.
This chapter mainly explains how to set up the Web.

4.1 WEB MANAGEMENT PAGE

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:

Table Network Default Settings

Specifications Default
SSID Waveshare_xxxx
IP Address 10.10.100.254
subnet mask 255.255.255.0
user name admin
password admin

4.1.1 OPEN THE MANAGEMENT PAGE


Firstly, connect RS232/485 TO WIFI ETH (B) with the wireless network card of PC, and the SSID is
Waveshare_xxxx. When connected, open the browser, enter 10.10.100.254 in the address bar and
press enter. Fill in the user name and password in the pop-up dialog box, and then "confirm".

Figure the second step of opening the management web page

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.

4.1.2 QUICK CONFIGURATION PAGE

Figure Quick Setup Page

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:

 Wireless configuration: configure the working mode of WIFI, AP or STA mode.

 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.

 Network configuration: configure network parameters, only related parameters of SocketA.

 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.

4.1.3 MODE SELECTION PAGE


The first page of the Web can be set to select RS232/485 TO WIFI ETH (B) serial server to work in
AP mode or STA mode.

"Data transmission mode" the working modes of WIFI serial server are transparent transmission
mode, serial command mode, HTTPDClient mode and ModbusTCP<=>ModbusRTU mode.

Figure wireless mode settings

4.1.4 WIRELESS ACCESS POINT SETTINGS PAGE


RS232/485 TO WIFI ETH (B) supports AP interface, through which the WIFI serial server can be
managed very conveniently, and the self-organizing network can be realized. The management page
is shown below. Including the setting of SSID, wireless network mode and wireless security, and the
setting of local area network composed of AP.

18 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Access point settings

4.1.5 WIRELESS TERMINAL SETTINGS PAGE


Wireless terminal interface, also known as STA interface. RS232/485 TO WIFI ETH (B) can be
connected to other wireless networks through the STA interface, as shown in the following figure:

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

Figure Wireless Terminal Interface Settings

4.1.6 SERIAL PORT AND NETWORK SETTINGS PAGE


Application program settings refer to the settings of WIFI to serial port application parameters,
including serial port parameter settings, automatic framing settings, Ethernet function settings, device
registration package settings, and network protocol settings.

Serial Port and Network Parameter Settings

20 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Serial port and network parameters setting

<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.

SocketB communicates with the server as the TCPClient and UDPClient.

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

4.1.7 ETHERNET FUNCTION SETTINGS


This page is used to set the Ethernet port of the module, which can be enabled or disabled.
Moreover, it can be used as a WAN port, so that the module can be used as a secondary router, which
is convenient for users to network. The specific settings page is as follows:

Figure Ethernet function settings page

4.1.8 HTTPDCLIENT MODE PAGE


This webpage sets the contents of HTTP protocol header in HTTPDClient mode, including: server
address, server port, request type, protocol header path, protocol header Connection and protocol
header User-Agent. The size of the transmitted data is 1000 bytes. For details about data transmission
method, you can refer to “HTTPDClient” chapter in this 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

Figure Web Page Setting HTTPDClient Mode

Figure Example of Webpage HTTPDClient Mode Test Settings

4.1.9 MQTT FUNCTION SETTINGS PAGE


This webpage sets MQTT function related parameters, including server parameters to connect to,
publish topic parameters, and subscribe topic parameters. For specific usage of MQTT functions,
please refer to the relevant chapters of this manual titled "MQTT Functions".

24 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Webpage MQTT function settings

4.1.10 MODULE MANAGEMENT PAGE


Module management includes username/password settings, factory reset, and software upgrade
functions.

25 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Module Management Page

<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.

4.2 SOFTWARE CONFIGURATION

4.2.1 DOWNLOAD LINK


WiFi high-performance series configuration software download link:

4.2.2 SOFTWARE INTRODUCTION


The serial server parameter can be queried and configured through a serial connection or by
connecting to the same local network.
This can be done without accessing the web page or manually send AT commands frequently.
The device supports features like one-click firmware upgrades and batch parameter configuration.
The interface might look like the following figure:
26 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Serial Port and Network Parameter Settings

Batch parameter configuration setting and firmware upgrade interface as shown below:

Figure Batch Parameter Configuration Page

27 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

5. PRODUCT NETWORKING APPLICATION


The RS232/485 TO WIFI ETH (B) serial server can be configured as either a wireless STA or an AP.
So RS232/485 TO WIFI ETH (B) logically supports two wireless interfaces, one as an STA and the other
as an AP. Other STAs can be connected to the wireless network through the AP interface of this serial
server. At the same time, the RS232/485 TO WIFI ETH (B) serial port server provides a 100M Ethernet
interface, through which users can achieve interworking of WIFI, serial port, and Ethernet port. In
terms of networking, RS232/485 TO WIFI ETH (B) serial server supports bridging mode and routing
mode to correspond to different specific applications.

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.

5.1 WIRELESS NETWORKING SETTINGS

The relevant AT commands are as follows:

Table wireless networking AT command list

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

Table Socket related AT command list

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

3 TCPPTB Set/query the port number of TCPB


4 TCPADDB Set/query TCPB servers

The webpage configuration is as follows:

Figure Wireless Networking Settings webpage

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:

Set WIFI serial port server to STA mode.

AT+WMODE=STA

restart

AT+Z

After restarting, the serial server works in STA mode.

29 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

(2) The webpage is set as follows:

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:

Figure Webpage Mode Setting WIFI Mode

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.

5.2 WIRELESS NETWORKING APPLICATIONS

5.2.1 WIRELESS NETWORKING APPLICATIONS (AP)


The WIFI serial server is used as an AP, and other WIFI serial servers and computers can be
connected to this WIFI serial server as STA. At the same time, it can also be connected through the
UART interface to the user device, as shown in the following figure:

30 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Access Point (AP)

The WIFI serial server operates in AP mode, and the above application can be set using the
following AT command:

(1) Set the WIFI serial port server to AP mode

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+WAP = 11bgn, waveshare-test, auto (optional)

AT+WAKEY=WPA2PSK,AES,12345678 (optional)

(3) Restart the WIFI serial server:

AT+Z

Complete the parameter setting.

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.

5.2.2 WIRELESS NETWORKING APPLICATION (STA)


RS232/485 TO WIFI ETH (B) serial server is connected to other AP (such as routing in local area
network) as a STA to form a wireless network. All STAs regard this AP as the center of the wireless
network, and the mutual communication between STAs is completed through the AP, as shown in the
following figure:

31 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Wireless networking application (STA)

The parameters of WIFI serial server are set as follows:

(1) Set the working mode of the WIFI serial server:

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

(3) Restart the WIFI serial server:

AT+Z

Complete the parameter setting.

5.2.3 WIRELESS NETWORKING APPLICATION (AP+STA)


The RS232/485 TO WIFI ETH (B) serial server can support both an AP interface and an STA
interface. When the AP+STA function is enabled, both the STA and AP interfaces are available. The
STA interface of the serial server is connected with the router and connected with the server in the
network through TCPB; At the same time, the AP interface can be connected by mobile phone /PAD
(through TCPA connection). In this way, the servers in the network, such as TCPServer and mobile
phone /PAD, can control the serial devices connected to the RS232/485 TO WIFI ETH (B) serial server
or set the parameters of the serial server itself, as shown in the following figure:

Figure Wireless networking application (AP+STA)

The parameters of WIFI serial server are set as follows:


32 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

(1) Enable WIFI serial server AP+STA function

AT+FAPSTA=on

(2) Effective after restoring factory settings

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

AT+WSKEY=WPA2PSK, AES, www.waveshare.com

(5) Set up SocketA and SocketB

Example of SocketA settings:

AT+NETP=TCP, Server, 8899,10.10.100.100.100

Set the IP and port number of the server to connect to (based on actual parameters)

SocketB settings example:

AT+TCPADDB=192.168.1.100

AT+TCPPTB=18899

(6) Restart the WIFI serial server:

AT+Z

Complete parameter settings.

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.

As shown in the figure:

Figure Wireless networking application (AP+STA)

5.2.4 WIRELESS NETWORKING APPLICATION (AP, STA)


The RS232/485 TO WIFI ETH (B) device's wireless functionality can be configured in two modes:
as a wireless Station (STA) or as an Access Point (AP). Logically, it supports two wireless interfaces:
one acting as a STA to connect to an existing wireless network, and the other interface serving as an
AP, allowing other STAs to connect to the wireless network through this device.

AT+TCPPTB=18899

34 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

(6) Restart the WIFI serial server:

The No.1 WIFI serial server works in STA mode and No. 2 works in AP mode:

(1) set the No.1 WiFi serial server as STA.

AT+WMODE=STA

For No.2 WIFI serial server, set it as AP.

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+WAP = 11bgn, waveshare-test, auto (optional)

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+WSSSID=RS232/485 TO WIFI ETH (B)-TEST

AT+WSKEY=WPA2PSK,AES,12345678

Consistent with the parameter setting example of WIFI serial server 2.

(4) Restart the WIFI serial server:

AT+Z

Complete the parameter setting.

5.3 WIRED NETWORKING SETUP

Related AT commands are as follows:

Table related AT command list

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

4 WANN Set/query STA network parameters


5 WSLK Query STA wireless connection status
6 WAP Set/query the parameters in WIFI AP mode
7 WAKEY Set/query the encryption parameters in WIFIAP mode
8 LANN Set/query module IP in AP mode
9 FEPHY Enable/disable the module Ethernet port
10 FVER Set/query module software version (N-Ver, Z-Ver)

Table Socket related RT command list

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

Webpage configuration as follows:

36 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Enable/disable module Ethernet interface

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.

5.4 WIRED NETWORKING APPLICATION

5.4.1 WIRED NETWORKING APPLICATION (APLAN)


When RS232/485 TO WIFI ETH (B) is used as AP, other computers or devices can be connected to
the serial port server as STA through RJ45 (i.e. network cable) and wireless mode, and a network is
formed centering on the serial port server. The IP addresses of all devices in the network work in the
same network segment and can communicate with each other, as shown in the following figure:

Figure Attached Private Local Area Network (APLAN)

Serial server parameter setting:

(1) Enable Ethernet port

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.

(3) Set the serial port server as AP

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

(5) Restart the serial server to complete the parameter setting.

5.4.2 WIRED NETWORKING APPLICATION (APWAN)


The RS232/485 TO WIFI ETH (B) serial server is used as AP, Ethernet port is set as WAN port, and
it is connected to the route that can access the external network, so the DHCP server function is
enabled. The serial server is used as a secondary router, and a PC or other smart handheld device can
access the Internet by connecting to the serial server AP. At this time, the default AP of the serial port
server is usually RS232/485 TO WIFI ETH (B)_xxxx, which has no encryption and can be set through
web pages or at commands.

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):

Figure Attached Private Wide Area Network (APWAN)

Serial server parameter setting:

(1) Enable Ethernet port

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).

AT+WAP=11BGN,B2-WIFI-TEST,Auto (select setting)

AT+WAKEY=WPA2PSK,AES,waveshare (select setting)


38 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

(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!

(6) Restart the serial server to complete the parameter setting.

5.4.3 WIRED NETWORKING APPLICATION (ROUTING)


The RS232/485 TO WIFI ETH (B) serial server as STA, and the serial server works in router mode.
After the serial server is connected to the AP, it obtains the IP address from the AP (as shown in
Figure 192.168.1.101). The serial server itself constitutes a subnet (10.10.100.254 by default), and the
devices on the Ethernet interface are assigned addresses by the serial server (as shown in Figure
10.10.100.101). As shown in this figure, PC1 is in the subnet (NAT), so the connection can be initiated
from PC1 and connected to PC2 (because RS232/485 TO WIFI ETH (B) works in routing mode), but PC2
cannot actively connect to PC1.

Figure Wired and Wireless Networking Application (Routing)

Serial server parameter setting:

(1) Set the serial server software version to N-Ver.

AT+FVER=n

(2) Enable Ethernet interface.

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.

(4) Set the serial server to STA

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)

(7) Restart the serial server to finish the parameter setting.

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:

Figure Network Port Mode Setting

After click “OK”, it reboots.

5.4.4 WIRED NETWORKING APPLICATION (BRIDGE)


The serial server of RS232/485 TO WIFI ETH (B) is STA, and works in bridge mode. After the serial
server connecting to AP, the device of the Ethernet port gets the IP address from the AP (as shown in

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.

Figure Wired and Wireless Networking Application (Bridging):

6. PRODUCT FUNCTION DESCRIPTION

6.1 WORKING MODE

RS232/485 TO WIFI ETH (B) has five working modes:

(1) Transparent transmission mode

(2) Serial Command Mode

(3) HTTPDClient mode

(4) ModbusTCP<=>ModbusRTU mode.

(5) AT Command Mode

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.

6.1.1 TRANSPARENT TRANSMISSION MODE


RS232/485 TO WIFI ETH (B) supports the serial port transparent transmission mode. In this mode,
all the data that need to be sent and received are transparently transmitted between the serial port

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:

Figure Transparent transmission function block diagram

6.1.2 SERIAL COMMAND MODE


In this mode, users can send data to servers according to our protocol, and can send data to
different servers without restarting.

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.

Table Serial command mode protocol

Function Reserved parameter Target Target


Header Length Data Checksum
code area: port address
2
2 1 2 2 m n 1
(n+m+5)

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.

Bit2:(IP:0; Domain name: 1)

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.

Reserved parameter area:

First byte: long connection, here 0x00.

Second byte: reserved

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

The length is variable, and the maximum is 4*1024 bytes.

Checksum:

Starting from the function code and continuing until the byte just before the checksum byte,
perform a summation checksum.

The following are specific application examples:

Send data: 55aa000a00000021008500A8C0010f

Length byte 000a: The length is n+m+5, here it is 10.

Function code 00: UDP mode

The destination IP address is 8500A8C0:192.168.0.133.

Data area 00: length is 1,

Checksum calculation: 0x00+0x00+0x21+0x00+0x85+0x00+0xA8+0xC0+0x01 = 0x0F.

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!

6.1.3 HTTPDCLIENT MODE


In this mode, the user can send the data to the designated HTTP server, and RS232/485 TO WIFI
ETH (B) will automatically add an HTTP protocol header in front of the sent data, and the specific
content of the protocol header can be set through AT instruction or webpage.

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

Figure HTTPDClient functional block diagram

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

Figure POST type data packaging mode

AT command setting:

Table HTTPDClient instruction list

No. Command Note


1 HTPMODESwitching between new and old versions of HTTP header settings (HTTPDClient)

2 HTTPURL Set/query the IP and port of HTTP servers in old version

3 HTTPTP Set/query the HTTP protocol request in old version:

4 HTTPPH Set/query the HTTP protocol header path in old version:

5 HTTPCN To set/query the HTTP protocol header Connection in old version:

6 HTTPUA To set/query the HTTP protocol header User-Agent in old version:

7 HTPSV Set/query server address and IP (HTTPDClient) in new version

8 HTPTP Set/query the request method (HTTPDClient) in new version

9 HTPURL Setup/query request path (HTTPDClient) in new version

10 HTPHEAD Set/query HTTP header (HTTPDClient) in new version.

11 HTTPSCEN Set/query the connection mode of HTTPClient (long/short)

12 HTTPSCT Set/query HTTPDClient short connection timeout (3-65535s)

The following are examples of specific applications:

First, use AT command to set the related parameters of HTTP:

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

If the HTTP type is GET, the data received on port 80 of test.waveshare.com is

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.

The webpage settings are as follows:

(1) set the HTTPDClient request type:

47 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure HTTPD Client request type

(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

Figure HTTPDClient Short Connection Timeout Settings

The user can also set it through the AT command.

(1) Set/query long/short connection of HTTPDClient, taking short connection as an example;

AT+HTTPSCEN=short

(2) Set/query timeout interval (3-65535) seconds in short connection mode; Take 3 seconds as an
example;

AT+HTTPSCT=3

HTTPD POST measured demonstration:

(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

HTTPD GET measured demonstration:

(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

(3)After sending successfully, the following is returned:

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:

6.1.4 MODBUSTCP<=>MODBUSRTU CONVERSION MODE


This serial server supports ModbusTCP to ModbusRTU (ModbusASCII is not supported); The
network parameters of the module should correspond to those of the application software, the
TCPserver should correspond to the TCPclient, and the ports should be configured the same, and the
working mode should be ModbusTCP<=>ModbusRTU.

54 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Modbus RTU<=>Modbus TCP

Set by AT command:

AT+TMODE=modbus

There are also corresponding settings pages in the webpage:

6.1.5 AT Command Mode

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.

6.2 WIRELESS CHARACTERISTICS

6.2.1 AUTOMATIC FREQUENCY SELECTION FUNCTION


When RS232/485 TO WIFI ETH (B) works in STA mode, RS232/485 TO WIFI ETH (B) will
automatically adjust to the same channel as AP according to the wireless channel of AP, and access it.

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.

6.2.2 SECURITY MECHANISM


The RS232/485 TO WIFI ETH (B) serial server supports a variety of wireless network encryption
methods, which can fully guarantee the safe transmission of data, including:

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

Note: The passwords of WPA-PSK and WPA2-PSK are 8-63 digits.

6.2.3 STA JOINS THE ROUTING FUNCTION


The working mode of RS232/485 TO WIFI ETH (B) is set to Station mode. Click the "Search"
button in the "Wireless Terminal Settings" page, and a window will pop up to display the information
of the surrounding AP. After selecting the router, you will return to the original page. At this time, the
encryption mode and encryption algorithm have been filled in, and you only need to write the
password as prompted.

6.2.4 STA ADDRESS BINDING FUNCTION


RS232/485 TO WIFI ETH (B) supports the function of binding the BSSID of the destination
network during the networking process (as STA, during the AP connection process). According to the
802.11 protocol, different wireless networks can have the same network name (i.e. SSID/ESSID), but
must correspond to a unique BSSID address (i.e. MAC address). Because illegal intruders can establish
wireless networks with the same SSID/ESSID to connect STAs in the network to illegal APs, resulting in
network leakage. So by binding BSSID addresses, STA can be prevented from accessing illegal
networks, thereby improving the security of wireless networks.

6.3 SOCKET COMMUNICATION

The working methods of SocketA include: TCP Server, TCP Client, UDP Server, and UDP Client.
Currently, SocketB supports TCP client and UDP Client.

When SocketA is configured as TCPServer, it can support up to a maximum of 24 TCP client


connections in the TCP link. In a multi TCP link connection, data transmitted from TCP will be
forwarded one by one to the serial port. The data coming from the serial port will be duplicated and
forwarded to each TCP connection, resulting in multiple copies being sent to each connected TCP link.
The specific data flow chart is shown as follows:

56 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure multi-TCP link data transmission diagram

SocketA settings: AT+NETP/AT+TCPTO/AT+TCPLK/AT+TCPDIS.

Table SocketA related AT command list

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

Table Socket B Related AT command list

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.

6.4 UART FRAMING MECHANISM

6.4.1 SERIAL PARAMETERS


Table Serial 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

Web page settings

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

Figure Webpage Sets Serial Parameters

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

6.4.2 UART FREE-FRAME MODE


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.

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:

Figure Switch cimmands timing order

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.

6.4.3 UART AUTOMATIC FRAMING MODE


For fixed-length data frames on the serial port, you can enable the UART automatic framing
function, and set the automatic framing trigger time and trigger frame length. RS232/485 TO WIFI ETH
(B) will send the data from the serial port.

The received data is automatically framed and forwarded to the network.

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:

Figure automatic framing trigger frame length

Figure automatic framing departure time

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.

6.5 PASSWORD AUTHENTICATION WHEN TCP ESTABLISHES CONNECTION

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.

Figure RFC2217 automatic baud rate

6.6 DESCRIPTION OF RFC2217 PROTOCOL

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

Attachment: Explanation of the meaning of serial port parameter bit.

Table Query Instructions

Name Header Baudrate Bits Checksum


Bytes 3 3 1 1
Reduce false Three bytes represent a Different bits The checksum of the
Note positives by baud rate value, with therepresent different first four bytes, ignoring
three bytes high byte first meanings, any carry-over
See attached table
Example 55AA55 01C200 83 46
(115200, N, 8,1)
Example 55AA55 002580 83 28
(9600,N,8,1)

Form query reply instruction

No. Name Bytes Note


1 Header 1 Fixed value 0xFF
2 Length 2 The total number of bytes after the length (excluding the length
itself) and before the checksum byte (excluding the checksum
byte).
3 Command 1 Command type, and the reply instruction corresponding to the
code query instruction is 0x81.
4 AP number 1 Number of currently detected APs
5 SSID1 Indefinite The SSID of router 1.
length
6 Terminator 1 The SSID terminator for router 1, with a fixed value of 0x00.
7 Signal 1 The signal strength of router 1 network, ranging from 0 to 100,
strength 1 corresponds to an actual value of 0% to 100%.
8 Terminator 2 Terminator of signal strength 1, 0x0D, 0x0A.
… … … ………
M SSIDn Indefinite The SSID of router n.
length
M+1 end mark 1 SSID terminator of router n, fixed value 0x00.
M+2 Signal 1 The signal strength of router N network ranges from 0 to 100,
strength n and the corresponding actual value is 0% to 100%.
M+3 Terminator 2 The terminator of signal strength n, 0x0D, 0x0A.
M+4 Checksum Bit 1 The cumulative sum of all bytes after the header (excluding the
header) and before the checksum (excluding the checksum).

6.7 FAST NETWORKING PROTOCOL


When the WIFI serial server is operating in AP mode, it will open a UDP port for receiving fast
networking protocol commands, with a port number of 49000. The mobile phone can be directly
62 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).

Table Query Reply Instructions

No. Name Bytes Note


1 Header 1 Fixed value 0xFF
2 Length 2 All bytes after the length (excluding the length) and before the
checksum byte (excluding the checksum byte)
3 Command 1 Command type, and the reply instruction corresponding to the
code query instruction is 0x81
4 AP number 1 The number of APS currently searched
5 SSID1 Indefinite The SSID of router 1
length
6 end 1 Router 1' s SSID terminator, fixed value 0x00
character
7 Signal 1 The signal strength of router 1 network ranges from 0 to 100, and
strength 1 the corresponding actual value is 0% to 100%
8 End 2 Terminator of signal strength 1, 0x0D, 0x0A
character
… … … ………
M SSIDn Indefinite The SSID of router n
length
M+1 End 1 SSID terminator of router n, fixed value 0x00
character
M+2 Signal 1 The signal strength of router N network ranges from 0 to 100, and
strength n the corresponding actual value is 0% to 100%
M+3 End 2 The end character of signal strength n, 0x0D, 0x0A
Character
M+4 Checksum 1 The cumulative sum of all bytes after the header (excluding the
63 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

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

No. Name Bytes Note


1 Header 1 Fixed value 0xFF
2 Length 2 The number of bytes after the length (excluding the length) and
before the checksum (excluding the checksum).
3 Command 1 Command type, 0x02 is the setting command.
code
4 Reserved 1 The default is 0x00.
byte
5 SSID Indefinite The SSID of the router.
length
6 Separator 2 SSID terminator, fixed values 0x0D, 0x0A.
7 Password Indefinite The password of the router.
length
8 Checksum 1 The cumulative sum of all bytes after the header (excluding the
byte header) and before the checksum byte (excluding the checksum
byte).

Table setting reply instruction

No. Name Bytes Note


1 Header 1 Fixed value 0xFF
2 Length 2 All bytes after the length (excluding the length) and before the
checksum bye (excluding the checksum byte).
3 Command 1 Command type, 0x82 is the reply instruction corresponding to the
code setting instruction.
4 Checksum 1 The checksum result of SSID, if the network value corresponding to this
value SSID can be found, is 0x00, if not, the value is 0x00.
5 Checksum 1 The checksum result of the password, if the password format is correct,

64 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

value the value is 0x00, if it is incorrect, the value is 0x00.


6 Checksum 1 The cumulative sum of all bytes after the header (excluding the header)
Byte and before the checksum byte (excluding the checksum byte).

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:

Figure LAN search block diagram

Search protocol process:


1. On another device in the local area network, send the search instruction "www.waveshare.com"
through UDP broadcast (broadcast address: xx.xx.255, port: 48899).
2. After RS232/485 TO WIFI ETH (B) receiving the password, if the password is correct, RS232/485 TO
WIFI ETH (B) enters the configuration mode and sends IP,MAC,MID and VER to the address (unicast,
source port).

65 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Table search reply content

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.

6.9 REGISTRATION PACKET FUNCTION


This function only applies to RS232/485 TO WIFI ETH (B) as TCPClient.
The function of registered CLOUD is to send a registration package consisting of device ID and
communication password when RS232/485 TO WIFI ETH (B) is connected to the server, and the
registration package information is correct, and the server returns.
Registration success information, RS232/485 TO WIFI ETH (B) access to transparent cloud platform.
The USR (User-defined Registration Package) function allows users to customize the content of
the registration package, and the length is limited to 40 characters (supported in UDPClient mode,
and the user-defined registration package is added before each data packet is sent).
There are two ways to register MAC function: one is to send registration information when
connecting to the server for the first time; The other is to add registration information in front of the
data sent each time.
There is only one way to register CLOUD, that is, when connecting to the server, send a
registration package to join Transparent
Cloud.

66 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure data carrying registration package diagram

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

No. Command Note


1 REGEN Set registration packet type
2 REGTCP Registration packet setting
3 REGCLOUD Set/query transparent cloud account and password
4 REGUSR Set/query user-defined registration package content

6.10 CUSTOMIZED HEARTBEAT PACKETS


In the network transparent transmission mode, users can choose to turn on the custom
heartbeat packet function, and heartbeat packet can choose to send it to the network server or the
serial port device. The schematic block diagram is as follows:

67 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure Custom heartbeat packet Functional Block Diagram

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

No. Command Note


1 HEARTEN Query/set whether to turn on heartbeat packet function.
2 HEARTTP Query/set heartbeat packet sending method.
3 HEARTDT Query/Set heartbeat packet Data
4 HEARTTM Query/Set the sending heartbeat packet interval.

6.11 SOCKET DISTRIBUTION FUNCTION


In transparent transmission mode, the socket distribution function is enabled, and the client's
MCU only needs to send data packets according to this protocol format, and the serial server will
parse the received data packets. If it meets the protocol format, the serial server will send the parsed
data to the specified socket connection; If the data does not conform to the protocol format, the
corresponding error code will be returned and will not be sent to the specified socket connection. At
the same time, the data sent by the network will be packaged by the serial server according to the
protocol format and sent to the serial device.
(1) serial device to module data format
The client MCU sends data packets according to the following format. After the module is parsed,
only N bytes of data are sent to the specified Socket connection. When data is returned, the data is
directly output from the serial port without parsing.
Table Serial port sending format

Header Length Parameter area Data Checksum


3 2(n+2) 2 n 1

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 Length Parameter area Data Parity bit


3 2(n+2) 2 n 1

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

No. Return code Description Note


1 0x00 Header error
2 0x01 Data length error
3 0x02 Parameter error
4 0x04 Checksum error
5 0x10 Sending failed (parameters correct but sending failed)

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

Figure Socket Distribution Protocol

6.12 TIMEOUT REBOOT FUNCTION


The "timeout reboot" here means no data restart. In transparent transmission mode, when the
timeout restart feature is enabled, if the module's WiFi is not connected or if WiFi is connected but
there is no communication within the set time frame, the module will be restarted. To enable the
timeout restart feature, follow these AT command setup steps:
(1) Enable timeout reboot function
AT+TIMEOUTEN=on
(2) Set the timeout reboot time, which can be set in the range of 60-65535s, and the default is
3600s. Take 100s as an example;
AT+TIMEOUTT=100
Parameter settings are complete, and they will take effect after the module is restarted.
For example: After setting AT+TIMEOUTT=100, if the module remains without a WiFi connection
within 100 seconds or if there's a WiFi connection but no communication, the module will reboot. If
communication occurs or there is a connection within the 100 seconds, the timer will reset.

Table Timeout Reboot Command List

No. Command Note


1 TIMEOUTEN Enable/disable timeout reboot function
2 TIMEOUTT Query/set timeout reboot time

6.13 TIMED REBOOT FUNCTION


"Timed reboot is equivalent to "reboot after set time", in non-serial command mode, when this
function is enabled, the module will use the internal clock to time, and the module will reboot forcibly
after the set time.
Turn on the timed reboot function. The AT command setting steps are as follows:
(1) Turn on the timed reboot function
AT+REBOOTEN=on
(2) Set the timed reboot time, which can be set from 1 to 720 h, and the default is 24 h;
(3) For example: set 200h and restart the module once, with the following command.
The AT+REBOOTT=200 parameter setting is finished and takes effect after the module restarts.
After taking effect, the module restarts every 200 hours.
Table Scheduled Reboot Command List

No. Command Note


1 REBOOTEN Enable/Disable the scheduled reboot function
2 REBOOTT Query/Set the scheduled reboot time

6.14 MOD BUS POLLING

72 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

(1) The webpage configuration is shown below:

Figure Modbus Polling Web Page Configuration Screenshot

(2) AT commands setting:


Enable or disable the Modbus polling feature, and enable the Modbus polling function.
AT+MODBPOLLEN=on/off
Set the polling interval for querying (50~65535) milliseconds, using 200ms as an example.
AT+MODBPOLLT=200

6.15 KEEPALIVE FUNCTION


With the addition of a Keepalive mechanism during TCP connections, RS232/485 TO WIFI ETH (B)
can promptly detect network anomalies and disconnect when there's a network issue. Once the
network is restored, it can swiftly reconnect to the server.

6.16 WEBSOCKET FUNCTION


This WIFI serial server can realize the function of websocketserver. It can make the serial port of
WIFI serial server interact with the web page in real time, instead of the earlier HTTPGET, POST and
PUT modes, and the response speed is faster. This WIFI serial server provides a corresponding
websocket test page for users to test, and the specific page is as follows: (The address of this page is
10.10.100.254/websocket.html).

6.17 MQTT FUNCTION

6.17.1 MQTT FUNCTION INTRODUCTION


MQTT is a protocol for message publishing//subscribe transmission based on the client servers.
The MQTT protocol is lightweight, simple, open, and easy to implement, which makes it highly
versatile and applicable in a wide range of scenarios.
The MQTT function settings of RS232/485 TO WIFI ETH (B) are highly flexible, allowing you to
configure almost all MQTT protocol-related connection parameters, publish topic parameters, and
subscribe topic parameters.
RS232/485 TO WIFI ETH (B) MQTT's publish topic modes include Pure Transparent Publish Mode
(serial port can transparently publish data to all topics), Special Identifier Publish Mode (serial port
can transparently publish data to specific topics using identifiers), and Custom Topic Publish Mode
(serial port can transparently publish data to specified topics).
73 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).

6.17.2 RS232/485 TO WIFI ETH (B) PARAMETER CONFIGURATION


The AT command settings are as follows in the table below:
Table MQTT-related commands

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

Web page settings


On the "MQTT Function Settings" page, configure the MQTT function parameters as follows:

74 www.waveshare.com
RS232/485 TO WIFI ETH (B) User Manual

Figure MQTT function settings page

75 www.waveshare.com

You might also like