Introduction

Increasing demand for fresh potable water leads toward the requirement of different advance automatic water treatment solutions. Various water treatment solutions such as reverse osmosis (RO), microfiltration (MF), ultra-filtration (UF), nano-filtration (NF) have been explored by different researchers in the past, but RO is one of the leading water treatment solutions due to its higher water purification capacity, energy efficiency along with the capability to remove almost all toxic metals and bacteria from input water supply. The performance of RO membrane is quite sensitive and highly dependent on the quality of feed and overall plant conditions. So, RO plant needs highly accurate control and monitoring system to monitor the feed water and other plant parameters to maintain its operation close to optimum conditions. Regular maintenance of membrane and monitoring of feed water and plant parameters increase the productivity of RO plant and also reduce the chances of early membrane fouling which prolongs the life of the RO membrane and overall plant (Sobana and Rames 2011). Several control techniques such as PID (Esfahani et al. 2016), fuzzy (Zilouchian and Jafar 2001), ANN (Lee et al. 2009), optimal control (Gambier et al. 2006), predictive control (Abbas 2006) have been explored to control various RO plant parameters and maintain the plant in optimum conditions. Centralized PI controllers scheme for interfacing multivariable process has been also tried by different researchers for RO plant parameters control using synthesis method (Kumar et al. 2012). Selection of different techniques to tune the controller parameters is one of the important and challenging steps and needs to be selected based on the specific application. One of the famous techniques to tune controller parameters is the usage of compensators. Recycle compensator is one of the famous techniques to tune the controller parameters (Armbrust and Sbarbaro 2010). Minimization of RO plant energy consumption using optimal-based control (Bartman et al. 2010) along with alternative energy sources (Chaabene and Sellami 2013) for RO plants also has been introduced by different researchers. In Indian scenario, intelligent monitoring along with event prediction for RO plants is one of the essential needs to increase the life of RO membrane and also to avoid different problems such as over-/undervoltage fluctuations, dry run of high pressure and booster pumps, input water pipeline leakage, empty input water tank, overflow of output water tank. Different monitoring control tools along with efficient control strategy have been introduced for real-time monitoring and control of RO plants, but most of them are costly and bulky and predict only limited parameters such as water quality and flow rate (Torky et al. 2009). Few of the efforts also have been seen in the direction of real-time membrane fouling monitoring and early prediction using different analytical techniques (Hwang et al. 2010). Several efforts have been observed in the direction of RO plant parameters monitoring and control, but still, there are various challenges such as early fault prediction of different events such as overvoltage and undervoltage fluctuations, membrane fouling, membrane scaling, plant efficiency, water quality sensors damage which need to be addressed. Other than early fault prediction, predictive maintenance facility related to the membrane, sensors, filters maintenance for Indian RO plant operators is one of the essential needs to be tackled to increase the life of the overall plant and also maintain optimum operating conditions. The present work introduces an embedded RO plant status monitoring unit to monitor various plant parameters such as water quality (pH, TDS), input and output flow rate, input and output tank level, under- and overvoltage fluctuations along with the facility to predict different maintenance actions such as membrane water wash, membrane chemical wash, sensors calibration and cleaning, operation of RO plant. Other than this, a smartphone-based app interface also has been developed to acquire data from RO plant status monitoring unit using classical Bluetooth module and further transfer it to Google firebase cloud (Taherkordi and Frank 2016). An alternative data transfer scheme also has been implemented using 2G GSM module during the unavailability of RO plant operator. Day by day RO plant parameters data also store at the local memory of the embedded system and can be collected using any USB drive. The rest of the manuscript is organized as follows. Section II provides a detailed description of the proposed RO plant status monitoring scheme, and section III provides details of the developed embedded system for RO plant status monitoring. Section IV consists of the detailed description of the development procedure of smartphone-based android application along with its features and utility. Section V discusses the algorithms to predict different maintenance actions and events. Section VI presents testing and field trial results of developed system installed at different nearby villages of Rajasthan, and Section VII discusses discussion and conclusion.

Proposed RO plant status monitoring scheme

Overall idea is to monitor the critical parameters of RO plants installed at nearby villages of Rajasthan. Proposed monitoring scheme (Fig. 1) consists of different layers such as at local level, supervisory level and coordinator level and finally at the central level. Local level monitoring of various RO plants can be performed using developed embedded RO plant status monitoring unit and will be useful for different RO plant operators and villagers. Central level of monitoring has been performed using cloud services and could be useful for monitoring and visualization of data at any parts of the world.

Fig. 1
figure 1

Implemented RO plant status monitoring scheme for fault prediction and regular maintenance

