The objective of this project is to design and develop a system which can effectively monitor the quality of water with the help of several sensors and transmit the sensor data over Internet for remote monitoring and also ensure fail-safe operation of the system using RTOS.
In this project, we have designed a system which have capable hardware and software components to achieve remote monitoring of water quality by measuring and analyzing drinking water quality parameters as stated by IS 10500:2012. The system has three overall sub-systems and two hardware sub-system or nodes, one being the local node, comprises of the sensors, Arduino UNO, XBee end device and actuator components, while the other being the coordinator, comprises of ESP8266 microcontroller and XBee coordinator. Each of the nodes perform their specific function with the help of embedded code flashed on to the microcontroller boards.
The data collected by the sensors are transmitted with help of XBee modules using RF communication to coordinator node. Arduino UNO is programmed with the help of FreeRTOS, to help the Arduino to multi-task as we have created three tasks (or threads) TaskSensors - to collect and transmit sensor data, TaskpH – to check whether pH values are within permissible limit, TaskTds – to check whether TDS values are within permissible limits by. The last two tasks also ensure the fail-safe operation by closing the outlet in case if the permissible limits of sensor values are not met. This is done with the help of a solenoid valve, which is also interfaced with Arduino board. The Arduino and solenoid valve are powered with the help of step-down transformer and relay assembly. Thus, local node is capable of collecting sensor data, transmitting it and implement control action based on the collected data.
The data transmitted from the local node is received by XBee coordinator and sent to ESP8266 for publishing to the MQTT broker. ESP8266 has built-in Wi-Fi, so it can connect to the local available Wi-Fi and transmit data over Internet. XBee coordinator has to be powered ON always. It has the ability to communicate to multiple routers and end devices. It enables the system to be expanded in future. ESP8266 once connected to Wi-Fi published data to ThingSpeak using MQTT protocol.
The data published by the coordinator is stored in a private channel in ThingSpeak (MQTT broker) containing four fields corresponding to temperature, TDS, pH, flow sensors values respectively. These sensor data are logged in the server and used for further analysis and visualizations using MATLAB. The channel is secured with the help of a unique channel ID and 16-bit authentication codes called Read API key and Write API key, without which data can neither be read from the channel nor written in to the channel. We have also designed a web application, which subscribes to the data in ThingSpeak using MQTT protocol and displays it in the website for remote monitoring purpose of clients and service providers. Only authorized personnel with username and password can access the website, which ensures the safety and reliability of the website. Each unit which is monitored will have data stored in different channels, so there won’t be any mismatch in the data shown in the website. Furthermore, MATLAB based analysis is done one the sensor data to remove anomalies or outliers in data to represent the trend of changes in data accurately.
At present, the project only has one local node and one coordinator. The project is designed to be modular and scalable, meaning the components can be individually changed, if found damaged and new local nodes can be added to expand the system. The system can be expanded by installing local nodes in places where we need to measure water quality like water dispensers, water reservoirs, tanks etc., With just one coordinator and increasing the number of local nodes according to need and increasing number of routers to extend the range, we can expand the system significantly. Prognostic capabilities can be added to the system by implementing advanced machine learning algorithms to analyze the data collected. Therefore, predictive maintenance can be also be implemented which would enable us to prolong the life-span of the water purification units and also prevent any catastrophic malfunction of the units.