In this blog we have dealt with a multitude of electric components for DIY projects. Some related to water, such as some valves, flow meters, pumps, etc., however, perhaps makers need something beyond that, such as the turbidity sensor.
Thanks to this type of sensor, you can measure the turbidity of a liquid, such as water, or also for many other applications as we will see later…
Turbidity of liquids
La turbidity It is a measure of the scattering of light caused by particles suspended in a fluid, and is a crucial parameter in various industries, from water treatment to food and beverage production. For example, measuring the turbidity or suspended particles present in water can determine the degree of purity, or whether it is contaminated with solids of some kind. It can also be used to control industrial processes with liquid mixtures of chemicals, or for the fermentation of beer and other beverages, or to control the settling of particles or precipitates, or to calculate the effectiveness of flocculants. It can also be interesting for environmental research tasks, monitoring the waters of lakes, rivers, seas, and even underground wells… The applications are very diverse, as we will see later.
What is a turbidity sensor?

The turbidity sensors, or turbidity meters, are devices designed to quantify this property, have evolved significantly, offering ever greater precision and reliability. You can find them in large format, to check the efficiency of drinking water systems with reverse osmosis filtration, to other industrial processes controlled by SCADA software, and even small turbidity sensors for DIY projects. If you are a maker, you should know that there are some in module format, so you can easily include them in your projects, like many other Arduino modules.
La regular calibration The proper cleaning of turbidity sensors is essential to ensure the accuracy of measurements, as is proper cleaning of the measuring cell or detector. To do this, I recommend reading the datasheets of the model you have chosen, as certified turbidity standards are used to establish a calibration curve. Otherwise, it can not only make its useful life shorter, it could also cause incorrect measurements. Also, depending on the type of fluid to be checked, it could cause other damage to the sensor, such as corrosion in the case of an acidic liquid, or generating lime if it is hard water, algae formation, and more…
Please note that there are some Other factors that can also alter the measurement, even if the sensor maintenance is good:
- Light wavelength: The choice of wavelength influences the sensitivity of the sensor to different particle sizes.
- detection angle: The angle at which the scattered light is measured determines the range of particle sizes that can be detected.
- Measuring cell material: It must be transparent and resistant to the chemicals to be analyzed.
- Temperature: can affect particle density and therefore turbidity.
- Sample color: Colored samples may interfere with turbidity measurement.
- Sensor accuracy and tolerance:There may be different models with different accuracies and tolerances, and this is important when choosing the right one. There will also be some with limits on the size of detectable particles.
Operation of the turbidimeter
Un turbidity sensor, in essence, is an optical instrument that measures the intensity of light scattered by particles present in a fluid. The fundamental principle is based on Rayleigh's law, which states that the intensity of the scattered light is proportional to the fourth power of the particle diameter and to the square of the wavelength of the incident light.
Therefore, the turbidity sensor will have some key parts, such as:
- Light source: Usually a halogen, LED or laser lamp, emits a beam of light of a specific wavelength through the sample.
- Detector: A photodetector (photodiode, photomultiplier) measures the intensity of light scattered at a given angle.
- Measuring cell: contains the sample and provides a defined optical path for the light.
- Electronics: They process the signal from the detector and convert it into a turbidity reading.
On the other hand, among the different types of turbidity meters we can find several ways to measure the presence of these particles in suspension:
- nephelometry: measures scattered light at a 90-degree angle to the incident beam. This is the most common method for measuring low and moderate turbidity.
- Transmission: In this case it is based on the measurement of the light that passes through the sample. It is used to measure high turbidity.
- Absorbance: focuses on determining the light absorbed by particles. It is applied in specific cases where dispersion is minimal.
In addition to taking all this into account, also check the voltages, consumption, working intensity, operating temperature ranges, or compatibility with your project…
Where to buy and prices of a turbidity sensor
No products found.
You can find turbidity sensors at a good price on many platforms specializing in electronics, and also on stores like Aliexpress or Amazon. On these sites, you can find affordable prices and a wide variety of models to meet your needs. Here are some recommendations, two formats with modules based on the Tyndall effect, and a more industrial meter used to measure water quality in more advanced projects, such as in treatment plants, water treatment plants, etc.
Practical applications

You already know some of the possible uses or applications of a turbidity sensor, as I have mentioned a few in the text above. However, here is a list of some of the most popular uses, to inspire you in your future projects:
- Water Treatment: monitoring the quality of drinking water, wastewater and process water. It can also be used for environmental projects, measuring the quality of water in rivers, reservoirs, lakes, seas, groundwater, etc. You can even use it at home if you are going to install a purification system to reuse grey water to irrigate plants, desalination plants, etc.
- Food and beverage industry: quality control of products such as juices, beer and wines. Alcoholic and still-distilled beverages can be susceptible to these types of suspended particles, and these parameters need to be monitored and controlled during production.
- Pharmaceutical: This sector may also require turbidity sensors to ensure the quality of injectable products and ophthalmic solutions, as well as serums, syrups, etc.
- Chemicals: Of course, another option is monitoring filtration and separation processes, chemical mixtures and more.
Practical example of using a turbidity meter

