Design of EPA Bluetooth data acquisition system ba

  • Detail

Design of EPA Bluetooth data acquisition system based on EWS

Abstract: Aiming at the problem of remote access and monitoring of industrial sites based on EPA protocol, this paper briefly describes the working principle of EPA Bluetooth data acquisition system based on MPU rabbit 2000, and gives the code framework of software implementation by using the TCP/IP protocol stack inside MPU and Dynamic C development tools. On this basis, the embedded web server of the system is designed. Through the design of CCI communication program and its application in system interface browsing, the feasibility of the design is verified. This design has important reference value for embedded system to be applied to wireless web access in factory site


epa (Ethernet for plant automation) is an industrial control network technology based on information networks such as Ethernet (IEEE802.3), wireless local area network (IEEE802.11) and Bluetooth (ieee802.15) cots (commercial off the shelf) communication technology and TCP (UDP)/IP protocol, which is suitable for data communication between industrial automation control system devices and instruments, as well as between industrial automation instruments

Bluetooth technology is a kind of short-range wireless communication technology replaced by cables. Some industrial equipment in the industrial field needs to be installed in a harsh industrial environment. Using Bluetooth technology can avoid the problems encountered in industrial field wiring. The emergence of embedded web server meets the needs of low-cost remote control of industrial control network. This paper combines the two to design and develop a Bluetooth data collector to meet the needs of EPA industrial control network. Based on the embedded web server EWS (Embedded Web server) technology, combined with the network communication function of Rabbit2000, using the existing network technology (such as HTTP, CGI, SSI, etc.), the field data collected by Bluetooth wireless mode is transmitted to the server, and the server is provided to remote users in the form of pages

1 design of Bluetooth data acquisition system based on embedded w for a good performance EB server of Rotorless vulcanizer detector

the Bluetooth data acquisition system model based on Embedded Web server is shown in Figure L. Bluetooth data collector is based on EPA protocol. The remote monitoring user connects to the embedded web server through the internal network of the enterprise, controls the Bluetooth chip to complete the data collection, and returns the collected data to the embedded web server and displays it on the web browser of the remote management terminal

2.1 system hardware structure design

the system structure of Bluetooth data collector based on EPA protocol is shown in Figure 2. It includes microprocessor, Bluetooth module, digital to analog (D/a) conversion module, analog-to-digital (A/D) conversion module, liquid crystal display module, flash memory and Ethernet controller module. Among them, Bluetooth module, digital to analog (D/a) conversion module, analog-to-digital (A/D) conversion module and liquid crystal display module are respectively connected with the serial communication interface of microprocessor through its interface circuit. The baud rate of serial port adopted by Bluetooth module is 57600bps; The working master frequency of the microprocessor is 11.0592Mhz and the slave frequency is 32.768KHz; The working voltage of Bluetooth module is 3.3V, which requires a voltage conversion circuit from 5V to 3.3V; All chips in Figure 2 that are not marked with power leads need to provide 5V voltage

2.2 working principle

① when the power switch of Bluetooth data collector is turned on, the system performs self-test

② after the system self-test passes, the Bluetooth data collector initializes Bluetooth and searches for other field devices with Bluetooth chips within its coverage

③ if the above devices are found, their respective link managers will find each other, and can establish communication relations after authentication and authentication when needed

④ when it is necessary to collect field data, connect the input port of the A/D conversion module with the collected object through the peripheral interface circuit. After the A/D conversion module obtains the start command, it collects the field data and sends it to the micro 4.1 mixer for processing. The processed data is sent to the relevant control equipment through the Bluetooth module, and the processed data can also be transmitted to the embedded wek server

⑤ at the same time, the system is also equipped with a D/a conversion output. When analog output is required, the output port of the D/a converter can be connected with the controlled object through the peripheral interface circuit. The program sends the control instruction to the D/a conversion module. After receiving the control instruction, the D/a conversion module converts it into analog quantity and transmits it to the field equipment, so that the field equipment can work according to the control instruction

2.3 overall software design

the software structure diagram of Bluetooth data acquisition system based on EPA protocol is shown in Figure 3

3 implementation of embedded web server

3.1 embedded web server architecture

