Introduction to the design of Linux Remote Monitoring System

Source: Internet
Author: User

The quality of life has been greatly improved, mainly depending on the development of science and technology. Many technology products emerge one after another. Here we mainly explain the design of the Remote Monitoring System Based on Embedded Linux. Embedded Linux has many advantages. Due to its excellent portability, Linux has been successfully run on hundreds of hardware platforms. The following describes the design of the Remote Monitoring System Based on Embedded Linux.

1 Introduction

Single-Chip Microcomputer and microcontroller have been widely used in the field of industrial control, but these control systems usually adopt RS232 or RS485 networking, with short operation distance. Nowadays, the rapid development of Internet has become an important channel for information exchange. Moreover, the Web-based B/S remote monitoring technology is becoming increasingly 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. When it is applied to the household, it 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 extensive application of embedded systems, embedded operating systems are becoming more and more important. The embedded operating system has the characteristics of small structure, strong real-time performance, and high stability. At present, there are many commercial embedded operating systems, such as Vxworks, QNX, nucleus aus, and WinCE, but they are expensive and not suitable for a wide range of applications.

Embedded Linux provides a good solution to this problem. Its open source code, powerful technical support, good scalability, and support for many hardware are all advantages of its embedding. Therefore, we choose Embedded linux as the operating platform, and use mature Web technology to design a remote monitoring system.

2. System Structure

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

Both solutions use Internet/Intranet network resources. The difference is that in solution 1, a PC is used as the proxy server to access the Internet, so that the proxy server can provide powerful database functions. This solution is suitable for scenarios where many measuring devices are relatively concentrated. The embedded device can be directly connected to the server through an ethernet cable. In this way, the embedded device only needs to implement one Ethernet to RS232 conversion. However, in some embedded application environments, it is not suitable to use a single PC as a Server. Therefore, we propose solution 2. As a Web Server, embedded devices can directly access the Internet/Intranet. Embedded devices run an operating system and implement WebServer functions on this basis. This requires a high level of hardware, coupled with the immature technology of small embedded databases, this makes it a little lacking in data management. Even so, we still adopt solution 2, because we think it represents the development direction of embedded systems, and its application scope is more extensive. With the continuous improvement of software and hardware, all of the above shortcomings can be overcome.

In our solution, the hardware uses 32-bit Motorola microprocessor, 2 M Flash, 16 m sdram, and necessary peripheral devices to meet the system requirements.

3 System Software Design

3.1 Linux Selection

Because Linux is too large, to apply it to a small embedded system, it must first be miniaturized. At present, a variety of Embedded Linux versions have emerged, some of which are also real-time. First, based on the selected CPU type and open Embedded Linux source code, we compile the corresponding bootloader program or BIOS Based on the motherboard we designed to run our own system. Once embedded Linux is loaded, the programming of upper-layer application software is the same as running on a PC running Linux. All programs can be debugged on a Linux PC first, then, you only need to modify the MakeFile file to completely port it to an embedded Linux device. If you select Network File System NFS when compiling embedded Linux, you can use gdbserver during debugging, saving the trouble of downloading programs countless times. This method has great flexibility and freedom, but it should be noted that the source code downloaded from the Internet may not be suitable due to different hardware configurations or program reasons, this requires debugging and Discovery Based on the source code.

3.2 Application Design

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

The two-layer structure-Based C/S mode cannot adapt to the characteristics of the Internet, so a new architecture-B/S mode emerged. 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 the Web server. The B/S mode is easy to use, easy to maintain, and has become the mainstream.

3.2.2 client Working Process

The system uses the B/S mode and has little special requirements on clients. You only need to install IE or Netscape on the client based on the common Windows system. In other words, any computer that accesses the Internet may become a client.

The client's working process is as follows: access the home page of the monitoring center through the Internet/Intranet, enter the user name and password as needed, and enter the Web Server monitoring interface if the verification is successful, click the corresponding device button to get the running status of the device and set the parameters of the device.

3.2.3 server-side Program Design

1) Server Mode

To design the server-side program, you must first determine the server's working model. We know that Linux network servers are mainly divided into two types: cyclic Server Iterative Server) and Concurrent Server ConcurrentServer ). The cyclic server can only process one client request at a time, while the concurrent server can process multiple client requests at a time. Most TCP sockets use concurrent servers to provide services. TCP concurrent server has multiple implementation methods:

◆ The server creates a new sub-process for each received client connection to process customer requests;

◆ The server creates multiple sub-processes in advance to process client requests. This method is called "pre-create prefork)" server;

◆ The server uses the select function to achieve multiplexing of multiple client connections;

◆ Activated by the super server Inetd.

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

The number of clients that the server can simultaneously process is limited by the maximum number of sub-processes allowed by the system. The disadvantage of this type of server is that it is costly to create a sub-process for each customer. But if we can take into account the actual situation and make appropriate changes, we will find that it is very suitable for our system. First, the system is a monitoring system, which determines that there will not be too many customers sending monitoring commands at the same time, so there is no need to worry about system resource depletion. Second, once the customer monitors, it usually lasts for a long time. The overhead of this sub-process creation has little impact on the server efficiency. Finally, if the system runs on the Internet, there may be many external attackers who want to enter, in order to reduce the overhead, the system design does not create a sub-process once a connection is established, but creates a sub-process only when the password passes and an ASP request is sent to the system.

2) Program Design

According to our solution, what the Server needs to do is: send and receive device data through serial port; process the data; send the processed data to the Web Server subprocess; the sub-process displays the data on the web page and sends it to the customer. It receives the parameter setting command from the customer and uploads the parameter settings to the remote device.

As shown in server program structure 4, the parent process first creates a sub-process to process data, and then creates the corresponding sub-process based on user requests. User sub-processes and serial data processing sub-processes use inter-process communication to achieve data exchange.

The first thing after the server is started is to create a dedicated sub-process to send and receive data. The server listens to user requests at any time. If a user sends a monitoring request and passes password verification, the server generates a sub-process to process the user's request: sending data, receiving settings, and so on.

4 Conclusion

In the information society, people can use network resources to quickly and conveniently obtain information and use network resources for remote monitoring of various devices. The Remote Monitoring System Based on Embedded Linux has been implemented in a small LAN. This system has good application prospects in industrial field, remote diagnosis, and Information appliances.

The above is the design based on the embedded Linux Remote Monitoring System. I hope it will help you.

  1. Easy understanding of Linux shutdown commands
  2. Describes how to enter and exit a Linux operating system
  3. Describe Linux operating system deficiencies and Development Trends
  4. Introduction to Linux Application Scope
  5. This gives you a better understanding of common Linux software.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.