Design of Remote Data Acquisition System for Web Network Sensors

Publisher:快乐航程Latest update time:2011-08-08 Source: 21ICKeywords:Embedded Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

With the development of network technology and embedded technology, combining embedded systems with the Internet to monitor and manage system data and images has become one of the important research directions. Embedded Web network sensor technology is a cross-integration of related technologies such as sensors, embedded, distributed information processing and the Internet. It uses the TCP/IP protocol as an embedded application based on intelligent sensors and embeds it into the ROM of existing intelligent servers. Using the built-in Web server in the sensor, users can collect information about remote monitoring objects through a browser.

1 Working Principle of Web Network Sensor Data Acquisition System

Users access data on the Web server through a browser, and display the remotely collected data on an Internet web page in real time. Users need to see data changes in real time, but HTML web pages can usually only be static data, so it is necessary to apply dynamic web page technology on the Web server. The implementation technologies of dynamic web pages include CGI and HTML script embedding technology (such as ASr, PHP, JSP, etc.). Since the network sensor embedded system is implemented by a single-chip microcomputer, its resources are limited, so CGI technology is used to implement dynamic web pages.

1.1 CGI Principles

CGI (Common Gateway Interface) provides a channel for external programs to the Web server, enabling communication between the processor and the browser. CGI is an interface specification that can process data input by the client (usually a browser) and complete interactive operations between the browser and the server. CGI is a program running on the Web server, triggered by the browser's input, and serves as a bridge between the server and other programs in the system. The CGI program is an external program and an executable file running on the server.

The schematic diagram of the working principle of the CGI program is shown in Figure 1.

After the client's web browser browses to a homepage, it submits data in a certain way and sends a request to the web server through the HTTP protocol. The HTTP Daemon on the server side passes the homepage information described to the CGI program specified by the homepage through the standard input (STDIN) and environment variables, and starts this application for processing (including processing of the database). The processing results are returned to the HTTP Daemon through the standard output (STDOUT), and then returned to the client's browser through the HTTP protocol. The browser is responsible for interpreting and executing, and displays the final results to the user.

1.2 Data collection process based on CGI

The data collection process of CGI is shown in Figure 2. When using CGI to collect temperature data from remote sensors, the CGI program can obtain data by directly accessing the hardware or calling the driver. After the data collection is completed, the CGI program organizes the data into an HTTP stream and sends it to the Web server, which is responsible for sending it to the client.

2 Real-time data collection technology

2.1 Implementation method of continuous data acquisition

Since HTTP is based on a request/response model, an interaction between a client and a server begins with a request from the client and ends with a response from the server. However, only one set of data can be obtained from one interaction. So how can we achieve continuous data collection? Generally, there are two methods: client traction and establishing a TCP connection.

Client-side traction is to insert a timed refresh function into the web page. Its order of magnitude is s, which allows users to see the changes in data, but it cannot meet the requirements of strong real-time performance, and some intermediate data will be missed.

Establishing a TCP connection is to enhance the client's functions by embedding ActiveX controls or Java Applets in the web page. Among them, ActiveX controls can only run in the Windows environment, while Java Applets are highly versatile and can achieve cross-platform operations. Therefore, this system uses Java Applet to collect remote data in real time.

2.2 Java Applet

Applet is a small program written in Java, containing visual content, and embedded in Web pages to produce special page effects. It is often used to increase the multimedia effects of Web pages and make them interactive.

When a user visits a web page with a Java Applet, the Applet is downloaded to the user's computer and executed, but the prerequisite is that the user is using a web browser that supports Java. Since the Applet is executed on the user's computer, its execution speed is not limited by the network bandwidth or MODEM access speed, and the user can better view the multimedia effects generated by the Applet on the web page.

Applets must be embedded into a web page using a pair of HTML tags and or to run in a browser. In IE, the tag replaces the tag, and in Netscape 4, the tag replaces the tag. However, both and must follow the format in the Java Plug-in.

3. Implementation of real-time data collection

3.1 Hardware Implementation

The hardware structure of the data acquisition system of the embedded Web network sensor is shown in Figure 3.

ADuC832 is a mixed signal single-chip microcontroller launched by ADI. It is a truly complete data acquisition system chip, which integrates data conversion circuit, microcontroller and flash memory. Its main features are: 8-channel analog I/O, 247 ksps, 12-bit ADC, 2 12-bit (monotonic) voltage output DACs, on-chip temperature sensor; 62 KB on-chip flash/electrically erasable program memory, 4 KB on-chip flash/electrically erasable data memory, 2 304 bytes on-chip data RAM.

