A Low-cost Wireless Water Quality Auto-monitoring System

The water quality monitoring plays an important role in water contamination surveillance and guides the water resource protection for safe and clean water. A flexible automated real-time water quality monitoring and alarm system based on the wireless sensor network(WSN) is proposed. The WSN is built in accordance with Zigbee communication protocol, which consists of the sensor nodes, route nodes and coordinator node. The sensor nodes based on cheap and efficient sensors (pH electrode, dissolved oxygen electrode, temperature senor) and wireless transreceiver collect the environmental data and transmit to the coordinator node via the route nodes. The data are sent to the remote monitoring center with the help of GPRS. The time synchronous algorithm is adopted to wake up all the nodes in the network to improve the stability and reliability of the communication. The long-time measurement results verify the real time and accuracy in data acquisition and stability and reliability in communication. The system meets the requirements of water quality monitoring, and has great practical value.


INTRODUCTION
Water is one of the most critical resources for human well-being and vital for industry and agriculture. With the rapid development of economy, the illegal discharge of toxic chemicals and untreated domestic waste water leads to the water pollution. The fishery resources decreases, and the aquatic species significantly reduce. The ecological environment is damaged, and human health is endangered. It is imminent to effectively protect the aquatic environment and comprehensively improve the water quality. The water quality monitoring, the quantifiable measurement of water quality variables over time, plays an important role in reflecting the water quality. It is an important basis of environmental protection measures for safe and clean water. Higher and higher requirements on water quality monitoring system are put forward.
The traditional manual method of water quality monitoring involves the collection of water samples at various locations and at different time, which are transported to a chemical laboratory for analysis. It is too slow to protect the public health in real time. Some pollution might be missed. The kind of approach is no longer efficient. The modern integrated remote monitoring systems can provide the comprehensive chemical and biological analysis of the water quality.
However, only a small number of locations are sampled and analyzed, which can not obtain the critical decisions of water protection. And the financial burden for the high-technology facilities is not affordable to the most enterprises. An automated, remote, real-time and lowcost water quality monitoring system without visiting to the water location frequently is required.
The advancements in MEMS technologies motivate the rapid development of small and inexpensive sensors. The wireless sensor network (WSN) makes use of a large number of extremely small low-cost sensors, microcontroller and low power transceivers to collect, process signal and communicate at a minimal cost with high precision. It is easy for WSN to achieve the rapid and flexible deployment in a variety of environments. It empowers us for continuous monitoring of water quality. The different types of sensors are incorporated in the sensor nodes distributed in wide areas to measure the water parameters. The data collected by the sensor nodes are transmitted to the coordinator node to determine the characteristics of the environment. A timely alarm is triggered when the parameters go beyond the restricted range. That appropriate steps will be taken. The data communication is based on ZigBee protocol. ZigBee is a kind of low-complexity, low-power dissipation, low-data rate and low-cost wireless network technology. It can accommodate 64000 sensor nodes to communicate mutually. Only tens of micro-ampere current is required for the sensor nodes to guarantee the network connection.
An automated low-cost remote water quality monitoring system based on the wireless sensor network is presented in the paper to collect and upload the environmental data. The data are analyzed in the monitoring center for the dynamic water environment change that is helpful to control the water quality in time. It meets the requirements of water quality monitoring. This paper is organized as following. The system architecture design is given in section 1. Section 2 presents the system hardware design. The choice of sensors, signal processing circuit design, wireless transreceiver, microcontroller and GPRS module are introduced in detail. Section 3 proposes the system software design. The software flows of the sensor nodes and coordinator node are illuminated. Section 4 validates the performance of the system, and the measurement results are shown. Finally, section 5 draws the conclusion. PAPER A LOW-COST WIRELESS WATER QUALITY AUTO-MONITORING SYSTEM II. SYSTEM DESIGN The choice of system architecture needs to consider the requirements of reliability, security and inexpensiveness for the remote monitoring system. The network topology is also an important problem to be considered carefully. It has a direct effect on the latency, robustness, capacity of the network and the complexity of data routing.
The designed water quality monitoring system is divided into three parts: wireless sensor networks, GPRS networks and monitoring center for data collection, processing, transmission and analysis, as shown in figure  1. The wireless sensor network includes three parts: the sensor nodes, the route nodes and the coordinator node. The low-cost sensor nodes deployed within the monitored areas collect the water quality parameters. The data are transmitted to the coordinator node by the multihop relay communication way after processed by the route nodes. The coordinator node uploads the data to the monitoring center by the GPRS network. Once the data are abnormal, the system immediately alarms. The monitoring center can remotely configure the parameters and send the control commands. The commands are transmitted to the coordinator node and forwarded to the sensor nodes by the route nodes. The system has the advantages of wide distribution monitoring points, flexible network and low cost.
The sensor nodes are an important part of the system. The circuit includes five parts: the sensor module, signal processing module, processor module, wireless communication module and power module. The sensors convert the various environmental factors of nonelectricity into weak electrical signals which are shaped, amplified and filtered by the signal conditioning circuit for the standard signal. It is transmitted to the A/D converter integrated in CC2430 chip for digital signals. The nodes enter into sleep mode when they are idle. The low power consumption should be mainly considered in designing the sensor nodes.
The route nodes not only detect the water quality information, but also collect the data of all the sensor nodes within the monitoring area. The hardware circuit is identical with the sensor nodes.
The coordinator node is constituted with the microcontroller MSP430F149, CC2430 transreceiver, GPRS module and EEPROM, the circuit diagram is shown in figure 2.

