IOT

DIY Turbidity Meter using Turbidity Sensor & Arduino

We’ll learn how to create a DIY Turbidity Meter by connecting a DfRobot Turbidity Sensor to an Arduino in this project. Turbidity is a measurement of a liquid’s relative clarity. When a light is shined through a water sample, it is a measurement of the amount of light dispersed by material in the water.

The Arduino Turbidity Sensor is used in projects that monitor water turbidity in rivers, streams, lakes, and other bodies of water, as well as catchment and research sites, laboratories, and liquid storage tanks. We may construct a Water Quality Monitoring System device by connecting this sensor to an Arduino. Other sensors used in water quality measurement include the Ph Sensor, which measures the pH of liquids, as well as the TDS Sensor, which measures total dissolved solute in water, and the DO Sensor, which measures dissolved oxygen in the water.

We have already discussed Ph Sensor and TDS Sensor earlier. In this entire article, we will cover the basics of the Turbidity Sensor and its practical demonstration in measuring Water Turbidity for Water Quality Monitoring. The Turbidity value is measured in terms of NTU which is called Nephelometric Turbidity Units. We will display the Arduino Turbidity Sensor value in the 16X2 LCD Display.

Hardware Required:

  • Arduino UNO R3/ Nano or Any other Arduino Board
  • 16X2 I2C LCD Display
  • DfRobot Turbidity Sensor
  • Connecting wires
  • Breadboard

Turbidity of Water

What Is Turbidity?

Turbidity, like smoke in the air, is the cloudiness or haziness of a fluid generated by enormous numbers of small particles that are normally imperceptible to the naked eye. Turbidity is an important indicator of water quality.

Turbidity is caused by particles suspended or dissolved in water scattering light, resulting in cloudy or murky water. Sediment, particularly clay and silt, fine organic and inorganic materials, soluble colored organic compounds, algae, and other microscopic organisms are examples of particulate matter.

Impact of Turbidity

The aesthetic quality of lakes and streams can be severely harmed by high turbidity. It has the potential to raise the cost of drinking and food processing water treatment. By lowering food supply, eroding spawning areas, and disrupting gill function, it can kill fish and other aquatic species.

Turbidity Sources

Sediment is frequently at the top of the list of compounds or pollutants that contribute to turbidity. Erosion from upland, riparian, stream bank, and stream channel areas are examples of natural sources. Turbidity can also be caused by algae that feed on nutrients that enter the stream through leaf decomposition or other naturally occurring decomposition processes.

Sediment can be released as a result of stream channel movement. Turbidity can be caused by organic debris in sewage discharges, particularly during treatment plant bypasses. Construction, mining, and agriculture, among other human activities that alter the land, can result in excessive silt levels entering water bodies during rainstorms owing to stormwater runoff.

Measuring Turbidity

Turbidity is measured in a laboratory or in the field with specialist optical equipment. The amount of light dispersed is measured after it is focused through a water sample.

A Nephelometric Turbidity Unit (NTU) is a measurement unit that comes in a variety of sizes. The higher the turbidity, the more light scattering there is. High turbidity readings imply poor water clarity, whereas low turbidity values indicate excellent water purity.

DfRobot Turbidity Sensor

DfRobot Turbidity Sensor

The gravity of the situation DfRobot’s Arduino Turbidity Sensor evaluates water quality by detecting turbidity levels. It measures light transmittance and scattering rate, which fluctuates with the amount of total suspended solids (TSS) in water, to identify suspended particles in water. The level of liquid turbidity rises as the TTS rises.

This liquid sensor can output both analog and digital signals. When in digital signal mode, the threshold can be adjusted. You can choose the setting that best suits your Microcontroller Apps.

Working of a Turbidity Sensor

Working of Turbidity Sensor

The sensor works on the concept that when light passes through a sample of water, the amount of light transmitted is proportional to the amount of soil in the water. The amount of light transmitted reduces as the soil level rises. The turbidity sensor determines the turbidity of the wash water by measuring the amount of light transmitted.

Sensor Specification

  • Operating Voltage: 5V DC
  • Operating Current: 40mA (MAX)
  • Response Time: <500ms
  • Insulation Resistance: 100M (Min)
  • Output Method: Analog
  • Analog output: 0-4.5V
  • Digital Output: High/Low-level signal (you can adjust the threshold value by adjusting the potentiometer)

Sensor Construction & Circuit

An optical device with an LED (light sender) and a phototransistor make up the front-end sensor (light receiver). The inner board of the Turbidity Sensor is schematically shown below. It has a three-wire interface: VCC (+5 V), GND (0 V) & OUT/SIGNAL.

