Real-Time Monitoring of pH and Water Levels and Automation of Chlorine Control in Sewage Treatment Using CompactRIO and LabVIEW

Cherie DY J. Arao, Adamson University

"With a system based on CompactRIO and LabVIEW, the Adamson University sewage treatment plant now has a solution that closely monitors the pH and water level of the equalization and clean water tanks in real-time without having to take samples to analyze in a laboratory outside the university."

- Cherie DY J. Arao, Adamson University

The Challenge:

Designing a system for Adamson University’s sewage treatment plant (STP) to automate chlorine control and monitor the pH and water level for equalization and clean water tanks in real time.

The Solution:

Using NI CompactRIO along with NI DAQ hardware programmed with NI LabVIEW and the LabVIEW Real-Time Module to automate and monitor the STP.


Cherie DY J. Arao - Adamson University
Perdi L. Barbadillo - Adamson University
Nelson JR. G. Biscocho - Adamson University
Krizzel M. Silapan - Adamson University
Ardinne E. Sugian - Adamson University


The sustainability of available water resources and treatment of wastewater are a global concern. The cleanliness of surface water is most important in ensuring sustainable use. Water is used for agriculture, industry, and domestic consumption; therefore efficient use and water monitoring are potential constraints for home, office, or industrial water management system.

The Adamson University sewage treatment plant (STP) treats wastewater to comply with different republic acts and department orders set forth by the government. These laws involve wastewater treatment and other bodies of water, specifically the Philippine Clean Water Act of 2004, the Toxic Substances and Hazardous and Nuclear Wastes Control Act of 1990, and the DENR Administrative Order Nos. 34 and 35. Initially, the STP is manually monitored with random pH level testing. This is important because wastewater must be precisely and correctly treated for proper use.

The STP releases used water to monitor and treat. We keep thlae water clean and free from contaminants to ensure product quality and acceptable exposure levels through treatment. We need to collect samples, monitor them, and test the pH levels to remove and eliminate storage risks and any additional toxic chemicals it contains. Because a portion of this water is partially reused among toilets, this procedure must be dependable and accurate.

Proper monitoring of wastewater treatment in the STP ensures water sustainability linked to sensing and automation.

Study Background

The law of conservation of mass states that “matter is neither created nor destroyed.” When water is produced and disposed, waste does not disappear— it has to go somewhere. The STP reduces the total amount of waste water disposed, and then a portion of the treated water is reused.

The Philippine Clean Water Act of 2004 (RA 9275) aims to improve water quality, regulate and manage water pollution, design water quality management areas, and prepare a national sewerage and septage management program. This act, which is designed to protect Philippine water bodies from pollutions created by different sources suggests a variety of ways to manage the pollution that affects the country’s water.

Electronic engineering students at Adamson University took on this project when they learned about the declining quality of fresh water sources due to pollution that leads to a shortage in the freshwater supply. To help with waste water treatment, our proposal assists with STP monitoring for the continuous supply of treated wastewater.



Hardware Setup

The NI cRIO-9073 is the main controller of the system (see Figure 1). The NI 9474 and NI 9203 C Series modules directly connect to the controller to acquire pH and water levels, respectively. The servo motor automates the control and/or flow of chlorine when needed. A pH transmitter provides a standard 4 mA to 20 mA current output proportional to the pH measured. The two pH sensors and two water-level sensors detect according to the set algorithm of programs, and then the computer displays the results..



Program Development

At the start of the process, the pH and water level sensors in the tank, come in contact with the sewage treatment water to detect whether it is an acid, base, or neutral and identify the water level. The system distinguishes treated water with a pH level higher than nine as base, pH lower than six as acid, and an obtained pH value equal to seven as neutral. If the water level of the tank, does not reach the specific critical level,  the system goes back to start and senses the water level. However, when the water level reaches its maximum amount, it may overflow and activates the alarm in the server. The pH and water level detection, is communicated to  the CompactRIO controller and its modules, which transmit the data to the server’s PC via Ethernet cable. See Figure 2 for the system flow chart.


Measurement Matrix

Tables 1, 2, and 3 are the matrices of the STP measurement system. A particular ampere reading is equivalent to the same pH level as water level except that it is expressed in feet and percentages depending on the volume of the tank. We used this matrix throughout system development.




Final Testing

Trial 2 of the final pH testing in equalization and clean water tanks showed great improvement (see Table 4). One sample was equivalent to 5 seconds of deployment in the system. The table displays the results of pH and water level and indicates if the alarm was triggered. A pH level of 6 to -9 was acceptable per DO recommendations. The water level increased and the pressure sensor could still measure it. The external chlorine tank showed no significant changes at 100 percent full.


Measurement may be the same in pH and water level but different in current reading. Water level reading percentage changes based on matrix of measurement. We now can control the chlorine tank in the office with the servo motor.



Remote, Rugged Monitoring

With a system based on CompactRIO and LabVIEW, the Adamson University sewage treatment plant now has solution that closely monitor the pH and water level of the equalization and clean water tanks in real-time without having to take samples to analyze in a laboratory outside the university. The chlorine tank is automated for complete monitoring and treatment, and the system generates data- logging reports for tracking.



The cRIO-9073 integrated system with a real-time processor suited the demands of our STP project. With its ruggedness, it can stand inevitable weather conditions at the site of the project. With the built-in Ethernet port, it can communicate via the network from the site to the base station.



We used the NI 9203 C Series DAQ module with eight analog current input channels as the main frame for the pH and water level sensors of the system. The NI 9474 module directly connected to a variety of industrial devices such as the servo motor the system.



We used LabVIEW to develop complicated VIs for the project. The LabVIEW Real-Time Module enhances the system by helping us set up real-time targets to build, debug, and deploy real-time applications.


Author Information:

Cherie DY J. Arao
Adamson University
900 San Marcelino St., Ermita, Manila
Tel: 639153532395

Figure 1. System Block Diagram of Real-Time Monitoring of pH and Water Level and Automation of Chlorine Control.
Figure 2. Flowchart of System Software.
Table 4 Data Results for the Final Testing of Sensors at STP
Table 1 Matrix of Measurement of Corresponding pH Level With Respect to Current and Interpretation
Table 2 Matrix of Measurement of Corresponding Water Level With Respect to Current Percentage at 5 Feet
Table 3 Matrix of Measurement of Corresponding Water Level With Respect to Current and Percentage at 35 Feet
Figure 7. Table 5. Data Log
Figure 3. Project Site, Side 1
Figure 4. Equalization Tank With pH Probe and Transmitter Installed
Figure 5 pH Transmitter at Equalization Tank
Figure 6 pH Transmitter in Clean Water Tank
Figure 7. pH and Water Level Sensor Installed
Figure 8. Chlorine Tank With Servo Motor Installed
Figure 9 Servo Motor Installed at Knob of Tank to Control Flow
Figure 10. Central Processing Unit
Figure 11. Project Site: Side 2
Figure 12. Final VI. Composed of Sub-VIs to Complete Process
Figure 13. User Interface