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.
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
- Popular Resources
- Popular amplifiers
- New Energy Vehicle Detection and Diagnosis Experiment (Edited by Mao Caiyun, Zhou Xien, and Long Jiwen)
- Semantic Segmentation for Autonomous Driving: Model Evaluation, Dataset Generation, Viewpoint Comparison, and Real-time Performance
- Machine Learning and Embedded Computing in Advanced Driver Assistance Systems (ADAS)
- Intelligent program synthesis framework and key scientific problems for embedded software
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Are you using Python? Be careful of being complained about infringement! [MicroPython Open Source Mutual Aid Alliance Established]
- Modbus RTU master-slave protocol made by dsp
- After 8 days, I finally added a mechanical hard drive to my laptop
- Evaluation Weekly Report 20220124: Yatli AT32F425 and Qinheng CH582 apply for online launch ~ National Technology and other evaluation reports updated
- Shouldn't we buy chips on Taobao?
- [ESP32-S2-Kaluga-1 Review] 3. Getting started with Ubuntu and updating under Ubuntu
- GD32L233C-START Development Board Study Notes (Part 3)
- EEWORLD University ---- "Embedded Artificial Intelligence" - Chinese Chatbot Development
- Can Software Radio Become Open Radio?
- Sincerely recruiting embedded software and hardware engineers