Design of the most popular remote monitoring syste

2022-09-22
  • Detail

Design of remote monitoring system based on Embedded Linux

1 introduction

single chip microcomputer and microcontroller have been widely used in the field of industrial field control, but these control systems usually use RS232 or RS485 groups, with short operating distance. Nowadays, with the rapid development of Internet, it has become an important channel for information exchange. Moreover, the technology of B/s remote monitoring mode based on web is becoming more and more mature. If this mode is applied to the field of industrial field control, users can remotely monitor industrial field equipment as long as there is Internet access. Applying it to the family can take a key step towards the informatization of household appliances

the implementation of the above system is inseparable from the embedded operating system. In the post PC era, with the wide application of embedded systems, embedded operating systems have been paid more and more attention. Embedded operating system has the characteristics of compact structure, strong real-time performance and high stability. At present, there are many commercial embedded operating systems, such as VxWorks, QNX, nucleus, wince, etc., but they are expensive and not suitable for wide application

embedded Linux provides a good solution to this problem. Its open source code, strong technical support, good scalability and support for many hardware are its embedded advantages. Therefore, we choose embedded Linux as the operating platform, combined with mature web technology to design the remote monitoring system

2 system structure

the remote control system can monitor and control the status of remote devices by using Internet/Intranet network resources and only one connected PC client. Here, we propose two design schemes of the system structure, as shown in Figures 1 and 2

both schemes make use of Internet/Intranet network resources. The difference is that in scheme 1, a PC is used as a proxy server to access the Internet network, so that the proxy server can be used to provide powerful database functions. This scheme is applicable to the occasions with more and relatively centralized measuring equipment. The embedded device can be directly connected to the server through Ethernet cable, so the embedded device actually only needs to realize a conversion from Ethernet to RS232. However, in some embedded application environments, it is not suitable to use a PC as a server alone. Therefore, we propose scheme 2: the embedded device is directly connected to the Internet/Intranet as a web server. Embedded devices run an operating system and realize the function of webserver on this basis, which requires relatively high system hardware. Coupled with the immaturity of small embedded database technology, it is slightly deficient in data management. Nevertheless, we still adopt scheme 2, because we think it represents the development direction of embedded system, and its application range is wider. Moreover, with the continuous improvement of software and hardware, the above shortcomings can be overcome

in our scheme, 32-bit Motorola microprocessor, 2m flash, 16m SDRAM and necessary peripheral devices are used in the hardware to meet the requirements of the system

3 system software design

3.1 choice of Linux

because Linux is too large, to apply it to small embedded systems, we must first miniaturize it. At present, there are various embedded Linux versions, some of which have certain real-time performance. First, according to the type of CPU we choose, based on the open embedded Linux source code, we write the corresponding bootloader program or BIOS according to the motherboard we design, and run our own system. Once the FGH systems mold workshop is loaded with embedded Linux, the programming of the upper application software is the same as that on the PC running ordinary Linux. All programs can be debugged on the PC running Linux first, and then they can be completely transplanted to the embedded Linux device by modifying the makefile file. If network file system (NFS) is selected when compiling embedded Linux, GDBSERVER can be used during debugging, which saves the trouble of downloading programs countless times. This method has great flexibility and freedom, but it should also be noted that due to different hardware configurations or the program itself, the downloaded source code may not be appropriate, which needs to be debugged and discovered by comparing the source code

3.2 application program design

3.2.1 C/S (client/server) mode and B/S (Browser/server) mode. The traditional C/S mode adopts two-tier design. The customer application layer is responsible for providing an interactive interface and implementing application logic to send data, request and process the returned data; The database server layer is responsible for processing customer data requests and returning results, and effectively managing system resources. This mode requires independent development and installation of each application. It is difficult to upgrade and maintain the system, and the client bears a heavy burden. In addition, the direct interaction with the database leads to the strong dependence of the application on the data structure, and wastes the database connection resources

the C/S mode based on the two-tier structure cannot adapt to the characteristics of the Internet network, so a new architecture B/S mode appears. B/S is a three-level or multi-level C/S based on hyperlink, HTML and Java. The client only needs a single browser software, and a lot of other work is done by web server. The cost of B/S mode is also higher than that of ordinary plastic bags. It is simple to use, easy to maintain and has good scalability, and has gradually become the mainstream

3.2.2 client working process

the system uses B/S mode, and there are almost no special requirements for the client. As long as the client is based on ordinary windows system, install IE or Netscape. In other words, any computer on a computer can become a client

the working process of the client is as follows: access the home page of the monitoring center through the Internet/Intranet network, enter the user name and password as required, and enter the monitoring interface of the web server system if the verification is successful. Click the corresponding device button to obtain the running status of the device and set the parameters of the device

3.2.3 design of server-side program

(1) server mode

in order to carry out the reason of server-side program: design, first of all, determine the working model of the server. As we know, Linux system network servers are mainly divided into two types: iterative server and concurrent server. The circular server can only process one client request at a time, while the concurrent server can process multiple client requests at the same time. TCP sockets mostly use concurrent servers to provide services. There are many ways to implement TCP concurrent server:

the server creates a new sub process for each received client connection to process the client request

the server creates several sub processes in advance, and these sub processes process the request of the client. This method is called prefork server

the server uses the function select to multiplex multiple client connections

a server activated by a super server (inetd)

among them, the server model of a child process corresponding to a client is very simple. The parent process completes the tasks of receiving connections and creating child processes. The child process processes the specific requests of the client, and the processing process of each child process is completely independent

the number of clients that this server can process at the same time is limited by the maximum number of sub processes allowed by the system. The disadvantage of this server is that it costs a lot to create a sub process for each client. But if we can consider the actual situation and make appropriate changes, we will find that it is very suitable for our system. First of all, the system is a monitoring system, which determines that not too many customers will send monitoring commands at the same time, so there is no need to worry about the exhaustion of system resources; Secondly, once the customer monitors, it will generally last for a long time, and the cost of creating sub processes has little impact on the efficiency of the server; Finally, if the system is running on the Internet, there may be many foreign curious people who want to enter. In order to reduce the cost, in the system design, the sub process is not created once the connection is established, but when the password passes and sends an ASP request to the system, the sub process is established

(2) program design

according to our scheme, what the server needs to do is: send and receive data from the device through the serial port; Process the data; Deliver the processed data to the web server subprocess; The subprocess displays the data to the web page and transmits it to the customer, receives the customer's parameter setting command, and uploads the parameter setting to the remote device

the server program structure is shown in Figure 4. The parent process first creates a child process to specifically process data, and then creates the corresponding child process according to the user's request. Interprocess communication is used between user subprocess and serial port data processing subprocess to realize data exchange

the first thing after the server starts is to create a special sub process to send and receive data. The server listens to user requests at all times. If a user sends a monitoring request and passes the password verification, the server will generate a sub process to process the user's request: send data, receive settings, etc

4 it clearly shows and distinguishes various forms of abrasive particles, such as flakes, spirals, rolls, curves, spheres and scales.

in the information society, people have been able to use network resources to obtain information quickly and conveniently, and to use network resources for long-range monitoring of various devices. The scheme of remote monitoring system based on Embedded Linux proposed in this paper has been implemented in a small local area network. The system has a good application prospect in industrial field, remote diagnosis and information appliances

Copyright © 2011 JIN SHI