Proposed scheme consists of parameters monitoring, data storage and computational algorithms at different levels and has fewer chances of information loss. Other than this, proposed scheme also divides overall information, models and algorithms complexity at different layers. Information collected at the local level using developed embedded RO plant status monitoring unit transfers to operator’s smartphone using Bluetooth communication. Further, collected data with plant location information are transferred to cloud level for centralized monitoring using the developed customized android app. Google firebase has been used as a cloud platform for the initial use and also to demonstrate the proof of concept. 2G GSM module is also used as a backup option for data communication from monitoring unit to the Web server. Few of the layers such as supervisory and coordinator monitoring layer also can be introduced as the complexity increases with increase in the number of local RO monitoring nodes.

Embedded system design and development for RO plant status monitoring

An embedded system (Fig. 3b) has been designed and developed to acquire real-time data of off-the-shelf sensors interfaced with RO plant to measure various plant parameters such as feed and product flow rate, input power, water level, feed and product pH, TDS. A customized hardware platform (Fig. 2) has been designed to read and store data from various sensors and also to drive different actuators used in RO plant. Developed hardware platform has been interfaced with quad-core ARMv8 processor-based microcontroller unit for data acquisition and processing. Developed touch screen-based embedded system provides the facility for a user-friendly graphical user interface for RO plant operator to monitor real-time plant data. Further, a classical Bluetooth module has been integrated with the developed embedded system to communicate with dedicated smartphone-based app interface to store data and further transfer it to cloud with location information. Developed RO plant status monitoring unit for early fault prediction and predictive maintenance is a step toward the development of an advanced, low-cost and easy to use modular embedded for RO plant status monitoring. Detailed information about firmware and software package development is as follows.

Fig. 2
figure 2

Functional block diagram of developed embedded RO plant status monitoring unit

Firmware development

RO plant status monitoring unit (Fig. 3a) has been developed in modular fashion (Fig. 4) and consists various submodules such as embedded data acquisition, monitoring and control unit along with commercial sensors with 4–20-mA current transmitters for pH and TDS sensors installed in sampling chamber for real-time feed and product water quality data collection, commercial uninterrupted power supply module (U.P.S) for power backup. The developed portable embedded system acts as a heart of the overall RO plant status monitoring unit. Embedded system consists three major sections such as dedicated designed hardware platform for sensors and actuator interfacing, an ARMv8 processor-based microcontroller unit (Raspberry pi 3) for data acquisition and processing and switch mode power supply for regulated power. Developed dedicated hardware module design composed of embedded circuitry, wherein PCB modules are indigenously designed, fabricated and interfaced with ARMv8 processor-based microcontroller unit. The resources used to develop dedicated hardware modules are Darlington array (ULN2003) to drive relay array, external E2PROM (24LC1025) for data storage at local level, port expander (MCP23017) to generate additional digital input output pins, analog-to-digital converter (ADS7828) to convert sensors analog response into digital form, buffer unit for isolation (74LS244), real-time clock (DS1307) to access the real time with data, Xbee pro module for wireless data transfer and regulators (LM7805, LM1117) of different voltage levels (+ 5 v and + 3.3 v). Developed hardware platform has been further interfaced with an ARMv8 processor-based microcontroller unit (Raspberry pi 3) for data acquisition, processing and control. A 7-inch touch display along with its local controller has been integrated with the developed embedded system to display the user-friendly graphical user interface.

Fig. 3
figure 3

a Deployed RO plant status monitoring unit and b developed embedded processing and control unit

Fig. 4
figure 4

Line diagram of reverse osmosis plant status monitoring unit integrated with reverse osmosis plant

A classical Bluetooth module has been used to transfer data from developed embedded system to smartphone-based app interface and further to cloud for future analysis. Other than this, a 2G GSM module has been used as an alternative data transfer to the server. Developed embedded system power is provided by a switched mode power supply (SMPS) that provides cleaned and filtered ± 12 V to all circuit modules. Developed embedded processing and control unit has been interfaced with various commercial sensors, which are already integrated with RO plant for measurement of different parameters.

Software package development

