This paper introduces the principle, product series and usage method of the IOT solution of ZLAN P2P.
P2P is short for Peer to Peer, in computer network communication P2P is relative to the server/client mode, usually in server/client mode there has a powerful server accepting a lot of client connections. When the client needs to communicate with each other, it needs to be forwarded through the server. This pattern is a great test for the CPU capacity and bandwidth of the server when the client scale is extended to a certain extent. P2P technology enables direct communication between clients to achieve the so-called peer-to-peer (P2P) direct communication, while the load of the central server is significantly reduced.
As shown in figure 1, even though the P2P structure also has a "P2P authentication server", but the server just does the role of authentication and bridge at the early stages of the two clients need communication, the actual data interaction is done directly between the Clients.
The downloading tools in Internet application such as BitTorrent, eMule, VOD PPLive, thunder, instant messaging tool as SkyPe and QQ all use this technology. With the rise of the Internet of things, Shanghai ZLAN bring the P2P technology in to IOT, and successfully developed the P2P single chip solution, make P2P hardware, modular to realize stepping out an important step of the IOT concept, this solution has been applied for national invention patent, counterfeit will investigate.
The advantages of IOT using P2P technology:
1) In the Internet of things applications, the number of nodes connected to the network is large. At this point, P2P technology can effectively reduce the load of the center node.
2) Solve the problem of access to Intranet device. The collection and control devices in the IoT application are generally in an Intranet, and there are usually two ways to access this internal network device through the Internet. a) "dynamic domain name" + "port mapping". b) erecting the server for forwarding.
As shown in figure 2, assuming that there is an IoT intelligent gateway, it works in the TCP server mode, it has a network IP address 192.168.1.200, it is access the Internet through a router, the intranet IP of router is 192.168.1.1, the outer net IP is 116.1.2.3. When the user's mobiles phones in the outdoor want to access intelligent gateway through 3G/4G (Internet) the user actually don’t know the IP address of the current router, because this address changes at any time, here you need to use dynamic DNS, such as login dynamic DNS software (some router inside also supports dynamic DNS) on an intranet computer, the user mobiles phones may be able to realize access router through accessing the domain name like abc.gicp.net, but in order to let a router forward the data to the IoT intelligent gateway, it also need to do a "port mapping" on the router. However, some routers (such as telecommunication custom gateways) simply cannot allow login router to configure, and the configuration also requires a strong professional knowledge. Using the ZLAN P2P scheme, P2P technology can directly penetrate the router and establish communication between mobiles phones and smart gateway, eliminating the trouble of "dynamic domain name" + "port mapping".
Another way is that user rent a server on the Internet, and change the IoT Intelligent gateway to TCP Client mode to connect the server, the mobiles phones also connect to the server and through the server forwarding, actually it is the traditional central server shown in figure 1. But:
1) Additional costs are required to erect the server, including rental and technical maintenance costs.
2) It requires users to develop a set of Client/Server programs on the server, and the system development and maintenance costs are relatively high.
To use the P2P scheme of Shanghai ZLAN you can buy ZLAN P2P chip or relative hardware products, you can get free computer software without the need of development and leasing server. Low input cost, stable product maturity.
3) Some projects, such as remote PLC monitoring and DOS system there may possibly only a few monitoring points, do not need to build a single server for these independent projects. In particular, when this collection point is communicating via 3G/4G DTU, there is no fixed IP and it is difficult to install the dynamic domain name software. It is very convenient to use the P2P based 3G/4G DTU ZLAN8343N.
Features of ZLAN P2P products:
1) P2P schemes specially designed for IoT, mainly provide hardware, including 3G, 4G, Ethernet, Wifi, single chip, module and other P2P products. At the same time, also provide the corresponding SDK and procedures.
2) With years of P2P research results, it has advanced P2P gateway penetration algorithm.
3) Support multi-host access, that is, when multiple users request data from the device at the same time, there will be no confusion. The data will be sent to the required users in sequence.
4) Support Modbus TCP function. The P2P remote Modbus gateway function is realized on the basis of the general Modbus TCP to RTU device. The storage Modbus gateway, which is automatically collected and stored in the device, speeds up access/response.
5) Support the user name and password access device, realize the ownership management of the device, and prevent unauthorized user access.
6) When computer do communication, support virtual serial port, suitable for all kinds of industrial communication and remote data acquisition system. If the user used serial port software to communicate, the original software no need be modified.
7) Support computer (ZLVircom software), androids mobiles phones, ioses mobiles phones connect the device, and provide mobiles phones lib development library.
8) A device can establish multiple P2P connections, and a P2P computer software can connect multiple devices. A P2P connection can support simultaneous establishment of multiple TCP connections.
9) After the establishment of P2P, it supports remote management, setting up and searching device, convenient to configure device name, baud rate, etc.
10) Support P2P and traditional TCP server sharing. When a device in a P2P communication, at the same time, the user can also use traditional TCP tools and software to initiate TCP connection to the device IP port, that is to say, the usage of new P2P products compatible with the old software. In addition, if the search to the device is within the LAN, the TCP connection can be directly established, no need to connect via P2P.
The series of ZLAN P2P products include hardware and chip, SDK, development board and computer software. P2P devices fall into two categories: one is to transmit the network data to the device of RS232/485 serial port; Another is the one has the ability to forward data from the network to the network device with another IP in the LAN.
The first category consists of most products, connecting the serial port equipment (RS232, RS485, UART) to the serial port of P2P products and P2P chips, and the P2P upper computer software can communicate directly with this serial port. Each of them has a unique ID in the world. When users need to use P2P to communicate, they can set up P2P connection with the device as long as they fill in the ID on the mobiles phones and computer. At this time, the data sent from the mobiles phones and computer will be output from the RS232/RS485/UART serial port of the hardware product, and the data received from the serial port will be sent to mobiles phones and computer. The ZLVircom tool can do communication through virtual TCP port or virtual serial port in computer end, in the mobiles phones it can do communication through ZLAN P2P SDK.
The second type, shown in figure 3, is the N2N product, it is generally used to proxy forward the data of network devices on TCP server side in the LAN, and realize the Internet transmission based on P2P. It is especially suitable for the monitoring of Ethernet port PLC.
Finished products include: 3G/4G, Ethernet, Wifi. The model of 3G/4G products is ZLAN8303N and ZLAN8303N-5. In general, 3G/4G DTU will communicate via the central server, and the data will be sent to the server. At this time, DTU is used as the TCP client. No need to build the server after using the P2P, as long as the add the ID of ZLAN8303N on the upper computer it can communicate with the serial port of 8303N. Besides 3G/4G, 8303N also has Ethernet communication function.
ZLAN5103N /ZLAN5143N are Ethernet P2P to serial port products, as long as access to Ethernet there can do transmit and receive communication remotely with 5143N.
ZLAN7144N is similar to ZLAN5143N, but it has both wifi and Ethernet communication modes.
In order to be able to turn users' serial devices and network devices into P2P devices, ZLAN provides P2P chips ZLAN1043N and P2P modules.
The chip realizes the Ethernet based on P2P to UART, which can be integrated into the user's device conveniently and cheaply. The P2P module is divided into Ethernet interface and WIFI/ Ethernet dual interface. The user can choose according to the need, the model is ZLSN2043BN and ZLSN7044N respectively. The design of the module solution is simpler than the chip.
The N2N product is called net-to-net for short. The model is ZLAN7144N2. It realizes access to the original Intranet device, while other P2P products are access to serial port devices or P2P to serial port. In particular, it can be downloaded and upgraded with the PLC program of Intranet. As shown in figure 3, when there is a Ethernet port PLC need to access by Internet, put a ZLAN7144N2 in the LAN which PLC is in, at this time the user can access the PLC in any place with network, no need to do any configuration of the intranet router.
If the user wants to construct a complete P2P system for convenient to maintain and manage, he can purchase ZLAN P2P server program. ZLAN provides detailed server configuration methods, steps and training. The advantage of buying P2P server software is that users can manage their own device ownership and password. No need to add device ID, registered users, with good customer brand identity.
In order to be able to easily develop the mobiles software based on P2P hardware, ZLAN provides the SDK for P2P mobiles phoness. There are androids and ioses platforms, and the SDK contains not only library files and instructions, but also a complete use case based on the library. For simple applications, just a little bit of modification on the basis of the examples can become a P2P mobiles phones software.
For users to quickly test and verify the function of P2P module and the P2P chip, then develop. ZLAN provides the development board of P2P SDK. Combined with the mobiles phones library, the remote intelligent acquisition and control system can be developed. Refer to the development board specification. The development board has key input, analog quantity acquisition, temperature acquisition input, relay output and so on. It is embedded with 51MCU, 51MCU serial port connect with serial port of P2P module. It is convenient for users to develop their own SCM control program.
This is a P2P device management and P2P virtual serial port tool in Windows version. In this software it can add P2P device ID, bind the ID with a virtual serial port (such as COM5), so that user’s software can open COM5 can communicate with the RS485/232 device connecting to the serial port of the P2P products. Through zlvircom tool, you can remotely modify the parameters of P2P devices, such as baud rate, etc., or through the P2P remote upgrade program.
This software is a P2P management software on the mobiles phones, which realizes the similar functions of ZLVircom, but it runs on androids and ioses phoness, and it does not have virtual serial port functions. The mobiles configuration software of the user can establish a TCP connection with the remote P2P devices through this software, especially for the establishment of Modbus TCP communication to collect the register of remote equipment.
There is no need to set on device end of P2P products. As long as the device is power on, the device will get an IP address from the network, and the device will wait for the remote ZLVircom and other software to communicate. If the device is ready, the LINK light of the device will be flashing blue, which will facilitate the user to check whether the device is in normal condition.
If you need further configuration, please note the following points:
1) Users can close and open the P2P function by themselves: the method is to use ZLVircom search device to enter the device edit dialog box. Click "more advanced setting" and select or cancel the "enable P2P".
2) Note that the general working mode needs to be selected as TCP Server mode, otherwise the P2P function will be disabled automatically.
3) Please pay attention to the setting of serial port parameters such as the correct serial port rate.
Run ZLVircom_p2p_pc software with P2P function on the computer, enter the device management interface of ZLVircom. Click "P2P device" to pop up the P2P device adding dialog box.
Click the add button to pop up the P2P device dialog box.
Enter the device ID, user name and password. The simulation port is a virtual TCP port on the local computer so that the user software on the computer can connect to the virtual port and send and receive data from the remote serial port. Click the “add” button. After a while, you can see that the status of P2P has become "Intranet" (whether "Intranet" needs to be determined according to the network situation).
At this point, click back, and then click auto search to manage and modify P2P devices like local LAN devices. Note that the type of P2P device is displayed as "manual".
ZLAN P2P supports multiple users to add an ID, and it can also allow multiple TCP connections to the same simulated port.
If you do not want to access P2P devices via a simulated TCP port, but use virtual serial port to access devices, the setting method is similar to normal serial port servers. As select a device in the device management dialog box, enter the device edit dialog box, and bind the device to a virtual serial port (such as COM5). ZLAN P2P virtual serial port also supports adaptive serial port parameters.
In many applications, such as smart home applications, require multiple users to ask for data of a serial port device (namely the device the serial port of ZLAN P2P products connect to), here need to return back the data to the inquisitor accurately. It cannot use the simple solution that generate the return data and return to everyone. You need to enable multiple hosts function at this point. The enabled method is to enter the "more advanced setting" of the device edit dialog box, check the RS485 multi-host support, and fill in the multi-host time of 256ms.
Modbus gateway is a converter to convert Modbus RTU (generally RS485/232 communication) to Modbus TCP (Ethernet /Wifi, etc.). At the network end, Modbus gateway is a TCP server, so it is difficult for traditional methods to access Modbus gateways via the Internet.
The ZLAN P2P series products all support Modbus gateway function, that is, when it is Modbus gateway, it can still do communication via remote P2P. When you need to set up the Modbus gateway, enter the device edit dialog box and select the transformation protocol as "Modbus TCP to RTU" in the advanced option.
Through the above introduction, I believe that readers have a general understanding of ZLAN P2P solution. Here are a few examples of typical applications.
A smart home company, before adopt the smart home gateway by way of TCP server, while users can use phones to access at home smart home gateway, but if in the outdoor accessing smart home gateway is more troublesome. At this time, the embedding ZLAN1043N single chip into the smart home gateway, can easily upgrade the original mobiles phones software with the androids and ioses phones library of ZLAN. There is no need to worry that some users' routers will not be able to do port mapping. Due to the high number of P2P devices, users hope to set up a P2P authentication server, and users can build all their complete P2P systems after purchasing P2P server software from ZLAN.
The company uses the mobiles phones configuration software to monitor an agricultural IOT project, including the temperature of the agricultural greenhouse and the control of irrigation. However, this mobiles configuration software cannot access the Internet gateway via 3G/4G access. At this time, ZLAN 5143N is adopted to connect various Modbus RTU meters and controllers. Run mobiles-end P2P management software ZLP2PSDK on the phones,user can easily monitor the status of agricultural greenhouses in any place.
The machine is equipped with all kinds of PLC and touch screen, the PLC and touch screen both have the serial port and Ethernet port. In order to upgrade and debug the program, it often needs to send engineers to the site for debugging. After installing ZLAN5143N, you can remotely debug and upgrade the serial port PLC and serial port screen. After installing ZLAN7144N2, you can remotely debug and upgrade the screen. It saves the trouble of travelling.
A company does field geology disaster and safety alarm project, because in the field must use 3G/4G network. But the IP address of the 3G/4G network is changing and needs to adopt the uploading to server method. However, there are only a few data collection points in this project, and it is not cost-effective to rent one server and high maintenance costs. After installing the 3G/4G DTU ZLAN8343N in basis of P2P on site, the problem was solved immediately, and the cost was low, the implementation was convenient, and the maintenance cost was low.
In an electronic creative contest of a university, a team needs to make an automatic watering system, which is to automatically control the watering system of the balcony in the family through the mobiles phones and computer software. Since it is an innovative and entrepreneurial project, the network control part of the system needs to be realized with the lowest cost, the most direct and the simplest way. The traditional TCP to serial port method is difficult to implement the external network access intranet device. The team used the P2P development board, which has its own relay on the P2P development board, which can control the watering machine. Make a slight modification on the demo base of ZLAN mobiles P2P, and send the control instructions you want. Using the development board, the team quickly implemented the innovation project.