Home / Tutorials / Arduino Tutorial / Using an Arduino Turbidity Sensor

Using an Arduino Turbidity Sensor

Turbidity refers to the haziness of a fluid caused by the increased number of very tiny particles which, individually, is invisible to us. Moreover, turbidity measurement is important in testing the quality of water. This Arduino turbidity sensor tutorial provides a guide on how to implement this setup using a specialized turbidity sensor module.

Introduction to Turbidity Sensor

The concept of DFRobot’s Turbidity Sensor is based on Tyndall effect. This effect describes the scattering of light projected into a liquid with suspended particles. Basically, the greater the number of particles, the more the light will be scattered.

This sensor module consists of an amplifier board and a sensor:

Gravity: Analog Turbidity Sensor For Arduino

The module is to be connected to Arduino using three pins only: VCC, GND and SIGNAL. Here is an example Fritzing diagram where the turbidity sensor is connected to an Arduino UNO:

SEN0189 connection.png

Important note: there is a correct way to connect the wire from the amplifier board to the turbidity sensor:

arduino turbidity sensor correct plug placement

You need to connect the wire the right way or the sensor won’t work! I’ve spent hours wondering why nothing is working until I learned about this.

The turbidity sensor contains a light transmitter and receiver. At clear waters, light scattering is minimum and so the light receiver receives the most amount of light. As turbidity of the water increases, the light receiver receives less and less light. The sensor triggers when the light received is below a certain threshold.

Interestingly enough, there is an “analog-digital” switch on the amplifier board which supposedly switches between analog mode and digital mode. The official wiki says that when in analog mode, the output value decreases at high turbidity. When in digital mode, the output pin goes high when the turbidity reaches a threshold value, set by the on-board potentiometer.

When your objective is just to detect when the water is turbid enough, then use digital mode. If you want to measure the turbidity levels, then you need to use analog mode.

Using the Turbidity Sensor with Arduino

The same official wiki gave this graph with an equation that relates the voltage from the sensor to turbidity:

Relationship diagram.jpg

However, this equation (presumably acquired through curve fitting) is only applicable when the sensor gives out around approximately 4.2 volts at no turbidity. Mine didn’t give out 4.2 V so I had to pry open the sensor and found this:

arduino turbidity sensor trimmer adjustment

I carefully tuned the trimmer until I could get a 4.2 V output when the sensor is not submerged or is in clear water.

Now, I only needed to use the equation to provide the turbidity in NTU. Here’s the sketch:

BTW, I am using an I2C LCD for this example.

The voltage from the sensor is quite noisy so I decided to take 800 samples and then average those samples:

After this, I converted the voltage to NTU. But note that the equation on the graph is only true within the range of 2.5 V to 4.2 V. So I needed to set a limit. Hence:

If the voltage reading is below 2.5 V, the NTU is set to 3000 which would be the maximum NTU value of the project.

You might noticed the difference between the original equation and the equation on my sketch (4352.9 versus 4353.8). This is because at 4.2 V, the NTU should be zero but mine gives 0.9. This could be a rounding error on the ADC’s part. I decided to filter out this 0.9 by subtracting it from the original equation. Hence the difference.

Note: the output of the sensor at clear water might sometimes diverge from the 4.2 V set value. If this happens, the on-board potentiometer (the one on the amplifier board) helps adjust it back to 4.2 V.

Video

Here’s the Arduino turbidity sensor in action:

I hope you learned something from this tutorial. Build an Arduino Turbidity Sensor project!

Check Also

arduino microphone

How to Use a Microphone with Arduino

How can an Arduino capture sound? Just like how your computer captures sound: through a …

One comment

  1. I did the calibration as mentioned above by using the trimmer inside the sensor.And then when I fixed the sensor properly as it is the value which I calibrated by removing the sensor changes from 4.20V to some value.So all I need to know is a reason for that?which means After fixing the sensor in various ways once when I did the Calibration but unfortunately when fixing it changes

Leave a Reply

Your email address will not be published. Required fields are marked *