the embedded web server architecture of the system is shown in Figure 4. Embedded web server is in the middle of user and application system in this system. Embedded web server must provide several mechanisms to monitor and control field devices, Provide and send web pages to browsers and process data submitted by browsers [introduction. One of the difficulties in the design of embedded welh server is to use Rabbit2000 to realize the ability of remote access through the browser. This system adopts CGI and SSI technology to realize; the second difficulty is the development of embedded communication program. This system uses rabbit200 spline to be placed on the two supports of the fixed machine tool of the experimental machine, 0 microprocessor as the control chip, and uses the communication subroutine library supporting TCP/IP protocol provided by z-world company, which is in dynamic C c integrated development environment can achieve rapid development

3.2 preparation and interface design of foreground form

various command requests submitted by users are mainly submitted to CGI program in the form of F () rm form [citation. FC) rm is HTML, (Hypertext Markup Language) Can be saved as an.Html file and recognized by the W 'WW browser. The data input shall adopt the drop-down box as far as possible, with friendly interface

3.3 HTTP protocol processing flow

the design of HTTP protocol processing is the core of embedded web server system. CGI is a standard used to define the communication mode between the web server and external programs. It can be used as an interface to expand the functions of the web server. Through CGI, it can realize the interaction with users accessing web pages

in essence, CGI is a service mechanism. When the user sends a request with get or post command format to the HTTP server through the web browser, the specific steps of the service are as follows:

① the foreground client uses the browser to establish a connection with the server and send URL requests using TCP/IP protocol

② the server calls the CGI program stored in the Rabbit2000 chip, and uses the parameters passed by the client as the parameters of the CGI program

③ CGI returns the processing results to the HTTP server in a recognizable format

④ the HTTP server returns the data to the client for processing, and displays the CGI execution results through the browser

Figure 5 shows the whole process of interaction between the above browser and server through CGI program

server side attachment (SSI) is a simple dynamic web page generation technology. SSI defines a set of tags that can be embedded in HTML text. The web server preprocesses them before sending them to the client browser. Think of SSI as a special program embedded in HTML pages

3.4 background DYNAMICC program implementation

epa protocol uses UDP protocol to transmit messages, which does not need confirmation, and meets the real-time requirements of industrial sites. The main framework code of UDP message transmission communication program using DYNAMICC compilation environment is as follows:

htp_ init();

init_ dateform(); // Set static data

init_ dynamicwebdata();//Initialize dynamic web data

tcp_ reserveport(80);//Flag 80 port is server side

while (1) {

tcp_tick (null);

http_handler ();//processing http


waitfor (udp_peek (&sock,

tcp_tick (null);

handle_udp (&sock p>



write user-defined functions in the web server program to process CGI requests sent from the client browser. Through the structure httpspec in DYNAMICC_ File combines dynamic pages with static pages through the structure httpspec_ Function associates user-defined functions with each CGI request. In this way, when a CGI request is triggered and sent to the web server, the progress of plastic granulator technology is closely related to the development of the whole national economy. The server program will find the corresponding function to process and return the result

{httpspec_file, "/ml", index_html, null, 0, null, null}, {httpspec_function, "/I", 0, initial, 0, null, null), {httpspec_function, "/I", 0, setuplink, 0, null, null}, the code of the interface display effect is as follows:

var=sspec_ addvariable (“getdata2”,&getdata[1],PTRl6,"%s",SERVER_HTTP);

var=sspec_ addfv(form,var);

sspec_ Setfvname (form, VaR, "Bluetooth address")

sspec_ Setfvdesc (form, VaR, "Bluetooth local address")

sspec_ setfvlen(form,var,12);


this paper focuses on the design and implementation of EPA Bluetooth data acquisition system based on Embedded Web server. The test of this system fully shows that it is feasible to use embedded technology to develop embedded web server of Bluetooth data acquisition system based on EPA protocol in embedded system. The remote monitoring and maintenance mode of industrial control system based on Embedded Web server will effectively reduce the monitoring operation and maintenance cost and improve the monitoring operation and maintenance efficiency, so it has great application prospects and promotion value. (end)

Copyright © 2011 JIN SHI