The Turbidity sensor has a signal connector Board as well. The signal connector board is directly connected to the above circuit.

The LMV358 IC-based module has a three-pin interface for connecting to Arduino, as well as an analog/digital selector switch for switching between analog and digital output modes.

Relationship Between Turbidity and Sensor Voltage

From the DfRobot Article, this graph was created using an equation that links the sensor voltage to turbidity.

While coding for your microcontroller-based project, I deduced from this graph that the equation included in the relationship graph is only valid if the sensor outputs 4.2 V roughly at zero turbidity (clear water), and it’s only valid between the 2.5 V to 4.2 V range (3,000 to 0 turbidity).

Calibration is essential if you are not getting the right value. The little potentiometer within the turbidity sensor can be rotated to accomplish this.

Interfacing Turbidity Sensor with Arduino

Now let’s use Arduino to construct a simple turbidity meter. Simply connect the Turbidity Sensor to the Arduino Board to accomplish this.

Interfacing Turbidity Sensor Arduino

As shown in the image above, connect the Turbidity Sensor’s VCC to Arduino 5V, GND to GND, and Analog Output to Arduino A0 pin.

Interfacing Code for a Turbidity Sensor on an Arduino

The following is a basic code for connecting a turbidity sensor to an Arduino. This code reads the sensor’s analog value and displays it on the Serial Monitor.

void setup() {
Serial.begin(9600);

}
void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1024.0);

Serial.println (“Sensor Output (V):”);
Serial.println (voltage);
Serial.println();
delay(1000);
}

Arduino Turbidity Meter with LCD Display

Now let us add an extra 16×2 I2C LCD Display to display the Turbidity Value in LCD Screen. The connection diagram is given below.

Turbidity Meter Arduino LCD

We can decrease the number of wires by using an I2C LCD. Connect the I2C LCD’s SDA and SCL pins to the Arduino A4 (SDA) and A5 (SCL) pins.

Arduino Turbidity Meter Source Code Program

Let’s have a look at the Turbidity Sensor Arduino Project code now. The I2C LCD Library must be added to the Arduino IDE. This link will take you to a page where you may download the library.

Download I2C LCD Library

#include <Wire.h>
#include <LiquidCrystal_I2C.h> //https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
LiquidCrystal_I2C lcd(0x27, 16, 2);

int sensorPin = A0;
float volt;
float ntu;
void setup()
{
Serial.begin(9600);
lcd.begin();
lcd.backlight();
}
void loop()
{

volt = 0;
for(int i=0; i<800; i++)
{
volt += ((float)analogRead(sensorPin)/1023)*5;
}
volt = volt/800;
volt = round_to_dp(volt,2);
if(volt < 2.5){
ntu = 3000;
}else{
ntu = -1120.4*square(volt)+5742.3*volt-4353.8;
}
lcd.clear();
lcd.setCursor(0,0);
lcd.print(volt);
lcd.print(” V”);
lcd.setCursor(0,1);
lcd.print(ntu);
lcd.print(” NTU”);
delay(10);
}
float round_to_dp( float in_value, int decimal_place )
{
float multiplier = powf( 10.0f, decimal_place );
in_value = roundf( in_value * multiplier ) / multiplier;
return in_value;
}

Code Explanation

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);

First, we declared the Library for 16×2 LCD Display which has I2C Pins with I2C address of 0x27.

volt = 0;
for(int i=0; i<800; i++)
{
volt += ((float)analogRead(sensorPin)/1023)*5;
}
volt = volt/800;

The sensor’s output analogue voltage varies greatly and is too loud to measure. As a result, we took 800 readings and then averaged the results.

ntu = -1120.4*square(volt)+5742.3*volt-4352.9;

Using this formula we converted the analog voltage value to NTU.

if(volt < 2.5)
{
ntu = 3000;
}

The NTU is set to 3000 if the analog voltage reading falls below 2.5 V. As a result, the project’s maximum NTU value is 3000.

Results & Observations

You can test the project’s functionality by dipping the sensor in various types of water. You can make a mud or clay mixture and measure the water’s turbidity in NTU.

In pure water, for example, the voltage will remain at 4.2V. If it doesn’t display 4.2, rotate the Potentiometer in the Sensor to adjust the calibration.

Turbidity Sensor dfrobot Arduino

As a result, the final Arduino Turbidity Meter is now complete and suitable for use in water quality monitoring.

Leave a Reply

Your email address will not be published.