CN111142450A - Water quality data acquisition and storage system and method based on double single-chip microcomputers - Google Patents

Water quality data acquisition and storage system and method based on double single-chip microcomputers Download PDF

Info

Publication number
CN111142450A
CN111142450A CN202010043971.XA CN202010043971A CN111142450A CN 111142450 A CN111142450 A CN 111142450A CN 202010043971 A CN202010043971 A CN 202010043971A CN 111142450 A CN111142450 A CN 111142450A
Authority
CN
China
Prior art keywords
sensor
max3232
data
transceiver
pin
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010043971.XA
Other languages
Chinese (zh)
Inventor
许士国
徐显阳
邹智林
刘锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dalian University of Technology
Original Assignee
Dalian University of Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dalian University of Technology filed Critical Dalian University of Technology
Priority to CN202010043971.XA priority Critical patent/CN111142450A/en
Publication of CN111142450A publication Critical patent/CN111142450A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/24Pc safety
    • G05B2219/24215Scada supervisory control and data acquisition

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

A water quality data acquisition and storage system and method based on double singlechips are realized based on the water quality data acquisition and storage system, and the water quality data acquisition and storage system mainly comprises an STC12C5A60S2 double singlechips, a G5V relay, an MAX3232 double transceiver, an RS232 interface, an RS232/RS485 converter, a CH376S file management control chip, a TF card and the like which jointly control the whole system. The invention adopts a design scheme of 'master-slave' and uses a STC12C5A60S2 double single-chip microcomputer with multiple serial ports to acquire water quality sensor data on the basis of configuring an MAX3232 transceiver, enhances the working stability of the system by using an RS232/RS485 converter and simultaneously uses a CH376S file management control chip to store water quality data information. In addition, by adopting the design scheme of power supply before sampling and power off after sampling, the power is effectively saved on the basis of ensuring normal power supply to the sensor. The invention can realize the continuous acquisition and automatic storage of water quality data of the water source area, improve the stability of data acquisition and ensure the accuracy of the data.

Description