Various modular programs have been written in C+++ with GCC compiler for the functioning of developed embedded RO plant status monitoring unit. Open-source Qtopia platform has been used for graphical user interface development for data visualization and user interaction. Developed software package provides the number of facilities for hassle-free operation and regular maintenance. Few of the major features are on-site set point window for location-specific thresholds of pH, TDS, flow rate, real-time data visualization of various RO plant parameters, multiple data transfer options and RO plant operation steps in the local language. The main software module initializes the various water quality sensors, flow sensors, level sensors, pressure sensors, analog-to-digital converter, E2ROM, Bluetooth module, serial port, GSM module, port expander module, phase failure monitoring unit and also diagnosis of overall embedded unit. Microcontroller unit communicates with developed dedicated hardware unit using the I2C protocol to drive various actuators and also to acquire information from various sensors. Developed software package has menu-driven option with four different modes to operate RO plant status monitoring unit: First is data visualization mode, second is location-specific set point mode, third is data transfer mode, and the last one is training mode. Data visualization mode provides facility to access various RO plant parameters in real time and also to drive plant in different modes such as process mode, rinse mode, chemical wash mode and water wash mode. Location-specific set point mode has options to set upper and lower thresholds for critical sensors response such as pH, TDS and flow. System triggers alarm for RO plant operator as real-time sensors response crosses set points. Data transfer mode provides real-time data transfer options to cloud and server using 2G GSM module or operator’s smartphone-based app interface while the training mode provides stepwise points for RO plant operation in the local language. All developed modular programs are linked to the main menu graphical user interface-based program to operate RO plant status monitoring unit for fault prediction and predictive maintenance. Raspbian Jessie OS has been ported raspberry pi-based embedded system and further developed software package transferred on raspberry pi 3-based embedded system.

Smartphone-based android app and Web page-based data visualization and analytics interface

Data communication from embedded RO plant status monitoring unit to cloud or Web server is a challenging and difficult task in different Indian remote locations. One of the major challenges faced during the installation of RO plant status monitoring units at different villages is the availability of network for data transfer. Initially, 2G GSM module has been used to communicate data from RO plant status monitoring system to the server, but various problems have been faced related to network availability. The strength of different firm’s network changes from village to village. A new innovative approach of data transfer from embedded unit to the cloud has been implemented to tackle above-mentioned problems. Proposed approach consists of two-step data transfer: First is from embedded RO monitoring unit to the smartphone-based android app, and second is from smartphone to cloud using operators smartphone. A dedicated smartphone-based app interface has been developed to transfer data from RO plant status monitoring unit to smartphone and further to cloud. Open-source android studio platform has been used for smartphone-based app interface development. Developed smartphone-based app interface provides a front end view to display different RO plant parameters such as pH, TDS, feed and product water flow, input power status, input and output tank level, input pipeline status, plant modes running status and the overall status of the plant. The developed app also provides options to transfer per minute RO plant data along with location information to Google firebase cloud. Further, a dedicated Web page has been developed to access the cloud for real-time data visualization. The developed Web page provides real-time information of all installed RO plant process variables such as feed and product pH, TDS, flow rate, pressure along with various operation modes (process mode, rinse mode, chemical wash mode and water wash mode) duration information. The user can easily access real-time data or status of any RO plant by just clicking on its location on Google map. Android app also has the ability to save per day data on smartphone memory in Excel file format. It also provides facility to take a picture RO plant location and transfer to cloud as a backup of the location information. Android app also integrates all RO plants data with location information to Google map for easy understanding, quick judgment and action. Overall data transfer scheme (Fig. 5) from RO plant status monitoring unit to user interface is as follows.

Fig. 5
figure 5

Overall communication scheme for developed embedded RO plant status monitoring unit

Algorithms for early fault prediction and predictive maintenance

Reverse osmosis (RO) membrane fouling and scaling are one of the main challenges for the membrane manufactures, the scientific community and industry professionals. Membrane fouling and scaling phenomenon have a negative effect on the RO desalination system. Predicting fouling and scaling in RO systems are the key challenges and also important to evaluate the long-term performance and cost. As membrane is one of the important and costly elements of reverse osmosis plant, continuously chemical wash and water are required to increase the life of the membrane. Regular chemical and water wash decreases the chances of early membrane fouling and scaling. Researchers have presented various techniques and methods for membrane fouling prediction for different water treatment methods such microfiltration (Liu et al. 2009; Davis 1992; Duclos-Orsello et al. 2006), reverse osmosis (Ruiz-García et al. 2017; Yiantsios et al. 2005), but no significant effort has been observed in the direction of an portable embedded system development for early fault prediction and predictive maintenance for reverse osmosis plant. Developed RO plant status monitoring unit has been integrated with 2000-LPH reverse osmosis plant installed in institute campus and continuously operated six hours daily for 10 days. Real-time data from various sensors have been acquired episodically using developed RO plant status monitoring unit. Real-time flow rate, pressure and water quality sensors data of feed and product water have been acquired for 7 days continuously. Water wash process has been performed to clean the RO membrane after each day data acquisition process. It has been observed that feed water parameters are almost constant while product water parameters also change very slowly over the time period. The sampling rate for data acquisition of sensors integrated with RO plant has optimized based on the study and observation and fixed at one hour (Fig. 6). Real-time pressure sensors (P1, P2 and P3 in Fig. 4) and flow sensors (F1, F2 in Fig. 4) responses have been used to measure the overall flow rate of feed and product water. pH and TDS sensors responses have been used to judge the quality of feed and product water. Overall acquired data have been used to design the models to predict membrane fouling and scaling events, and based on this information system generates an early warning and also predicts various predictive actions such as chemical wash, water wash, membrane replacement. Membrane efficiency analysis (Fig. 7) has been carried out using real-time sensors data, and it has been observed that efficiency of the reverse osmosis plant decreases over the time period of operation.