A. MSP430F149 microprocessor
The MSP430F149 microcontroller produced by TI is a 16-bit, ultra-low power, RISC mixed-signal processors. It is very suitable for the low power applications. The MSP430F149 has 60kB +256 byte flash, 2kB RAM, 16 interrupt sources, a watchdog timer, two 16-bit timers, two serial channels, 8-channel 12-bit A/D converter and on-chip comparators etc. The peripheral circuit is shown in figure 3. The massive sensor nodes are required to deploy at many places in order to obtain a comprehensive monitoring of the water quality parameters. The cheap and small sensors should be selected to meet the requirements and make the wireless sensor network affordable for the most organization.
1) Signal processing circuit of pH composite electrodes PAPER A LOW-COST WIRELESS WATER QUALITY AUTO-MONITORING SYSTEM The pH value and the output voltage of the measured solution meet a linear relationship at a certain temperature. The high input impedance precision instrumentation amplifier INA116 is selected as the 1 st stage of the signal conditioning circuits. The operational amplifier OP07 is the cores of the 2 nd and 3 rd stage of the conditioning circuit. The output signal of the pH electrodes is converted into the voltage signal of 0-3V and fed to the A/D converter for digital signal.

2) Signal conditioning circuit of the dissolved oxygen electrodes
The output current of the dissolved oxygen electrode has a linear relationship with the concentration of the measured solution at a certain temperature. The output current in µA order is converted into voltage signal and amplified by 2-stage arithmetic circuits to be processed by the A/D converter. The voltage difference between the cathode and electrode is 0.7 V.

3) Temperature sensor
The temperature sensor used in the system is DS18B20 from Dallas. DS18B20 only needs a pin to realize the two-way communication with the microprocessor. No external circuits are required. It has the advantages of wear resistance, impact resistance, small volume and convenient operation. It is suited to work in the hostile environments and meets the sensor requirements of the water quality monitoring and analysis system.
The characteristics of the sensors are summarized in Table 1.

C. CC2430 short-distance wireless communication circuit
The CC2430-F128 of TI is a system-on-chip dedicating to the 2.4 GHz IEEE 802.15.4 standard and ZigBee protocol. It integrates the high-performance modules of CC2420 RF transceiver, the industrystandard enhanced 8051 microcontroller, 128kB Flash and 8kB RAM. The advantages of low-cost and simple external circuits make CC2430 very suitable for ultralow power applications.

