Design of an Embedded Remote Measurement and Control System Based on ARM Linux
2026-04-06 03:31:32··#1
Preface Currently, most remote monitoring and control systems utilize 8/16-bit microcontrollers for hardware and assembly language programming for software, which typically contains only a simple loop control flow. Communication between microcontrollers (or host computers) is achieved through RS232, RS485, or CAN bus to form a local area network, with a PC acting as a web server for communication with the Internet. Such remote monitoring and control equipment is costly, bulky, slow, and consumes a lot of power. Now, the price of 32-bit embedded CPUs has decreased, and their performance has improved, making the widespread application of embedded systems possible. Based on the above, we apply embedded systems to remote monitoring and control systems, significantly improving system performance while reducing cost, power consumption, and size. Embedded systems are generally developed using embedded operating systems. Regarding the selection of embedded operating systems, Linux is a better choice because it has complete open-source code, allowing for system modification and optimization, kernel stability, compatibility with various CPUs and hardware platforms, and network support. The ARMlinux-based embedded remote monitoring and control system proposed in this paper can not only realize local data acquisition and control, but also realize remote monitoring and control tasks. 1. Hardware System The hardware system is shown in Figure 1. The S3C2410 contains a 16/32-bit RISC (ARM920T) CPU core with a main frequency of 200Hz. It internally contains an 8-channel 10-bit AD converter and a large number of I/O ports, an LCD controller, and other rich interfaces. It can run Ucosll, ARMlinux, and WinCE embedded operating systems. The DM 9000 is a 10M/100M Ethernet interface control chip. This hardware system has a simple structure, low cost, and can directly connect to the Internet without a PC. 2. Software System The embedded operating system is the core of the entire embedded system. This system chooses the ARMlinux system. Due to the small storage capacity of embedded systems, the ARMlinux operating system needs to be customized to fit within the limited memory. Many resources discuss this, so it will not be repeated here. The following mainly introduces the design of the remote monitoring and control software based on the operating system. Its architecture is shown in Figure 2. 2.1 Boa-based Web Servers Embedded Linux systems primarily use three web servers: Hapd, Thttpd, and Boa. Hapd is the simplest web server, with the weakest functionality, lacking authentication and CGI support. Thttpd and Boa both support authentication, CGI, and other comprehensive features. Boa is a small, single-task Hapd server with open-source code and excellent performance, making it particularly suitable for embedded systems. The following describes the porting and compilation of Boa. For embedded Linux systems with an MMU, after downloading Boa to the Red Hat host machine, extract it to any directory and modify the compiler settings in Boa/src/Makefile. For example: CC=/opt/host/army41/bin/armv41-unknown-linux-gcc CPP=/opt/host/army41/bin/armv41-unknown-linux-g++ Afterward, simply execute `make` in the Boa/src directory to generate the Boa executable file. After copying it to the bin directory of the ramdisk's mount point, add the configuration file and HTML/CGI file, then redo the ramdisk. The Boa.conf configuration file is described below. It should be noted that Linux application configurations are provided in the form of configuration files, usually placed in the target board's /ete/ directory or /ctc/config directory. However, Boa's configuration file, Boa.conf, is generally placed in the target board's /home/httpd/ directory. The Boa.conf file for this system is written as follows: ServerName SAMSUNG—ARM DocumentRoot /home/httpd/cgi—bin/ ScfiptAlias/index.html /home/httpd/html/index.html. This specifies that the HTML page index.html must be placed in the /home/httpd/html directory, and the CGI executable file must be placed in the /home/httpd/cgi~bin directory. 2.2 CGI Program Technology Principles CGI (Common Gateway Interface) is a standard interface for external extended applications to interact with WWW servers. External applications written according to the CGI standard can process data input by the client's browser, thereby completing the interaction between the client and the server. The CGI specification defines how the web server sends messages to the extension application and how it processes the information received from the extension application. CGI can provide many functions that static HTML pages cannot achieve. The working principle of the WWW and CGI is as follows: The HTTP protocol is the foundation of the WWW, based on a client/server model. A server can provide services to clients distributed throughout the network. It is a "connectionless" protocol built on top of the TCP/IP protocol. Each connection handles only one request. When a request arrives, a child process is created to serve the user's connection. Depending on the request, the server returns an HTML file or, through CGI, invokes an external application and returns the processing result. The server interacts with external programs and scripts through CGI. Depending on the method used by the client when making the request, the server collects the information provided by the client and sends this information to the designated CGI extension. The CGI extension processes the information and returns the result to the server. After analyzing the information, the server sends the result to the web client. External CGI programs communicate with the WWW server, exchanging parameters and processing results via environment variables, command-line arguments, and standard input. The server provides a channel for information exchange between the client (browser) and the CGI extension. Client requests are transmitted from the server's standard output to the CGI's standard input. After processing the information, the CGI sends the result back to its standard input, and the server then sends the result back to the client. 2.3 The server program can receive information through three methods: environment variables, command line, and standard input. The specific method used depends on the client's configuration.