Water quality data acquisition and storage system and method based on double single-chip microcomputers
Technical Field
The invention belongs to the technical field of water quality data acquisition and storage, and relates to a water quality data acquisition and storage system and method based on double single-chip microcomputers.
Background
The existing water quality data acquisition method mainly stays in a method of manually sampling on site and taking a water sample back to a laboratory for analysis in the later period, and the method has the advantages of large workload, time and labor waste and certain hysteresis of detection results. A single-chip microcomputer is generally adopted as a control center in the field of water quality data acquisition, most single-chip microcomputers only have one serial port, the requirements of multi-single-chip microcomputer multi-serial-port application cannot be met, communication resources of the single-chip microcomputers cannot be fully utilized, and the problems of low working efficiency and the like easily occur. In addition, although the water quality data acquisition technology is continuously developed along with the improvement of scientific technology, some technical problems to be solved still exist, such as poor stability, large power consumption, untimely data storage and the like, are more prominent.
In view of the defects of the prior art, a water quality data acquisition and storage system and method based on a double-single-chip microcomputer are urgently needed at present, so that continuous acquisition and automatic storage of water quality data of a water source are realized, the accuracy of data acquisition is improved, the timeliness of water quality monitoring is guaranteed, and manpower and material resources are saved.
Working efficiency
For example, the dual-singlechip control system of the gas rapid water heater (CN101598938) of the qiuchun pine and the like, discloses a dual-singlechip control system of the gas rapid water heater, and uses the dual-singlechip to jointly complete the control of the whole system, and the serial port communication method is that the serial port data transmitting end (TXD1) of the singlechip 1(MCU1) is connected to the serial port data receiving end (RXD2) of the singlechip 2(MCU2), and the serial port data transmitting end (TXD2) of the singlechip 2(MCU2) is connected to the serial port data receiving end (RXD1) of the singlechip 1(MCU1), which is equivalent to that each singlechip only uses one serial port, and uses two serial ports together, and the communication resources are not fully utilized. One serial port of the STC12C5A60S2 singlechip host machine acquires sensor data, the other serial port transmits the received sensor data to the STC12C5A60S2 singlechip slave machine, and meanwhile, one serial port of the STC12C5A60S2 singlechip slave machine stores the received sensor data to a TF card, and three serial ports are used in total. The serial port communication resources are fully utilized, and the working efficiency of the whole system is improved. Obviously, the invention has better performance and practicability in the aspect of working efficiency.
For example, in "a water quality monitoring system based on wireless communication" (CN109212147A), which is chengyang, a water quality acquisition module in the system acquires water quality information measured by a water quality monitoring sensor, and a water quality analysis module is used for analyzing the information acquired by the water quality acquisition module and transmitting the analyzed data to a single chip microcomputer. However, the system only uses one single chip microcomputer, the single chip microcomputer bears a large amount of workload, the working efficiency is low, sufficient serial port communication resources cannot be provided, and system function expansion and upgrading are inconvenient to perform. The invention adopts a design scheme of 'master-slave' and uses STC12C5A60S2 double singlechips to carry out data communication. The double singlechips respectively undertake corresponding work tasks in the system and jointly control the data transmission process through multi-serial port communication. Obviously, the invention greatly improves the working efficiency of the system and the transmission rate of serial port communication, and has more creativity and practicability.
(II) stability
For example, billow et al, "method of simultaneous communication of two serial ports" (CN103024088B), in which two serial ports can simultaneously perform data communication, are independent of each other, and the communication protocols of the two serial ports are consistent and both support RS232, but the signal level value of the interface is high, and the chip of the interface circuit is easily damaged. The RS232/RS485 converter is configured for serial port communication signal conversion between RS232 and RS485, common mode interference resistance is improved, and system working stability is enhanced. Preferably, the present invention is more advantageous and practical in terms of system stability.
(III) Power consumption
For example, in the 'method for storing, wirelessly transmitting and remotely controlling the data of the water quality acquisition and storage system based on the internet of things' (CN109828095A) of the license states and the like, the method is realized based on a water quality monitoring station and a remote monitoring point, the data acquisition and processing system is connected with a sensor set through an RS485 interface and an electric wire for communication, and the water quality information is transmitted to the remote monitoring point through the internet of things. The power supply mode is to start the solar power monitoring system to supply power to the data acquisition and processing system and the sensor group. Therefore, the method needs to supply power to the sensor group for a long time, and the power consumption is high. The invention adopts the design scheme of power supply before sampling and power off after sampling, and controls the power supply state of the sensor through the working state of the G5V relay, namely the power supply time is advanced by at least one minute relative to the sampling time, but is not limited to one minute. Obviously, the invention effectively solves the problem of large system power consumption and is more creative.
For example, in a multifunctional water quality acquisition device (CN104865361A), a microprocessor of the device is directly connected with a water quality signal acquisition module, a serial port circuit, an alarm module and a GPRS/GSM sending module respectively, but the problem of high power consumption exists. The invention respectively configures one MAX3232 transceiver for the double singlechips, thereby effectively reducing the power consumption of the system. Obviously, the invention has more advantages and creativity in solving the problem of power consumption.
(IV) data storage
For example, the patent of the us and the like, "a data collection and processing method of a multi-layer multi-parameter water quality data parallel monitoring system" (CN109828094A), the data collection and processing method is implemented based on a monitoring module, a microprocessor and a solar power supply system. The microprocessor collects and stores water quality data in a broadcast polling mode, and records fault information of the non-response sensor. The data storage module 2-3 stores the character string obtained by the data processing module 2-2 in the SD card in the form of txt file. However, the method only describes the 'data storage module' roughly, and the structure and the working mode of the 'data storage module' are not explained in detail. The storage process of the system is described in detail, namely the storage process is transmitted to a pin SDI/D2 of a CH376S file management control chip from a pin P0.6 of a slave through an STC12C5A60S2 single chip microcomputer, and then transmitted to a pin Data0/DO of a TF card through a pin SD _ DI of the CH376S file management control chip, so that Data information is stored in a TXT file mode. The CH376S file management control chip can automatically identify the connection and disconnection of the TF card, and has high reading and writing speed and low power consumption. Obviously, the invention is more reliable and practical in data storage.
Disclosure of Invention
The invention provides a water quality data acquisition and storage system and method based on double single-chip microcomputers by using methods of double single-chip microcomputer data acquisition, multi-serial port communication, data storage and the like in order to overcome the defects of the existing water quality data acquisition and storage method.
In order to achieve the purpose, the invention adopts the following technical scheme:
a water quality data acquisition and storage system based on double singlechips mainly comprises an STC12C5A60S2 double singlechips, a G5V relay S1, a MAX3232 double transceiver, an RS232 interface S4, an RS232/RS485 converter S5, a CH376S file management control chip S8, a TF card S9 and the like which jointly control the whole system.
The STC12C5A60S2 double-singlechip microcomputer is characterized in that an STC12C5A60S2 singlechip microcomputer S2 in the STC12C5A60S2 double-singlechip microcomputer serves as a main control singlechip microcomputer, has double serial ports, mainly completes acquisition of sensor data and controls the on-off of a relay.
The STC12C5A60S2 double-singlechip microcomputer is used as an auxiliary singlechip microcomputer from an STC12C5A60S2 slave computer S7, has double serial ports and mainly completes storage work of sensor data.
The MAX3232 master transceiver S3 and the MAX3232 slave transceiver S6 in the MAX3232 dual transceiver are used for reducing the power consumption of the system, and are internally provided with electrostatic protection circuits to protect electric elements from being damaged by human static electricity. The MAX3232 host transceiver S3 in the MAX3232 dual transceiver is connected with the STC12C5A60S2 single chip microcomputer S2 and used for reducing the power consumption of the system, and a static protection circuit is arranged in the MAX3232 dual transceiver to protect electric elements from being damaged by human static electricity; the MAX3232 slave transceiver S6 in the MAX3232 dual transceiver is connected with the STC12C5A60S2 singlechip slave S7 and used for reducing system power consumption, and a static protection circuit is arranged in the MAX3232 dual transceiver to protect electric elements from being damaged by human static electricity.
The STC12C5A60S2 single chip microcomputer host S2 is respectively connected with a G5V relay S1 and a MAX3232 host transceiver S3, the MAX3232 host transceiver S3 is respectively connected with an RS232 interface S4 and a MAX3232 slave transceiver S6, the RS232 interface S4 is connected with an RS232/RS485 converter S5, and the MAX3232 slave transceiver S6 is sequentially connected with the STC12C5A60S2 single chip microcomputer slave S7, a CH376S file management control chip S8 and a TF card S9.
The working state of the G5V relay S1 is controlled by the single chip microcomputer S2 of STC12C5A60S2 so as to control the power supply state of the sensor. When the pin P1.4 of the SCC 12C5A60S2 singlechip microcomputer S2 is at low potential, the G5V relay S1 keeps off state, and the sensor is not electrified; at high, relay S1 remains closed at G5V, which energizes the sensor. The STC12C5A60S2 singlechip microcomputer S2 judges whether the power supply time is up, if so, the G5V relay S1 is closed, and power supply is started to the sensor; if not, continuing to wait for the power supply time to arrive. When the power supply time reaches, the STC12C5A60S2 singlechip microcomputer S2 judges whether the sampling time reaches, if the sampling time reaches, a pin P3.1 of the STC12C5A60S2 singlechip microcomputer S2 sends a sensor instruction to a pin 2 of an RS232 interface S4 through an MAX3232 mainframe transceiver S3, the RS232 interface S4 is used for carrying out serial communication in the sensor data acquisition process, and then an A interface and a B interface of an RS232/RS485 converter S5 send the sensor instruction received by the pin 2 of the RS232 interface S4 to a sensor. Preferably, the RS232/RS485 converter S5 is used for serial communication signal conversion between the RS232 and the RS485, and the a and B interfaces thereof transmit data in a differential signal transmission manner, so that the common-mode interference resistance is improved, and the system operation stability is favorably enhanced. And if the sampling time is not reached, continuing to wait for the arrival of the sampling time.
And the RS232 interface S4 is connected to the MAX3232 host transceiver S3 and is used for carrying out serial communication in the sensor data acquisition process. The A and B interfaces of the RS232/RS485 converter S5 send data returned by the sensor to the pin P4.6 of the STC12C5A60S2 singlechip host S2 through the pin 3 of the RS232 interface S4 and the MAX3232 host transceiver S3 in turn, and then data fusion is carried out. Then the pin P1.3 of the STC12C5a60S2 single chip microcomputer S2 sends the fused data information from the slave transceiver S6 to the pin P4.6 of the STC12C5a60S2 single chip microcomputer slave S7 sequentially through the MAX3232 host transceiver S3 and the MAX3232, and then the STC12C5a60S2 single chip microcomputer sends the data information received by the STC12C5a60S2 single chip microcomputer from the pin P4.6 of the S7 to the pin SDI/D2 of the CH376S file management control chip S8 from the pin P0.6 of the S7. Preferably, the CH376S file management control chip S8 can automatically recognize the connection and disconnection of the TF card S9, has a fast read/write speed, and supports a low power consumption mode. And then the pin SD _ DI of the CH376S file management control chip S8 sends the Data information received by the pin SDI/D2 of the CH376S file management control chip S8 to the pin Data0/DO of the TF card S9, the Data information is stored in a TXT file mode, after the sensor Data is stored in real time, the G5V relay S1 restores the disconnected state, and the power supply to the sensor is stopped.
The CH376S file management control chip S8 is connected with the STC12C5A60S2 singlechip slave S7, is used for writing sensor data into the TF card S9, can automatically identify connection and disconnection of the TF card S9, is high in reading and writing speed, and supports a low power consumption mode.
The TF card S9 is connected to the CH376S file management control chip S8 and is used for storing sensor data in real time.
A water quality data acquisition and storage method based on double singlechips is realized based on a water quality data acquisition and storage system, and can continuously sample and automatically store water quality sensor data information in a special environment of a water source area. The method specifically comprises the following steps:
step 1: and (3) initializing parameters after starting a data acquisition program of the water quality acquisition and storage system, specifically comprising time initialization, namely setting the time as the current Beijing standard time. Meanwhile, a pin P1.4 of the SCC 12C5A60S2 singlechip microcomputer S2 is set to be low potential, at the moment, the G5V relay S1 is in an off state, and the sensor is not electrified;
step 2: establishing a working mode, and entering a main circulation program in a polling mode;
and step 3: the STC12C5A60S2 single-chip microcomputer host S2 judges whether the power supply time is up, if so, the G5V relay S1 is closed, and power supply is started to the sensor; if not, continuing to wait for the power supply time. The power supply time is advanced by at least one minute relative to the sampling time, but not limited to one minute, and the method can effectively reduce the power consumption of the water quality acquisition and storage system on the basis of normal power supply of the normal sensor;
and 4, step 4: the STC12C5A60S2 single chip microcomputer host S2 judges whether the sampling time is up, if so, a pin P3.1 of the STC12C5A60S2 single chip microcomputer host S2 sends a sensor instruction to a pin 2 of an RS232 interface S4 through an MAX3232 host transceiver S3, then the sensor instruction is sent to a sensor through interfaces A and B of an RS232/RS485 converter S5, and the sensor waits for the sensor to return data; if not, continuing to wait for the sampling time;
and 5: data returned by the sensor is sent to a pin 3 of an RS232 interface S4 through interfaces A and B of an RS232/RS485 converter S5, and then sent to a pin P4.6 of an STC12C5A60S2 singlechip host S2 through an MAX3232 host transceiver S3;
step 6: the STC12C5A60S2 single chip microcomputer S2 judges whether the data format is correct, if so, extracts the valid data bit in the received sensor data, and fuses the current time information and the valid data bit, namely the fused data is the data information comprising the current time information and the valid data bit; if not, fusing the current time information and the error flag bit F, namely fusing the data comprising the current time information and the error flag bit F. The error flag bit F is used for prompting that the data information acquired by the user is wrong and needs to be solved and processed in time;
and 7: the pin P1.3 of the STC12C5A60S2 singlechip host S2 sends the fused Data information to the pin P4.6 of the STC12C5A60S2 singlechip slave S7 through MAX3232 host transceiver S3 and MAX3232 in sequence from the transceiver S6, then the Data information is sent to the pin SDI/D2 of the CH376S file management control chip S8 through the pin P0.6 of the STC12C5A60S2 singlechip S7, and then the Data information is sent to the pin SD _ DI of the CH376S file management control chip S8 to the pin Data0/DO of the TF card S9 through the pin SD _ DI of the CH376S file management control chip S8, so that the Data information is stored in a TXT file form;
and 8: the relay S1 of G5V returns to the off state, and stops supplying power to the sensor;
and step 9: in the next cycle, repeating steps 3-8, the operator can obtain the collected sensor data information by reading the file content in the TF card.
The invention has the characteristics and benefits that: the design scheme of 'master-slave' is adopted, and STC12C5A60S2 double singlechips are used for data communication. The double singlechips respectively undertake corresponding work tasks in the system, and the data transmission process is controlled through multi-serial port communication, so that the working efficiency and the transmission rate of serial port communication are greatly improved. Furthermore, the invention is provided with the RS232/RS485 converter, so that the common-mode interference resistance is strong, and the working stability of the system is improved. Meanwhile, by adopting the design scheme of power supply before sampling and power off after sampling, the method effectively saves electric power on the basis of ensuring normal power supply to the sensor, and has obvious effect particularly when a power supply such as solar energy is used outdoors. In addition, the invention is respectively provided with a MAX3232 transceiver aiming at the double singlechips, on one hand, the electric elements can be protected from being damaged by human static electricity through the built-in static protection circuit, and on the other hand, the power consumption of the system can be effectively reduced. The invention can realize the continuous acquisition and automatic storage of water quality data of the water source area, improve the accuracy of data acquisition and ensure the accuracy of data.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a water quality data acquisition and storage system based on a double-single-chip microcomputer.
Fig. 2 is a program flow chart of an embodiment of a water quality data acquisition and storage method based on a double-singlechip.
In the figure: an S1-G5V relay; S2-STC12C5A60S2 single chip microcomputer host; S3-MAX3232 host transceiver; an S4-RS232 interface; an S5-RS232/RS485 converter; S6-MAX3232 slave transceiver; the S7-STC12C5A60S2 singlechip slave machine; S8-CH376S file management control chip; S9-TF card.
Detailed Description
The following detailed description of the invention refers to the accompanying drawings.
A water quality data acquisition and storage system based on double singlechips mainly comprises an STC12C5A60S2 double singlechips, a G5V relay S1, a MAX3232 double transceiver, an RS232 interface S4, an RS232/RS485 converter S5, a CH376S file management control chip S8, a TF card S9 and the like which jointly control the whole system.
The STC12C5A60S2 double-singlechip microcomputer is characterized in that an STC12C5A60S2 singlechip microcomputer S2 serves as a main control singlechip microcomputer, has double serial ports, mainly completes acquisition of sensor data and controls the on-off of a relay; the STC12C5A60S2 double-singlechip microcomputer is used as an auxiliary singlechip microcomputer from an STC12C5A60S2 slave computer S7, has double serial ports and mainly completes storage work of sensor data. The MAX3232 master transceiver S3 and the MAX3232 slave transceiver S6 in the MAX3232 dual transceiver are used for reducing the power consumption of the system, and are internally provided with electrostatic protection circuits to protect electric elements from being damaged by human static electricity.
The STC12C5A60S2 single chip microcomputer host S2 is respectively connected with a G5V relay S1 and a MAX3232 host transceiver S3, the MAX3232 host transceiver S3 is respectively connected with an RS232 interface S4 and a MAX3232 slave transceiver S6, the RS232 interface S4 is connected with an RS232/RS485 converter S5, and the MAX3232 slave transceiver S6 is sequentially connected with the STC12C5A60S2 single chip microcomputer slave S7, a CH376S file management control chip S8 and a TF card S9.
The working state of the G5V relay S1 is controlled by the single chip microcomputer S2 of STC12C5A60S2 so as to control the power supply state of the sensor. When the pin P1.4 of the SCC 12C5A60S2 singlechip microcomputer S2 is at low potential, the G5V relay S1 keeps off state, and the sensor is not electrified; at high, relay S1 remains closed at G5V, which energizes the sensor. The STC12C5A60S2 singlechip microcomputer S2 judges whether the power supply time is up, if so, the G5V relay S1 is closed, and power supply is started to the sensor; if not, continuing to wait for the power supply time to arrive. When the power supply time reaches, the STC12C5A60S2 singlechip microcomputer S2 judges whether the sampling time reaches, if the sampling time reaches, a pin P3.1 of the STC12C5A60S2 singlechip microcomputer S2 sends a sensor instruction to a pin 2 of an RS232 interface S4 through an MAX3232 mainframe transceiver S3, the RS232 interface S4 is used for carrying out serial communication in the sensor data acquisition process, and then an A interface and a B interface of an RS232/RS485 converter S5 send the sensor instruction received by the pin 2 of the RS232 interface S4 to a sensor. Preferably, the RS232/RS485 converter S5 is used for serial communication signal conversion between the RS232 and the RS485, and the a and B interfaces thereof transmit data in a differential signal transmission manner, so that the common-mode interference resistance is improved, and the system operation stability is favorably enhanced. And if the sampling time is not reached, continuing to wait for the arrival of the sampling time.
The A and B interfaces of the RS232/RS485 converter S5 transmit data returned by the sensor to a pin P4.6 of an STC12C5A60S2 singlechip host S2 through a pin 3 of an RS232 interface S4 and a MAX3232 host transceiver S3 in sequence, and then data fusion is carried out. Then the pin P1.3 of the STC12C5a60S2 single chip microcomputer S2 sends the fused data information from the slave transceiver S6 to the pin P4.6 of the STC12C5a60S2 single chip microcomputer slave S7 sequentially through the MAX3232 host transceiver S3 and the MAX3232, and then the STC12C5a60S2 single chip microcomputer sends the data information received by the STC12C5a60S2 single chip microcomputer from the pin P4.6 of the S7 to the pin SDI/D2 of the CH376S file management control chip S8 from the pin P0.6 of the S7. Preferably, the CH376S file management control chip S8 can automatically recognize the connection and disconnection of the TF card S9, has a fast read/write speed, and supports a low power consumption mode. And then the pin SD _ DI of the CH376S file management control chip S8 sends the Data information received by the pin SDI/D2 of the CH376S file management control chip S8 to the pin Data0/DO of the TF card S9, the Data information is stored in a TXT file mode, after the sensor Data is stored in real time, the G5V relay S1 restores the disconnected state, and the power supply to the sensor is stopped.
A water quality data acquisition and storage method based on double singlechips is realized based on a water quality data acquisition and storage system, and comprises the following steps in a special environment of a water source area:
step 1: and (3) initializing parameters after starting a data acquisition program of the water quality acquisition and storage system, specifically comprising time initialization, namely setting the time as the current Beijing standard time. Meanwhile, a pin P1.4 of the SCC 12C5A60S2 singlechip microcomputer S2 is set to be low potential, at the moment, the G5V relay S1 is in an off state, and the sensor is not electrified;
step 2: establishing a working mode, and entering a main circulation program in a polling mode;
and step 3: the STC12C5A60S2 single-chip microcomputer host S2 judges whether the power supply time is up, if so, the G5V relay S1 is closed, and power supply is started to the sensor; if not, continuing to wait for the power supply time. The power supply time is advanced by at least one minute relative to the sampling time, but not limited to one minute, and the method can effectively reduce the power consumption of the water quality acquisition and storage system on the basis of normal power supply of the normal sensor;
and 4, step 4: the STC12C5A60S2 single chip microcomputer host S2 judges whether the sampling time is up, if so, a pin P3.1 of the STC12C5A60S2 single chip microcomputer host S2 sends a sensor instruction to a pin 2 of an RS232 interface S4 through an MAX3232 host transceiver S3, then the sensor instruction is sent to a sensor through interfaces A and B of an RS232/RS485 converter S5, and the sensor waits for the sensor to return data; if not, continuing to wait for the sampling time;
and 5: data returned by the sensor is sent to a pin 3 of an RS232 interface S4 through interfaces A and B of an RS232/RS485 converter S5, and then sent to a pin P4.6 of an STC12C5A60S2 singlechip host S2 through an MAX3232 host transceiver S3;
step 6: the STC12C5A60S2 single chip microcomputer S2 judges whether the data format is correct, if so, extracts the valid data bit in the received sensor data, and fuses the current time information and the valid data bit, namely the fused data is the data information comprising the current time information and the valid data bit; if not, fusing the current time information and the error flag bit F, namely fusing the data comprising the current time information and the error flag bit F. The error flag bit F is used for prompting that the data information acquired by the user is wrong and needs to be solved and processed in time;
and 7: the pin P1.3 of the STC12C5A60S2 singlechip host S2 sends the fused Data information to the pin P4.6 of the STC12C5A60S2 singlechip slave S7 through MAX3232 host transceiver S3 and MAX3232 in sequence from the transceiver S6, then the Data information is sent to the pin SDI/D2 of the CH376S file management control chip S8 through the pin P0.6 of the STC12C5A60S2 singlechip S7, and then the Data information is sent to the pin SD _ DI of the CH376S file management control chip S8 to the pin Data0/DO of the TF card S9 through the pin SD _ DI of the CH376S file management control chip S8, so that the Data information is stored in a TXT file form;
and 8: the relay S1 of G5V returns to the off state, and stops supplying power to the sensor;
and step 9: in the next cycle, repeating steps 3-8, the operator can obtain the collected sensor data information by reading the file content in the TF card.
The above examples merely represent embodiments of the present invention and are not to be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make several simple deductions or substitutions without departing from the spirit of the present invention, and all should be considered as falling within the protection scope of the present invention.