D. GPRS module
The GTM900-C chip from Huawei is selected as the GPRS module. The GTM900-C is a two-band GSM/GPRS wireless module, and has two working bands: EGSM900 and GSM1800. The short message services support text and PDU mode. The interface circuit is shown in figure 4.

IV. SYSTEM SOFTWARE DESIGN
Due to the cumulative time deviation easily leads to wake up asynchronously when the nodes suffer from repeated cycles of arousal-data processing-sleep. This may cause the data loss, even paralyze the whole network. The time synchronization mechanism [10] is Figure 4. Interface circuit of GPRS module adopted in this paper. The nodes in the network adjust their timer to synchronize with the coordinator node and send data according to the received time slot. The stability of the network is greatly improved, and the power consumption is reduced.
The software flow chart of the sensor nodes is shown in figure 5. The program firstly initializes the hardware of CC2430 and protocol stack, then starts to scan the channels for proper network and sends a request to join the network. After the nodes successfully access the network, the address assigned by the coordinator node is obtained. Then the nodes enter into sleep mode and wait for the serial data. If receiving a query command, synchronous command or configuration command (setting the period of data collection), the nodes execute the command and transmit response. Once the acquisition timer interrupts, the nodes wake up, collect the environmental parameters, process and save the data. When the uploading timer interrupts, the nodes transmit the stored data.
The route nodes implement the network access of the sensor nodes and forward the data between the sensor nodes and coordinator node. The software flowchart is similar with the sensor nodes. They have trivial differences with the sensor nodes that the route nodes need to process the joining network requirements of their child sensor nodes and transmit the data and command between the sensor nodes and coordinator node.
The coordinator node founds the ZigBee wireless network, sends synchronization information, receives the data and uploads via GPRS module to the monitoring center, receives the commands and forwards to the lower-level node. When the data overrun, the node sends The communication and water quality parameter collection tests are performed to validate the reliability of data transmission and the correctness of data collection.

A. Communication test
The system comprises four sensor nodes, a route node and a coordinator node. The route node locating between the sensor nodes and the coordinator node is responsible for data collection and forwarding. The system uploads data once every 10 minutes. The continuous monitoring has been for five days. The communication distance is 100 meter. The coordinator node sends the synchronization signal. The sensor and route nodes start their own timers after receiving the synchronization signal. When the timers interrupt, the nodes begin to collect and send data at the required time slot. When the data transmission is completed, the nodes enter into sleep mode. There are 720 data packets sent by the sensor and route nodes. The average loss rate is computed according to the number of data packets received by the coordination node, which is less than 1%.

B. Water quality parameter collection tests
The five monitoring sites are selected for testing from a certain basin of Hunhe river. The 10-time continuous measurements are performed at every monitoring point to verify the stability of the system. The averages of the 10 measurements are calculated, and the results are shown in the system has good real-time performance, stable and reliable data transfer. The measurement accuracy and communication distance meet the requirements of water quality monitoring applications. The system can offer long-time observations on the water quality variations which can be analyzed further in the monitoring center.

VI. CONCLUSIONS
A low-cost real-time water quality monitoring system based on the wireless sensor network is proposed in the paper. The WSN is constituted with the sensor nodes, route nodes and coordinator node. The low-cost pH electrode, dissolved oxygen electrode and temperature sensor are installed in the sensor nodes for multiparameter measurement. The data gathered in the coordinator node are uploaded by GPRS module to the remote monitoring center. The alarms are triggered when the abnormal data are detected, which are helpful to take the appropriate measures. The local and remote monitoring center can control the operation of the Zigbee network by sending the commands. All the nodes in the AUTHORS Li Jinfeng is a lecturer in college of information engineering, shenyang university of chemical technology, Liaoning, Shenyang, China. Her research interests include smart meter and embedded system design.
Cao Shun(Corresponding author) is a lecturer in college of information engineering, shenyang university of chemical technology, Liaoning, Shenyang, China. His research interests include smart meter and embedded system design.