Design and implementation of water regime telemetry terminal based on AT89S52

Publisher:chenfengy818Latest update time:2012-11-17 Source: 电子设计工程 Keywords:AT89S52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the continuous advancement of hydrological modernization, water regime monitoring and reporting as an important means of hydrological work is also developing rapidly. Water regime monitoring and reporting uses advanced technologies such as telemetry, computers, control and communication to conduct real-time telemetry, transmission and processing of hydrological information. Its system is mainly composed of three parts: telemetry station, relay station and central station. The telemetry station uses the water regime telemetry terminal (RTU) to complete the collection and processing of various hydrological sensor data, and finally communicates with the central station in two directions to realize the forecast or scheduling decision of water regime. The telemetry terminal is the source of information and decision-making basis for the entire monitoring and reporting system. Therefore, how to build a telemetry terminal with complete functions, high reliability, universal flexibility and easy maintenance becomes the key to the design.
At present, the design of water regime telemetry terminal basically uses MCS51, MSP430 and ARM series microcontrollers as control chips, and configures various peripheral circuits to realize system functions. This paper designs a low-power water regime telemetry terminal based on AT89S52 microcontroller, which has complete functions and stable performance, and can provide accurate, comprehensive and comprehensive water regime information for the control center.

1 System overall design
The system adopts modular design. According to the function, the entire telemetry terminal can be divided into single-chip microcomputer module, data acquisition module, data communication module, human-computer interaction module and power supply module. The system structure is shown in Figure 1.


System workflow: The single-chip microcomputer reads parameters such as rainfall, water level, gate position, etc., processes, stores and encodes them, and sends them to the relay station or central station through the wireless data transmission radio after the modem in the self-reporting or call-in mode. The system has good human-computer interaction function, and can realize parameter setting and real-time dynamic display of data through keyboard operation.

2 System hardware circuit design
Considering the functional requirements, cost, interface circuit and program complexity of the telemetry terminal, ATMEL's AT89S52 single-chip microcomputer is selected as the control core. It has 8 kB Flash memory and 256 bytes of RAM, supports full static operation and two optional power saving modes of idle and power-off. The entire system consists of data acquisition interface circuit, communication interface circuit, human-computer interface circuit, real-time clock circuit, storage expansion circuit and power supply circuit in the hardware logic structure.
2.1 Data acquisition interface circuit design
This article only takes the data acquisition of rainfall and water level as an example.
The rainfall is collected by a tipping bucket rain gauge. When the rainfall reaches 1 mm, the rain gauge flips once and sends out a pulse signal to trigger interrupt 0, waking up the microcontroller in a low-power state, and accumulating, storing and sending the rainfall immediately. Since the reed switch of the rain gauge will jitter when it is closed, in order to ensure the accuracy of rainfall records, the output pulse signal of the rain gauge must be pulse shaped before it can be sent to the subsequent unit for processing. The shaping circuit is shown in Figure 2. MC14538 is a monostable trigger device that can be repeatedly triggered and reset, and R2 and R3 are protection resistors. During the non-jump period, the irregular changes of the pulse remain within a certain range, the comparison results of VD1 and VD2 are the same, the trigger does not work, and the output pulse remains stable.

[page]

The system is designed for 2-way water level acquisition. The output of the float-type water level meter is 12-bit parallel Gray code. In order to save the I/O port resources of the single-chip microcomputer, two MC14021 shift registers are used to latch the parallel data, convert the parallel data into serial data, and then output it bit by bit to the single-chip microcomputer for processing. The serial-to-parallel conversion circuit is shown in Figure 3, and a pull-up protection resistor is connected to enhance the stability of the circuit.


2.2 Communication interface circuit design
The ultimate goal of the telemetry terminal is to process the collected water data into frames, and transmit them to the central station after long-distance transmission using a wireless data transmission radio. RS-232 is used as the interface to connect to the radio. It can also connect to communication modules such as SMS/GSM and GPRS to meet the needs of different application environments and improve the versatility of the system.
The modulation and demodulation uses a full-duplex low-speed MODEM chip MC145442, which contains a complete frequency conversion modulation (FSK) modulator, demodulator and filter, provides two-way data transmission of FSK signals at a baud rate of 300, and supports call mode and answer mode. The communication interface circuit structure is shown in Figure 4. The serial port level conversion uses the MAX232 chip. The RXD, TXD, RXA1/RXA2, and TXA ports of MC145442 are the data receiving end, data transmitting end, carrier receiving end, and carrier transmitting end, respectively.


2.3 Human-machine interface circuit design
In order to reflect the system-friendly human-machine interface and facilitate the input and display of control parameters, a 1602 character LCD display module is used as the output display device. The 1602 display module has a built-in control driver HD44780, and the display and drive work are completed by this controller and peripheral circuits. A 4x4 keyboard is configured to quickly, accurately and conveniently set parameters and realize various control functions. The keyboard is directly composed of the high and low bytes of the P1 port, and uses interrupt output, that is, the column line is connected to the gate device to connect to the external interrupt 1, and the row line and column line are set to high and low levels respectively. When a key is pressed, the circuit outputs a low level, triggers an interrupt, and enters the interrupt routine to determine which key is pressed.
2.4 Other expansion circuits
This system uses a low-power CMOS AT24C08 chip as an expansion memory. The chip is an 8 kB serial EEPROM with an I2C bus interface. The circuit connects P2.3 and P2.4 to SCL and SDA. The memory stores the setting parameters, historical water data and the time stamp of data collection, which can be displayed and consulted by the user through the key.
The time stamp of data collection and the calculation of the safe time interval are realized by using the DS1302 real-time clock chip. DS1302 provides data information of year, month, week, day, hour and second, and uses SPI to communicate with the CPU. The interface is simple, only RST reset, I/O data line and SCLK serial clock line are connected to P2.5, P2.6 and P2.7 respectively.
The telemetry terminal is installed in the field without continuous power supply. In order to realize automatic monitoring in a long-term unattended environment, a 20 W/12 V solar panel and battery power supply system are used. 3 System software design The main functions of the telemetry terminal are: according to the protocol (generating 1 mm rainfall: water level changes 1 cm, and the time interval is 5 min), various sensor data and power supply status parameter information are collected, stored and sent; when no parameters are sent, the terminal is in the on-duty state, and the data is sent to the central station in full according to the self-reporting cycle (the default value is 8 h) to indicate that the telemetry station is working normally and realize the safety reporting function: in the reporting mode, respond to the data request instructions of the central station, collect various data and send them in full: respond to keyboard instructions, receive and update parameter settings and modifications, dynamically display water data, terminal status information, etc.; call function, the staff can contact the relay station or central station through the radio on site, and provide call functions for command and dispatch and on-site maintenance.