The main chip uses the 74LS138 decoder to select the external data memory KM62256 or the network card controller RTL8019AS. The current address is latched by the 74HC573 address latch, so that the state of the output end does not change with the state of the input end. The input state is saved to the output only when there is a latch signal, and it will not change until the next latch signal arrives, which is also to achieve address reuse.

A signal input interface is designed on the main circuit to connect the 4-20 mA signal transmitter at the industrial site; an RJ45 network port is designed, which can be directly connected to the Internet for uploading and sharing field data; RS485 interface and RS232 interface are also designed for data access and processing under special circumstances at the industrial site.

The field sensor transmits the collected 4-20 mA signal to the signal conditioning board, which converts the signal into a 0-2.5 V voltage signal, then converts it into a digital quantity through ADuC832, and then converts it into the corresponding temperature value through the program, and displays the temperature value in real time on a web page embedded with Java Applet.

3.2 Software Implementation

3.2.1 Selection of operating system and protocol stack

In the embedded Web server, μC/OS-II is selected as the embedded real-time operating system. It is a portable, curable, tailorable, preemptive real-time operating system with higher reliability and efficiency than traditional foreground and background programs.

TCP/IP is a protocol cluster, a collection of many open protocols, but the microcontroller is a small microprocessor with limited internal resources, so the protocol must be tailored. This system uses a streamlined small TCP/IP protocol stack - μIP protocol stack. The μIP protocol code includes some basic communication protocols: ARP protocol, IP protocol, ICMP protocol and TCP protocol, UDP protocol, HTTP protocol, Telnet protocol, SMTP protocol, etc. Among them, the four protocols of ARP, IP, ICMP, and TCP can realize the most basic functions of network connection and communication, and can also realize CGI technology. Its application layer is the HTTP protocol, and the collected data is embedded in the web server web page and published to the Internet in the form of a web page.

For the transplantation of μC/OS-II and μIP, please refer to the references. The software structure of the whole system is shown in Figure 4.

3.2.2 Implementation of embedding Java Applet into web page

The embedded Web sensor real-time monitoring program RealtimeMonitor.java is implemented using Applet. The main structure is as follows:

Among them, 192.168.11.30 is the IP address of the embedded Web server, data.txt is the data processed by the processor, and "wly.sleep(1000);" means setting the collection time interval to 1s.

Use the JDK software package to compile the Java program into RealtimeMonitor.class using the command javac RealtimeMonitor.java, and then embed it into an HTML page using "".

Finally, add the Monitor.html webpage with embedded Applet to the Web server loaded with μC/OS-II and μIP programs, convert the text of Monitor.html webpage into hexadecimal code, place it in the fsdata.c file of μIP and embed it into the ROM of the processor, compile all programs into HEX files through Keil, and download them to the embedded Web processor.

Open the browser and enter the IP address 192.168.11.30 to access the collected data on the embedded Web server. The real-time data collection results of the network sensor are shown in Figure 5.

Conclusion

This article introduces the working principle of the Web server, embeds CGI and Java Applet technology in the embedded server, and realizes real-time data collection of embedded Web network sensors through the client's browser, saving a lot of hardware resources and human resources, making the automatic collection of remote data more universal. At the same time, it can be suitable for any built-in embedded Web network sensor and has certain practical significance.

Keywords:Embedded Reference address:Design of Remote Data Acquisition System for Web Network Sensors

Previous article:Example of signal isolator in preventing harmonic interference of frequency converter
Next article:Design of multi-channel and multi-mode low-frequency RFID reader

Recommended ReadingLatest update time:2024-11-16 22:27

Design and implementation of regional network video monitoring system based on Web
1 Introduction At present, the expressway network has become quite large, but the phenomena of road overloading, speeding, and congestion occur from time to time, which seriously affects the service quality of expressways, namely "fast, safe, comfortable, and efficient". In order to give full play to the funct
[Microcontroller]
Design and implementation of regional network video monitoring system based on Web
How to implement stack protection in IAR Embedded Workbench development tools to improve code security
As more and more embedded products are connected to external networks, people are paying more and more attention to the information security of embedded products. This includes direct connection to external networks, such as through Wi-Fi connection, and indirect connection to external networks, such as the ECU in t
[Industrial Control]
How to implement stack protection in IAR Embedded Workbench development tools to improve code security
Design and implementation of a remote monitoring system for single-chip computers based on Web
1. Introduction The single-chip microcomputer system is more and more widely used in industrial control and daily life due to its simple and efficient characteristics. At present, most single-chip microcomputer systems are based on 51 single-chip microcomputers, which are combined with detection, servo and disp
[Microcontroller]
Latest Power Management Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号