Introduction: Water Quality Sensor

We are Nikita Anil Kumar and Srushti Borkar, and as a part of our college course, we were required to conceive of and complete a project that could solve a problem faced by society. The problem we picked had to do with the dangers that arise from unfiltered water.

Possible Solutions:

We realised that there were two ways of looking at this problem. Either we could attempt to sense the quality of the water, or we could develop a filtration system. There were 4 potential solutions we devised that could aid in solving the problem of unfiltered water. These were:

1. An Arduino based water quality sensor - This method uses Arduino to monitor the quality of water, and can be modified to monitor various aspects such as the temperature of the water and its surrounding, the turbidity of the water (how clean the water is) as well as the PH levels of the Water. So this system monitors all of these aspect and finally when all checks have been completed, the information or data can be sent to the user. There are several tutorials that can be found for this, some of which we are adding links to here:

2. An ARM board based water quality sensor - The ARM-based sensor system would have utilised an ARM board as the processor to carry out the water quality monitoring. ARM boards are said to be fast, accurate, and cost-effective. Different sensors can be hooked up to the ARM to provide information about the drinkability of the water. However, use of this system would have been tricky considering the fact that neither of us had any prior experience with this type of processor before. Instructions to built this can be found here: ttps://

3. A water filter that was built using a bottle - This would act as a bio filter. The bottle based water filter is a common DIY biofilter. Instructions to create it are easily available on the internet. It works by using easy to obtain materials to filter water without the need to buy expensive equipment. Activated Carbon is a major filtration component needed, however. While simple, this method is better used as a last choice alternative. While good in a pinch, there is no guarantee as to how clean the water really is. Furthermore, it cannot be used large scale and is better suited when used by just one person. Thus, we did not use this solution. Instructions to make this can be found here:

4. A straw based water filter - The straw based filtration method is similar to the bottle. Instructions to make it are also easily found. As the name suggests, instead of a bottle a straw is used. Water is sucked up through one end and the biofilter in the straw filters it before it reaches the mouth of the person drinking the water. The pitfalls of this method are also similar to those of the bottle filter, in that it cannot guarantee the cleanliness of the water, and is not appropriate for large scale impact as a solution. Instructions for this method can be found here:

5. Distillation system - This method uses a boiler, a set-up of copper pipes, and a collection unit that can purify dirty or salt water directly on a stove top. It produces lots of pure drinking water quickly, and can be powered by stove, rocket stove campfire, parabolic dish, etc. However, since we did not have access to a boiler in the lab, and this solution would not work at a large scale basis, we decided not to go with it. The tutorial for this can be found here:

6. Bicycle - Powered Arduino Water Purification System - This method uses mechanical energy produced by a bicycle to power a UV-C water purification system with Arduino control. A dynamo in the rear of the bicycle charges a battery that runs the Arduino and the light. Although this is a very innovative and ecologically friendly solution, the method was very complex and required several components, for which we lacked the knowledge and financial resources. However, for those interested, the tutorial can be found here:

Solution Chosen:

We decided to work on an Arduino based water quality sensor for our project.

Even water taken from filtration systems may be dirty, and cause illness to consumers. There is also no way to determine if the water is dirty on any particular day. The problem of unfiltered water affects society as a whole. As mentioned above, this problem has multiple facets. First, there needs to be a method of indicating that the water is dirty. Second, if the water is dirty it must be filtered, or replaced.

Dirty water is a large problem in places like villages where filtration systems may be hard to come by. Considering the prevalence of waterborne diseases it is imperative to develop a system that provides an indication of when water is safe to drink at the very least. The solution must be dispersed to areas where water filtration is a problem. This can be done through NGO’s or even a government scheme. On a smaller scale it can be taken up by the college to install filtration systems in the coolers.

The quality of water has an impact on the living beings. Water quality testing is an important part of environmental monitoring. Water quality refers to the chemical, physical, biological, and radiological characteristics of water. It is a measure of the condition of water relative to the requirements of one or more biotic species and or to any human need or purpose.
The main parameters that define water quality are monitored and observed. To monitor the parameters, different sensors like pH, IR, Temperature and Conductivity sensors are used. All the measured parameters are compared with the threshold value that defines the purity. Once the parameters are measured they are sent to authority in the form of alert messages. The ideal solution would be a water quality monitoring system in the Arduino platform that measures the pH, conductivity, temperature, and turbidity of water using sensors. These sensed parameters are conveyed to the consumer either via Bluetooth, or displayed on an LCD/LED screen. Based on this, the consumer can gauge whether the water is suitable for drinking.

The current prototype is a work in progress, and only uses a turbidity sensor and a temperature sensor.

Problems we Faced:

Our first challenge as we started this project, was that we had no idea that sensors would be so costly. As we started doing our research, we found that most of them were beyond our budget, and most would have to be imported, for which we did not have time. Initially, we wanted to use dynamic sensors, but taking the costs into consideration, we were only able to invest in a non-dynamic turbidity and water temperature sensor.

As amateurs, we had trouble with the technical aspects of carrying out this project, especially in terms of the coding. Having no prior knowledge of C programming we were unable to combine the separate codes for the temperature and turbidity portions.