[page]

The main program flow of the system software is shown in Figure 5: System initialization to ensure that the system is in normal working state: enter the sleep mode by default to reduce the power consumption of the terminal system; wait for external interrupts to wake up the system, collect and transmit data, and realize various control functions. The hard interrupt routines that realize the functions mainly include rainfall interrupt routines, timer interrupt routines (Figure 5), and keyboard interrupt routines (Figure 5). The rainfall interrupt routine completes the accumulation, storage and transmission of rainfall. The timer interrupt routine first collects water level data and checks whether the measured value changes by more than 1 cm. If so, it stores the data and re-collects water data such as rainfall, water level, gate position, and power supply voltage parameters before sending; otherwise, it reads the value of the real-time clock and calculates the time interval. If the safe reporting cycle is reached, various data are collected and sent. The keyboard interrupt routine is mainly responsible for receiving keyboard commands and performing corresponding processing, including real-time display and parameter setting. The role of the timer in the routine is to stipulate the maximum key operation time (generally 2 to 3 minutes), that is, to force the low power consumption state after the key timeout to prevent infinite keyboard scanning cycles without operation.


The above software process mainly includes functional modules such as data acquisition, data storage, data transmission and real-time display. The focus of data acquisition is water level acquisition. The float-type water level gauge outputs 12-bit Gray code as a unified storage and transmission format, which must be converted into BCD code. Since wave impact will cause instantaneous interference when measuring water level, software filtering is used to improve accuracy for wave protection. The method is to sample the water level information 5 times continuously, arrange the sampled values ​​from small to large, and take the average of the middle 3 times as the final measurement value. Data storage includes data storage and data reading. The storage format of water condition data is: feature word, data, time mark. The feature word is used to distinguish whether the data is rainfall, water level or gate position. The time mark is to read the real-time clock to mark the data before the data is read in. Data transmission first calculates the check byte according to the buffer data length, integrates it into a frame together with the station number, parameter feature code and data, and sends it to the MODEM for modulation and then sends it.
The system standard data frame format is shown in Figure 6. Single data transmission uses format 1, and 1 parameter data is sent each time, which is distinguished by data features; full transmission uses format 2. In order to improve the reliability of communication, CRC-16 channel coding is adopted.


The display module and buttons are used to set the parameters of the station terminal, such as the station number, sampling time interval, sending time interval, etc.; they can also be used for the detection and maintenance of the station.

4 Conclusion
The low-power water condition telemetry terminal based on the AT89S52 single-chip microcomputer has a simple and flexible hardware design, a reasonable software architecture, and functions and performances that meet the technical requirements of water condition monitoring and reporting. It can collect various hydrological data and meteorological parameters such as rainfall, water level, and gate position in real time, and perform solid-state storage. It also has the functions of water level wave protection and safety reporting. The system reduces power consumption and achieves low power consumption by adopting low-power peripheral devices and sleep and external interrupt wake-up working modes. The designed RS-232 communication interface can be connected to a variety of communication modules, which improves the versatility of the RTU.
The telemetry terminal can be widely used in hydrology and water conservancy, urban flood control, water supply and drainage, environmental and meteorological monitoring, etc. In actual applications, the whole machine current of the RTU in the on-duty state is <60μA, and the stored parameters can be maintained for more than 50 years after power failure. Since the system functions are relatively complete and the performance is reliable, it has been working normally since it was put into use and has achieved good results. In addition, in view of different project requirements and application environments, the system needs to be further improved and enhanced in combination with actual conditions, such as optimizing lightning protection, software and hardware anti-interference protection design, adding various new digital and analog interfaces to expand the range of measurement parameters, and strengthening channel monitoring to improve data transmission quality.

Keywords:AT89S52 Reference address:Design and implementation of water regime telemetry terminal based on AT89S52

Previous article:Share the design of camera lens control circuit based on 89C51
Next article:Design of intelligent anti-theft system for warehouse area based on AT89S52 and sensor

Recommended ReadingLatest update time:2024-11-16 17:34

Design of Ultrasonic Distance Measurement System Based on Single Chip Microcomputer
O Introduction     Ultrasonic waves refer to mechanical shock waves with a frequency greater than 20 kHz generated in elastic media. Ultrasonic waves have high frequencies, strong penetration, strong directivity, low attenuation during transmission, slow energy consumption, long propagation distances in the medium, an
[Microcontroller]
Design of Ultrasonic Distance Measurement System Based on Single Chip Microcomputer
Design of Temperature and Humidity Detection System Based on AT89S52
introduction Temperature and humidity are the main environmental parameters of industrial and agricultural production. It is of great significance to measure them accurately and timely. Using a single-chip microcomputer to control temperature and humidity has the advantages of high temperature and humidity control
[Microcontroller]
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
Guess you like

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号