Fig. 6
figure 6

Flow rate and water quality variation in feed and product water

Fig. 7
figure 7

Efficiency analysis of reverse osmosis membrane over the time period of 15 days

It also has been observed that efficiency of the reverse osmosis plant depends over the membrane chemical wash, water wash and backwash frequencies. Efficiency analysis can clearly indicate the membrane scaling event, as membrane efficiency suddenly goes down monotonically up to 25 percent. Artificial neural network (ANN)-based techniques have been implemented in MATLAB 2015a to predict membrane fouling and scaling event. Multi-input- and single output-based architecture has been used to predict membrane fouling and scaling event. Five plant parameters such as feed and product water flow rate, product water quality parameters (pH, TDS) and water wash frequency along with plant operation time have been used as input in input layer and predict single output membrane efficiency in output layer. The optimal number of neurons in hidden layer has been achieved using trial-and-error method. Hidden layer neurons have been varied from 1 to 7, and obtained results have been compared in the context of complexity, computation time and accuracy. Two mostly explored training algorithms such as Levenberg–Marquardt and Bayesian regulation have been implemented in MATLAB 2015a to achieve the best results. Further, performance of both training algorithms (Table 1) has been compared on the basis of mean square error, number of neurons and accuracy, and the final weight and bias values have been updated on RO plant status monitoring unit to predict plant efficiency, and based on the variation in membrane efficiency, system generates a silent alarm indicator to indicate the membrane fouling and scaling event.

Table 1 Performance comparison of two different training techniques used of membrane scaling and fouling prediction

Total samples dataset (75 samples) has been divided into three different datasets such as training, testing and validation. Training dataset consists of 70% of the dataset while testing and validation dataset consists of 15% each. Training process has been stopped as mean square error stops improving. Mean square with the variation in the number of neurons in the hidden layer has been analyzed for both training algorithms (Fig. 8). Out of both training techniques, Bayesian regulation training algorithm performs the best with the lowest mean square error (1.2814 × 10−10), less number of neurons in hidden layer (5) and with the highest accuracy (R2 = 99.99%).

Fig. 8
figure 8

Mean square error variation with the number of neurons in hidden layer

Testing and field trial results

Developed embedded RO plant status monitoring unit has been tested with RO plant installed at institute campus having a capacity of 2000 LPH. Tested RO plant status monitoring unit has been installed along with various preexisting RO plants having a capacity of 500–2000 LPH at ten different nearby villages of Rajasthan such as Tamkor, Googne ki Dhani, Raboodi, Mukha ka bas, Jhunjhunu to monitor the real-time status of RO plants. It has been observed that developed RO plant status monitoring unit provides real-time data of RO plant parameters and it is also able to predict various events related to membrane behavior such as membrane scaling and fouling. System also predicts various maintenances regarding actions such as membrane chemical wash, water wash, replacement of membrane, wrong operation of RO plant, emergency power shutdown. The developed system also has autofault diagnosis capability to detect and report internal errors related to sensors and circuit damage.

Discussion and conclusion

This paper reported a portable reverse osmosis status monitoring unit for early fault diagnosis and predictive maintenance. Developed systems monitor various plant parameters such as feed and product water flow rate, pressure, pH, TDS, over- and undersupply voltage, input and output water tank level. Developed system provides early fault detection related to membrane fouling, scaling, sensors damage, dry running of pumps, a wrong operation of plant and many more. The system also suggests various predictive actions to plant operator at regular interval to avoid faults. A smartphone-based app interface with various advanced features such data collection from embedded RO plant status monitoring unit further transfers it to cloud. Developed app interface also provides facility to integrate real-time plant data to the Google map with location information for quick understanding and rapid maintenance action. Different ANN-based algorithms have been explored to predict membrane efficiency using various reverse osmosis plant parameters as input. The present idea to monitor the status of reverse osmosis plant and early predict various faults avoids the situation of non-operation of RO plant and also increases the life of the overall plant. It also guides plant operator regarding various operation steps, faults and maintenance actions at regular interval. The overall developed system is cost-effective, portable and easy to use for villagers or any unskilled person.