Claims (2)

1. A water quality data acquisition and storage system based on double singlechips is characterized by mainly comprising an STC12C5A60S2 double singlechips, a G5V relay (S1), a MAX3232 double transceiver, an RS232 interface (S4), an RS232/RS485 converter (S5), a CH376S file management control chip (S8) and a TF card (S9) which jointly control the whole system;
the STC12C5A60S2 double-singlechip microcomputer is characterized in that a STC12C5A60S2 singlechip microcomputer (S2) is used as a main control singlechip microcomputer, is provided with double serial ports, mainly completes the acquisition of sensor data and controls the on-off of a relay;
an STC12C5A60S2 singlechip slave (S7) in the STC12C5A60S2 double singlechips is used as an auxiliary singlechip, has double serial ports and mainly completes the storage work of sensor data;
the working state of the G5V relay (S1) is controlled by a single chip microcomputer (S2) with STC12C5A60S2 to control the power supply state of the sensor; when the pin P1.4 of the STC12C5A60S2 singlechip microcomputer (S2) is at low potential, the G5V relay (S1) keeps an off state, and the sensor is not electrified; when the potential is high, the relay (S1) of G5V keeps a closed state, and the sensor is electrified; the STC12C5A60S2 single chip microcomputer host (S2) judges whether the power supply time is up, if so, the G5V relay (S1) is closed, and power supply is started to the sensor; if not, continuing to wait for the power supply time to arrive;
the MAX3232 host transceiver (S3) in the MAX3232 dual transceiver is connected with the STC12C5A60S2 single chip microcomputer host (S2) and used for reducing the power consumption of the system, and a static protection circuit is arranged in the MAX3232 dual transceiver to protect electric elements from being damaged by human static electricity;
the MAX3232 slave transceiver (S6) in the MAX3232 dual transceiver is connected with the STC12C5A60S2 single chip microcomputer slave (S7) and used for reducing the power consumption of the system, and a static protection circuit is arranged in the MAX3232 dual transceiver to protect electric elements from being damaged by human static electricity;
the RS232 interface (S4) is connected with the MAX3232 host transceiver (S3) and is used for carrying out serial communication in the sensor data acquisition process;
the STC12C5A60S2 single chip microcomputer host (S2) is respectively connected with a G5V relay (S1) and a MAX3232 host transceiver (S3), the MAX3232 host transceiver (S3) is respectively connected with an RS232 interface (S4) and a MAX3232 slave transceiver (S6), the RS232 interface (S4) is connected with an RS232/RS485 converter (S5), and the MAX3232 slave transceiver (S6) is sequentially connected with the STC12C5A60S2 single chip microcomputer slave (S7), a CH376S file management control chip (S8) and a TF card (S9);
the RS232/RS485 converter (S5) is connected to an RS232 interface (S4) and used for serial port communication signal conversion between RS232 and RS485, and the A and B interfaces of the RS232/RS485 converter (S5) transmit data returned by the sensor to a pin P4.6 of an STC12C5A60S2 single chip microcomputer (S2) through a pin 3 of the RS232 interface (S4) and a MAX3232 host transceiver (S3) in sequence and then perform data fusion;
the CH376S file management control chip (S8) is connected with the STC12C5A60S2 singlechip slave (S7) and used for writing sensor data into the TF card (S9), can automatically identify the connection and disconnection of the TF card (S9), has high reading and writing speed and supports a low power consumption mode;
the TF card (S9) is connected to the CH376S file management control chip (S8) for storing sensor data in real time.
2. The water quality data acquisition and storage method realized by the water quality data acquisition and storage system based on the double singlechips is characterized in that the method is realized by the water quality data acquisition and storage system, and can continuously sample and automatically store the data information of the water quality sensor in the special environment of a water source area; the method specifically comprises the following steps:
step 1: starting a data acquisition program of the water quality acquisition and storage system and then carrying out parameter initialization, specifically comprising time initialization, namely setting the time as the current Beijing standard time; meanwhile, a pin P1.4 of the STC12C5A60S2 singlechip microcomputer (S2) is set to be low potential, the G5V relay (S1) is in an off state, and the sensor is not electrified;
step 2: establishing a working mode, and entering a main circulation program in a polling mode;
and step 3: the STC12C5A60S2 single chip microcomputer host (S2) judges whether the power supply time is up, if so, the G5V relay (S1) is closed to start to supply power to the sensor; if not, continuing to wait for the power supply time; the power supply time is advanced by at least one minute relative to the sampling time;
and 4, step 4: the STC12C5A60S2 single chip microcomputer host (S2) judges whether the sampling time is up, if so, a pin P3.1 of the STC12C5A60S2 single chip microcomputer host (S2) sends a sensor instruction to a pin 2 of an RS232 interface (S4) through a MAX3232 host transceiver (S3), then the sensor instruction is sent to a sensor through interfaces A and B of an RS232/RS485 converter (S5), and the sensor returns data; if not, continuing to wait for the sampling time;
and 5: the data returned by the sensor is sent to the pin 3 of the RS232 interface (S4) through the A and B interfaces of the RS232/RS485 converter (S5), and then sent to the pin P4.6 of the STC12C5A60S2 single chip computer (S2) through the MAX3232 host transceiver (S3);
step 6: the STC12C5A60S2 single chip microcomputer host (S2) judges whether the data format is correct, if so, extracts the valid data bit in the received sensor data, and fuses the current time information and the valid data bit, namely the fused data is the data information comprising the current time information and the valid data bit; if not, fusing the current time information and the error flag bit F, namely fusing the data comprising the current time information and the error flag bit F; the error flag bit F is used for prompting that the data information acquired by the user is wrong and needs to be solved and processed in time;
and 7: the pin P1.3 of the STC12C5A60S2 single chip microcomputer host (S2) transmits the fused Data information to the pin P4.6 of the STC12C5A60S2 single chip microcomputer slave (S7) sequentially through the MAX3232 host transceiver (S3) and the MAX3232 slave transceiver (S6), then the pin P0.6 of the STC12C5A60S2 single chip microcomputer slave (S7) is transmitted to the pin SDI/D2 of the CH376S file management control chip (S8), and then the pin SD _ DI of the CH376S file management control chip (S8) is transmitted to the pin Data0/DO of the CH376 9) to store the Data information in the form of a TXT file;
and 8: the G5V relay (S1) restores the off state and stops supplying power to the sensor;
and step 9: in the next cycle, repeating steps 3-8, the operator can obtain the collected sensor data information by reading the file content in the TF card.
CN202010043971.XA 2020-01-15 2020-01-15 Water quality data acquisition and storage system and method based on double single-chip microcomputers Pending CN111142450A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010043971.XA CN111142450A (en) 2020-01-15 2020-01-15 Water quality data acquisition and storage system and method based on double single-chip microcomputers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010043971.XA CN111142450A (en) 2020-01-15 2020-01-15 Water quality data acquisition and storage system and method based on double single-chip microcomputers

