Distributed monitoring system of urban water supply station based on ARM

Publisher:TranquilSmileLatest update time:2010-07-20 Source: 微型机与应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The urban water supply system is responsible for providing safe living and industrial water for the entire society, as well as for rationally dispatching water use and ensuring the rationality of water use. It is the lifeline of the normal operation of the entire society. Each water supply station is the core working part of the entire water supply system. Therefore, the monitoring system of the urban water supply station is particularly important [1].

At present, most urban water supply station monitoring systems are based on single-chip microcomputers. After A/D conversion of external sensor data, they are connected to single-chip microcomputers with an accuracy of up to 12 bits. After processing, the data is displayed on a dot matrix display screen. The single-chip microcomputer is an 8-bit central processor, which is slightly insufficient for fields with higher requirements. Serial ports are mostly used for communication between the lower and upper computers. The serial 485 interface uses differential transmission, and the maximum transmission distance can reach 1,200 m, but the rate at this distance can only reach 100 Kb/s, and 485 only allows one lower computer to transmit data to the upper computer at any time, which makes this communication method subject to certain restrictions.

The rapid development of embedded processors and Ethernet technology provides solutions to these problems.

Embedded processors have fast processing speed, high precision, rich expansion interfaces, and good human-computer interaction. Ethernet communication technology is becoming more and more popular due to its advantages of strong real-time performance, fast communication speed, strong compatibility, and convenient network wiring. This paper takes ARM embedded processor as the core, equipped with WinCE embedded system, and combines TCP/IP protocol to design a high-speed data acquisition system for urban water supply stations based on ARM and TCP/IP. The implementation of the lower computer data acquisition program, upper computer program, and system communication is described in detail [2-3].

1 Overall architecture and hardware design of the system

1.1 Overall architecture of the system

The lower computer of the data acquisition and monitoring system is based on the Samsung S3C2440A embedded processor of the ARM9 series. The processor has a main frequency of 400 MHz and a maximum of 533 MHz. It has a fast processing speed and a built-in 8-channel 10-bit A/D converter with a maximum conversion frequency of 2.5 MHz. The data acquisition speed and accuracy are very high. Based on ARM9, it is equipped with the WinCE embedded operating system, which has an interface and operation similar to Windows XP, making it easier and faster to operate; it supports multiple series of microprocessors, including the ARM series, so that the lower computer has a perfect integration of hardware and software. The lower computer receives the data collected by the sensor, and then communicates with the upper computer through the TCP/IP protocol. After the upper computer receives the data sent by the lower computer, it performs data storage, display, and alarm operations. The upper computer performs remote monitoring and completes the functions of summarizing and analyzing the information of each lower computer. The system structure is shown in Figure 1.

1.2 System Hardware Design

The physical quantities that the distributed monitoring system of urban water supply stations needs to measure mainly include the current, voltage, temperature and other parameters of the motors of each water supply station, as well as the flow rate, inlet and outlet pressure, water temperature and other water quality parameters of the water supply station. Appropriate sensors should be selected according to the various physical quantities and the specific working environment in which they are located [4].

As shown in Figure 2, the lower computer hardware is based on ARM9, its built-in A/D conversion interface is used to receive data from external sensors, and the TFT display screen is used as the display of the lower computer. At the same time, its various expansion interfaces can provide other resources and be used for future expansion.

The external data collected by the sensor is connected to the ARM internal A/D converter after amplification, filtering and other interference elimination operations, processed in the embedded system, and displayed on the lower computer display screen and corresponding human-machine operation. The lower computer expands the on-board 64 MB SDRAM memory and on-board 128 MB Nand Flash storage and supports 32 GB of external SD expansion slot to meet the local operation and storage requirements. The extended RJ-45 interface is used as an interface for communication with the upper computer. The IIC bus and other interfaces are used for expansion and other functions.

The TCP/IP protocol uses the client/server (C/S) model for communication. Its communication is point-to-point, and almost error-free data transmission can be achieved in the network. It has high reliability and high speed. Due to the development of network-related routing and gateway technologies, the implementation of multi-channel communication has become simple and convenient.

The lower computer ARM has expanded the network RJ-45 network interface, making it easier to implement TCP/IP communication between the upper and lower computers.

After processing the data, the slave computers of each water supply station are connected to the host computer through the RJ-45 network interface. Multiple slave computers are connected to the network through routers and then communicate with the host computer. The structure diagram is shown in Figure 1.

2 Software Design of Distributed Monitoring System for Water Supply Station

The software design of the distributed monitoring system of the water supply station includes lower computer address mapping, lower computer data processing and display, data communication and upper computer program implementation.

2.1 Lower computer address mapping and implementation

The lower computer is equipped with WinCE operating system. ARM data acquisition operates the corresponding registers through GPIO. WinCE system maps the real address of GPIO to the virtual address space, and controls GPIO and other on-chip resources through the operation of the virtual address space. To operate GPIO in ARM in WinCE, it is necessary to find the corresponding virtual address according to the base address in BSP. This requires address mapping. Figure 3 is the principle diagram of address mapping.

There are two methods of address mapping: one is the stream driver method, that is, mapping the physical address accordingly in the stream driver, and adding the stream driver to the underlying image to achieve it. The other method is to map the physical address and the virtual address accordingly in the external WinCE program. It only needs to operate the external program and has no effect on the kernel. Since the data acquisition part of the lower computer is not complicated, the second method is used for implementation.

To implement address mapping, first define the registers used in the underlying driver as a class in the WinCE embedded program. Then use the VirtualAlloc and VirtualCopy functions to map the physical address and virtual address. The VirtualAlloc function is used to reserve or commit space in the virtual address space of the current process, in units of 64 KB when reserving and in units of 4 KB when committing. The VirtualCopy function is used to bind the physical address to the statically mapped virtual address. VirtuaAlloc+VirtualCopy can map the kernel to the current process, allowing the current program to find the corresponding virtual address [5-6].

By defining the mapped address as a new class, the register can be operated, as shown in Figure 3.

2.2 Data processing and display of lower computer

After the lower computer collects data, it uses a digital module to display it. When the data exceeds the upper and lower limits, the buzzer in the lower computer will alarm and notify the on-site operator.

The digital display module adopts the form of redrawing, pre-defines the corresponding digital display value, and redraws the digital display module accordingly after receiving the data. The digital display module is added to the WinCE program as a plug-in, and the display function in the module is called in the main function to realize the display of the digital.

The lower computer alarm function is realized by ARM extended buzzer, which is controlled by PWM. In S3C2440A, GPB0 is the register for controlling PWM, and the corresponding register is operated by address mapping.

First, set port GPB0 to TOUT0 function, then set pre-scaling and split value, the frequency of input clock (CCLK) of counter is: PCLK/(pre-scaling + 1)/slicing value. Pre-scaling value and split value are determined by TCFG0 and TCFG1 respectively. Then set initial values ​​TCMPB3 and TCNTB, because the input clock of counter is PCLK/16/8; and rTCNTB0=(PCLK>>7)/freq; and the count turns over when it reaches half of the maximum value. Because the base value of the count is set by rTCMPB0 to 50% of the maximum count value. Finally, the setting rTCON of timing controller, TOUT0 generates a square wave with frequency rTCNTB0 and duty cycle of 50%, and the buzzer can be driven. When the data exceeds the limit, this function is called to alarm the buzzer.

2.3 Implementation of TCP/IP Communication

The client/server (C/S) format is adopted between the upper and lower computers, with the lower computer acting as the client and the upper computer acting as the server for communication. TCP/IP communication is implemented through sockets [7-8].

The lower computer uses the connect function of the socket to send a connection request to the upper computer (server). When the connection is successful, the send function is used to send the corresponding data to the upper computer. After the communication is completed, the socket is closed.

The communication part of the upper computer corresponds to the lower computer. The socket is bound to the local address and port using the bind function of the socket, and the socket is set to listening mode. The listen function is used to prepare to receive the client's request. After the accept function receives the connection request, the recv function is called to receive the corresponding data. The process is shown in Figure 4.

The host computer, as the server, monitors the set port all the time, so it uses multi-threading to perform loop monitoring until the corresponding operation stops it.

2.4 Host computer display alarm and data storage implementation

The host computer is the core of the whole system monitoring. In order to display the data intuitively, dynamic curves are used. Sound alarms are also given and the data is stored in a database. The display interface of the host computer system is shown in Figure 5.

The dynamic curve display of the host computer is drawn using brushes, curves and other functions. When data is received, the corresponding curve is drawn, and as the data increases, the curve moves so that the displayed curve is always the data for the current period of time. The implementation of the alarm is relatively simple, just call the Beep function when the data exceeds the limit.

Another major function of the host computer is to store data for later use. Data storage uses ADO to access the database.

ADO is a COM component used to access data sources. It is Microsoft's latest object-level data operation technology. It provides a set of high-level automation interfaces for operating OLE DB data sources. Functionally, ADO is also an OLE DB client program. It does not rely on a specific OLE DB server but supports all OLE DB service providers. Through these OLE DB service providers, ADO supports client/server mode and Web-based data operations, especially supporting access to Microsoft's SQL Server database server through client/server mode or Web-based mode[9].

Using ADO's Connection, Command, Recordset and other key objects, a table is established in the database to automatically store the current date, time and sensor data in real time.

In order to ensure the running status of the program, multi-threading is used to implement the storage operation of the specified data.

This system realizes the accurate and high-speed data collection of the lower water supply station, and can display the lower data in the embedded lower computer system, realize the observation and processing of data on site, and can transmit the data on site to the upper computer at the same time, and transmit the data from different lower computers to the upper computer for aggregation and corresponding operation, thus realizing remote monitoring and management. This system also has a good reference value for other data collection and monitoring systems.

Reference address:Distributed monitoring system of urban water supply station based on ARM

Previous article:VoIP system based on AMR speech coding and decoding algorithm
Next article:Application of ARM9 system in intelligent monitoring system of wireless transmitter

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号