With the development of network technology and embedded technology, combining embedded systems with the Internet for data and image monitoring and management has become one of the important research directions. Embedded Web network sensor technology is a technology that combines sensor, embedded, distributed information processing, and Internet related technologies. It uses TCP/IP protocol as an embedded application on the basis of intelligent sensors, embedded in the ROM of existing intelligent servers, and utilizes the built-in Web server of sensors. Users can collect information about remotely monitored objects through a browser.
Working principle of a Web network sensor data acquisition system
Users access data on web servers through a browser and display the remotely collected data in real-time on internet web pages. TRICONEX 4119A users need to see real-time changes in data, while HTML web pages can usually only be static data. Therefore, it is necessary to apply dynamic web page technology on web servers. The implementation techniques for dynamic web pages include CGI and HTML script embedding techniques (such as ASP, PHP, JSP, etc.). Due to the limited resources of the network sensor embedded system, CGI technology is used to implement dynamic web pages.
1.1 CGI Principles
CGI (Common Gateway Interface) provides a channel for external programs to web servers, enabling communication between processors and browsers. CGI is an interface specification that can handle data input from clients (usually browsers) and complete interactive operations between browsers and servers. CGI is a program that runs on a web server, triggered by input from a browser, and serves as a bridge between the server and other programs in the system. CGI program is an external program that is an executable file running on the server side.
The schematic diagram of the working principle of the CGI program is shown in Figure 1.
Figure 1 Schematic diagram of CGI program working principle
After browsing a certain homepage, the client’s web browser submits data in a certain way and TRICONEX 4119A sends a request to the web server through the HTTP protocol. The server-side HTTP Daemon (daemon) passes the described homepage information to the CGI program specified on the homepage through standard input (STDIN) and environment variables, and launches this application for processing (including database processing). The processing result is returned to HTTP Daemon through standard output (STDOUT), and then to the client’s browser through the HTTP protocol. The browser is responsible for interpreting and executing, and displaying the final result to the user.
Figure 2 CGI Data Collection Process
1.2 CGI based data collection process
The data collection process of CGI is shown in Figure 2. When implementing remote sensor temperature data collection using CGI, CGI programs can obtain data by directly accessing hardware or calling driver programs. After the data collection is completed, the CGI program organizes the data into HTTP streams and sends them to the web server, which is responsible for sending them to the client.
2 Real time data collection technology
2.1 Implementation methods for continuous data collection
Due to HTTP being based on a request/response pattern, an interaction between the client and server begins with a request made by the client and ends with a response from the server. How to achieve continuous data collection when only one set of data can be obtained from a single interaction? There are generally two methods: client towing and establishing a TCP connection.
Client pull is the insertion of a timed refresh function into a webpage, with an order of magnitude of s. It allows users to see changes in data, but it does not meet the requirements of strong real-time performance and may miss some intermediate data.
Establishing a TCP connection is to enhance the functionality of the client by embedding an ActiveX control or Java Applet mini program in a web page. Among them, ActiveX controls can only run in the Windows environment, while Java Applets have strong universality and can achieve cross platform operations. So this system uses Java Applet for real-time remote data collection.
2.2 Java Applet
Applet is a small program written in Java that contains visual content and is embedded in web pages to create special page effects. It is often used to enhance multimedia effects on web pages and create interactive features.
When a user visits a webpage with Java Applet, the Applet is downloaded to the user’s computer for execution, provided that the user is using a web browser that supports Java. Since Applet is executed on the user’s computer, its execution speed is not limited by network broadband or MODEM access speed, allowing users to better view the multimedia effects generated by Applet on web pages.
Applet must embed HTML’s<apple>and</apple>tags or<object></object>into a web page in order to run using a browser. In IE, replace the<apple>tag with the<object>tag, and in Netscape 4, replace the<apple>tag with the<embedded>tag. However, both<object>and<embedded>must follow the format in Java Plugin.