Publications (1)

Publication Number Publication Date
CN111142450A true CN111142450A (en) 2020-05-12

Family

ID=70525229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010043971.XA Pending CN111142450A (en) 2020-01-15 2020-01-15 Water quality data acquisition and storage system and method based on double single-chip microcomputers

Country Status (1)

Country Link
CN (1) CN111142450A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112525270A (en) * 2020-11-16 2021-03-19 宁波水表(集团)股份有限公司 Novel water meter data acquisition method and data acquisition system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070174451A1 (en) * 2006-01-20 2007-07-26 Zhang Huaguang Distributed Networked Data Acquisition Device
CN101598938A (en) * 2009-05-25 2009-12-09 成都前锋电子有限责任公司 Double-singlechip control system for gas instantaneous water heater
CN108536240A (en) * 2017-11-27 2018-09-14 山东农业大学 The desert information acquisition system and method for dual processors collaboration
CN109828095A (en) * 2019-04-04 2019-05-31 大连理工大学 A kind of storage of water quality monitoring system data, wireless transmission and long-range control method based on Internet of Things

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070174451A1 (en) * 2006-01-20 2007-07-26 Zhang Huaguang Distributed Networked Data Acquisition Device
CN101598938A (en) * 2009-05-25 2009-12-09 成都前锋电子有限责任公司 Double-singlechip control system for gas instantaneous water heater
CN108536240A (en) * 2017-11-27 2018-09-14 山东农业大学 The desert information acquisition system and method for dual processors collaboration
CN109828095A (en) * 2019-04-04 2019-05-31 大连理工大学 A kind of storage of water quality monitoring system data, wireless transmission and long-range control method based on Internet of Things

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112525270A (en) * 2020-11-16 2021-03-19 宁波水表(集团)股份有限公司 Novel water meter data acquisition method and data acquisition system
CN112525270B (en) * 2020-11-16 2023-04-07 宁波水表(集团)股份有限公司 Novel water meter data acquisition method and data acquisition system