Additionally, we did face some problems with the setting up of the turbidity sensor, which needed to be opened up and trimmed before it worked satisfactorily. We also had a lack of available NTU values of water, which are generally used for the calibration of the turbidity sensor. We had to use our own discretion while measuring the benchmark values.

The turbidity sensor gave us trouble in that, when it was placed in water the values outputted would change rapidly instead of staying stable. These fluctuations could be as large as 500-1000 units. Since we were defining the benchmark value for drinkable water, each time the sensor output fluctuated the benchmark value would have to be changed. This led to the LED set-up frequently ceasing to function until we could update the benchmark. Effectively, this meant that the turbidity sensor set-up would only function for 1 use before the code had to be modified.

In terms of the display of the temperature, our original plan was to use an LCD screen as opposed to the currently used LED display. However, the large amount of soldering required to connect the LCD display made it difficult for us to actually do this. We finally decided to work with the LED display if only for ease of connecting it.

Another issue was regarding the output for the user, for which we would have liked to use a Bluetooth module. While we agree that it would be best for users to have to ability to check for the water quality on their phones, we were not able to integrate it in the time that we had.

Since this project is only a prototype, these are challenges that we hope to overcome in the future, in order to make this a high impact, economically feasible, commercial product.

Materials Used:

Turbidity sensor

Temperature sensor

4-digit 7-segment LED display

Jumper wires

Arduino Uno


Step 1: Setting Up the Turbidity Sensor and Display With Serial Plotter

Connections for the turbidity sensor:

VCC => 5V


Signal => A0

The value on the turbidity sensor increases as the water gets progressively dirtier. It is sensitive enough to distinguish between bottled and tap water as well.

We also used an LED to indicate whether the water was safe to drink. This was done by determining the difference in ntu value between tap and drinking water. Any value below the threshold level was deemed safe and the LED would light up.

Thanks to Roland Pelayo whose code we adapted for this project. Check out his tutorial here:

int sensorPin=A0;
float volt;
float ntu;

int threshhold = 2135; //Add the threshold value you need
int pin1 = A1;

void setup() {

pinMode(pin1, OUTPUT);  

void loop() {
  volt = (float)analogRead(sensorPin) * (5.0 / 1024.0);
  ntu = -1000.4*square(volt)+5742.3*volt-4352.9;
  if (ntu < threshold) {
    digitalWrite(pin1, HIGH);
  else {
    digitalWrite(pin1, LOW);



Step 2: Temperature Sensor With LED Display

Follow the Fritzing diagram to make the connections for the LED display.

Connections for the temperature sensor:

VCC => 5V


Signal => 13

Thanks to Spark Fun Electronics by Nathan Seidle and Joel Bartlett and the SevSeg Library, from which we got the code for the LED display, and to TeamIOTBoys, from where we adapted the temperature sensor code.

The code for the LED display is originally based on Dean Reading's Library, here -

We got it from Spark Fun Electronics by Nathan Seidle and Joel Bartlett.

The code for the temperature sensor was adapted from

#include "SevSeg.h"

SevSeg myDisplay;

unsigned long timer;
int deciSecond = 0;

#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 13

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

float Celcius = 0;
float Fahrenheit = 0;

char C_in_char[4];

void setup()


  int displayType = COMMON_CATHODE;  
  int digit1 = 9; //Pin 1
  int digit2 = 10; //Pin 10
  int digit3 = 11; //Pin 4
  int digit4 = 12; //Pin 6

  int segA = 2; //Pin 12
  int segB = 3; //Pin 11
  int segC = 4; //Pin 3
  int segD = 5; //Pin 8
  int segE = 6; //Pin 2
  int segF = 7; //Pin 9
  int segG = 8; //Pin 7
  int segDP = A0; //Pin 5

  int numberOfDigits = 4; 

  myDisplay.Begin(displayType, numberOfDigits, digit1, digit2, digit3, digit4, segA, segB, segC, segD, segE, segF, segG, segDP);


  timer = millis();

void loop()
  Celcius = sensors.getTempCByIndex(0);

  dtostrf(Celcius, 4, 0, C_in_char);

  char tempString[5] = {'d', 'E', 'g', 'C'}; //Used for sprintf

  for (int i = 0; i < 100; i++)

  myDisplay.DisplayString(tempString, 0); 


  for (int i = 0; i < 100; i++)

  myDisplay.DisplayString(C_in_char, 0);



Step 3: Future Direction

The capability of water quality monitoring systems can be enhanced to obtain more efficient reliable results.The current project is a prototype, and hence only used temperature and turbidity sensors, but others such as pH, conductivity, dissolved oxygen, etc. can also be integrated into the monitoring systems.The system can be expanded to monitor hydrologic, air pollution, industrial and agricultural production and so on. It has widespread application and extension value, as a real-time indicator of water quality.

One of the challenges we need to overcome, is figuring out how to lower costs of building the integrated sensor, so that the final product is economically feasible.

It also needs to be packaged in a user-friendly manner.

Final Thoughts:

Through the course of making this project, we learnt a lot about problem-solving and the need for perseverance when building something. It was certainly a challenging task but very enriching in what it taught us. At the end of our course, both of us feel much more interested in looking at technological solutions for societal problems. And now, we even have to skills to attempt to build these solutions ourselves.

Overall, we are grateful to have been given the opportunity to create our own project that we hope can one day be put to use.