For example, if we use as a base one of the Module-type turbidity sensors based on the Tyndall effect, which are based on the dispersion of light projected on a liquid due to the presence of suspended particles, will generate measurements of one or another value depending on the number of particles present. This type of module is quite effective, and integrates perfectly with Arduino UNO, and allows you to write sketchers in Arduino IDE for easy control.
In this case, we will have a detection range between 0% and 3.5% (0 and 4550 NTU or Nephelometric Turbidity Unit or Nephelometric Turbidity Units), with a tolerance of ±0.5%. In addition, we have two modes of operation, since it allows its use in analog and digital output. In analog mode (switch position at A), turbidity is calculated by measuring the voltage level of the sensor output, while in digital mode (switch position at D), it is measured digitally, with a binary code that will oscillate between two values.
On the other hand, if you look at the datasheet of this turbidity sensor, we see that the model has the following technical specifications:
- Supply voltage: 5V DC
- Consumption: 11mA approximately
- Detection range: 0% to -3.5%(0-4550 NTU)
- Work temperature: -30℃ and 80℃
- Storage temperature:-10℃ and 80℃
- Tolerance or margin of error: ± 0.5%
In the datasheet you can also see the curves or graphs that relate the measured turbidity to the tension generated at the sensor output, as well as the pinout which will help us connect the module to our Arduino board correctly:
You will also see two LEDs, one indicating that it works as PWR, and another for Dout or data output. Now, once we connect the module to our Arduino board, which will be as easy as connecting VIN to 5V and GND to GND from our board, and then S is connected to where we want to check the signal, such as A0 for analog, or D13 if we want digital measurements. Also, in this example we can optionally use an LED connected to a digital output for calibration…
Once finished, The codes you should write in Arduino IDE are the following:
- Digital configuration:
/* Prueba del sensor de turbidez en modo D */
#define Turbidy_sensor 2 //Pin digital 2
const int ledPin = 13; //LED asociado al 13
void setup() {
pinMode(ledPin, OUTPUT); //Configuramos pin 13 como salida
pinMode(Turbidy_sensor, INPUT); //Configuramos el pin del sensor de turbidez como entrada
}
void loop() {
if(digitalRead(Turbidy_sensor)==LOW){ //Lectura de la señal del sensor
digitalWrite(ledPin, HIGH); //Si el sensor indica nivel bajo (LOW) encendemos el LED, es decir, agua más pura
}
else{
digitalWrite(ledPin, LOW); //Si el sensor indica nivel alto (HIGH) apagamos el LED, es decir, agua sucia o turbia
}
}
- Analog configuration:
/* Prueba del sensor de turbidez modo A*/
#define Turbidy_sensor A0
int TurbidySensorValue = 0;
float Tension = 0.0;
void setup() { //Monitorización por el puerto serial para ver valores en pantalla
Serial.begin(9600); // Velocidad de comunicación
Serial.println("Prueba de lectura del sensor de turbidez");
Serial.println("========================================");
Serial.println(" ");
Serial.println("Lectura analógica\tTension");
Serial.println("-----------------\t-------");
}
void loop() {
TurbidySensorValue = analogRead(Turbidy_sensor); // Lectura del pin analógico 0
Tension = TurbidySensorValue * (5.0 / 1024.0); // Mapeo de la lectura analógica
//Envio de valores y textos al terminal serie
Serial.print(TurbidySensorValue);
Serial.print("\t\t\t");
Serial.print(Tensión);
Serial.println(" V");
delay(3000);
}
- If you want to measure in NTU units in analog mode, use:
/* Prueba del sensor de turbidez en modo A y mediciones en NTU */
#define Turbidy_sensor A0
float Tension = 0.0;
float NTU = 0.0;
void setup() { //Medición a través del monitor serie
Serial.begin(9600); // Velocidad de comunicación
Serial.println("Lectura del sensor de turbidez en NTUs");
Serial.println("===================================================================================");
Serial.println(" ");
Serial.println("Tensión\tNTU");
Serial.println("-------\t---");
}
void loop() {
Tension = 0;
Tension = analogRead(Turbidy_sensor)/1024*5; // Mapeo de la lectura analógica
//Para compensar el ruido producido en el sensor tomamos 500 muestras y obtenemos la media
for(int i=0; i<500; i++)
{
Tension += ((float)analogRead(Turbidy_sensor)/1024)*5;
}
Tension = Tension/500;
Tension = redondeo(Tension,1);
//Para ajustarnos a la gráfica de la derecha
if(Tension < 2.5){
NTU = 3000;
}else{
NTU = -1120.4*square(Tension)+5742.3*Tension-4352.9;
}
//Envio de valores y textos al terminal serie
Serial.print(Tension);
Serial.print(" V");
Serial.print("\t");
Serial.print(NTU);
Serial.println(" NTU");
delay(5000);
}
float redondeo(float p_entera, int p_decimal)
{
float multiplicador = powf( 10.0f, p_decimal); //redondeo a 2 decimales
p_entera = roundf(p_entera * multiplicador) / multiplicador;
return p_entera;
}
Remember that you can always modify the code to adapt it to your projects, these are just usage examples…