Similar Documents

Publication Publication Date Title
CN207780960U (en) A kind of wireless data acquisition system
CN102830681B (en) A kind of method for supervising of remote electric energy consumption data
CN201707782U (en) Intelligent meter reading system based on GPRS (General Packet Radio Service)
CN102376153B (en) The method of collector and carrier wave meter remote upgrade in automatic meter reading system
CN102331485B (en) Portable water quality monitor
CN104950760A (en) Power supply management integrated marine monitoring general data collector
CN103678728A (en) High-speed data recording system based on FPGA+DSP framework and establishment method thereof
CN103024007A (en) Long-distance water environment monitor and monitoring method based on Zigbee and GPRS
CN101661276A (en) Universal data acquisition unit and data acquisition method thereof
CN101581590A (en) Camera direct-reading meter with low power consumption and remote transmission device
CN109828095A (en) A kind of storage of water quality monitoring system data, wireless transmission and long-range control method based on Internet of Things
CN104820725B (en) Sea surface Lagrange measurement data acquisition system
CN104361730A (en) Data transferring system and data transferring method of intelligent metering device
CN206258860U (en) A kind of data collection station based on Internet of Things and cloud
CN111142450A (en) Water quality data acquisition and storage system and method based on double single-chip microcomputers
CN211180608U (en) Water quality data acquisition and storage system based on double single-chip microcomputers
CN202033633U (en) GPRS remote energy saving monitoring device of heat exchange station
CN202721501U (en) Distribution power automation terminal
CN202110651U (en) Automatic monitoring device of ground source heat pump system
CN103675440A (en) Power efficiency monitoring terminal and monitoring method thereof
CN205428177U (en) Automatic data logging system based on zigBee
CN205354313U (en) Data acquisition device in wireless node instrument
CN201315016Y (en) Signal acquiring device
CN211235828U (en) Control monitoring system for water quality on-line monitoring
CN107845249A (en) A kind of aircraft fluid wireless monitor system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination