Turbidity Sensor

Hi, I recently purchased a DFRobot Gravity:turbidity sensor, I was able to connect it to an Arduino compatible Nano and a 16x2 LCD display. My question is this - should it be able to tell the difference between distilled water and strong black tea? I get the same reading for both, I would have expected a considerable difference.

1 Like

Turbidity is the Opacity of water which requires a compatible light source and light detector. A floodlight into a highly sensitive detector will flood the detector into believing almost anything is clear as water, while almost no light source and an insensitive detector will read anything as “clear as Mud”. I 1981 I was asked to make a turbidity meter, OK a relative turbidity meter. It was to be very basic, using components that even for the time were old technology. The probe had to measure turbidity in a water basin at a depth of 4m and maybe up to 5m -1/2 bar, ~500Pa.
We used a full length of 20mm conduit with a ‘T’ connector at the end. Either side was capped with a 20mm cap and a short length of 20mm conduit into the T side and the cap. One side held a smple MES Light globe, today a white LED would be chosen. The other side held a LSR, Light Sensitive Resistor.
A milliAmp meter was used to measure the current passed by the LSR. No electronics necessary, and no Arduino available for digital readout, but you may wish to use one now that they are.
The important step was calibration. The Council Chemists provided a sample of what they wanted as the standard for Clear (0% I think from memory) and Muddy (100% also from memory. Either one might be imperfect, but that was what the Chemists wanted to measure.
So we added some variable resistors, “Trim-Pots” to adjust the reading for 0% and 100% which required many tweaks until both were perfect (enough) without requiring adjustment.
The other end of the conduit mounted a box with a rectangle mu45 meter face, and held inside a battery 4xAA’s I think, and had a push button to take a reading.
Turbidity in a water treatment plant is very important as Chemists try to get the greatest use out of filters before Rebedding the filters. Chemists would use the test gear so (jokingly) we made the test gear as simple as possible with only one push button so we hoped it was fool proof, with apologies to my Chemist mates! :wink:
i.e. your answer in short. Calibrate my friend!

2 Likes

Hi Bob, thanks for the lengthy reply.

1 Like

Hi again Bob, I’m not sure if what I’ve done you would consider calibration but here’s what I did.
The sensor has an analogue output of 0 - 1024, I used the code that was used as an example in the product details, this code changed the reading into a value of 0 - 5V, hence my original results were almost identical for distilled water and strong black tea. I changed the code to just give the actual sensor reading ( 0 - 1024). The new results as follows -
distilled water - 930
strong black tea - 900
strong black tea diluted 50% - 915
strong black tea diluted 75% - 925
To keep things as accurate as possible I used the same container for each test and made sure to orient the sensor in the same direction to allow for ambient light.
As you can see there is not much difference. My next question has to be - is strong black tea considered to be turbid or just coloured water? (couldn’t help but notice the spell checker on this forum tells me I’m spelling coloured wrongly :unamused: )

1 Like

Hi F,

I’ve just pulled one from stock and set it up. Bob’s definitely on the money with calibration!

These sensors use in IR LED and a photo transistor to sense turbidity, just as Bob described. If tea is quite transparent to IR that would certainly explain the high readings. FYI, if you carefully remove the turbidity sensor PCB from its housing there is a small potentiometer you can use to adjust the brightness of the LED - clockwise for brighter, counter-clockwise for dimmer. Turning the brightness down might make it more sensitive to changes in turbidity.

Also note that if you are taking the measurement with a bright external light source, it may be swamping the output of the IR LED. You’re best to take measurements in a dark environment for the most repeatable resutls.

1 Like

Hi Oliver, thanks for elaborating on the calibration. I became aware that different light conditions could effect the results even when measuring the same liquid but I didn’t realise the sensor could be swamped. My final application will be in pitch black so for further testing I’ll turn the lights off, if that doesn’t alter the readings then I’ll attempt adjusting the pot :clamp: . I’ll also use a different (more opaque) liquid than tea :non-potable_water: .
(P.S. it wasn’t the forum’s spell checker, it was my browser - it went back to default settings when I updated it last week :grimacing:)

2 Likes

First, I appoligise for not responding in a timely manner. However:-

  1. Yes absence of ambient light is a big factor in your problem, (Table) Turbidity testers put the vials inside an enclosure that is a dark place, enclosed and usually covered.
  2. The calibration process may be automated, to adjust the LED in your case to only what is needed to establish a 100% reading on distilled water, or a solid glass vial representing water.
  3. Maximum Turbidity may not require setting depending on your need, but if you are looking at the strength of a sample of Tea infusion, then an upper limit can also be calibrated by a variable gain/limiting amplifier on the sensor, and before the ADC on the computer.
  4. Turbidity can be treated as raw but with calibrated min/max, or the ADC readings can be mathematically adjusted for an appropriate gain ‘curve’.

Addendum: The spell checker may be set to Australian English which has variances to US English and also to UK English. We walk the road between the two with some rejection of ‘French’ derived spellings, and some avoidance to US spellings like Aluminum when most elements end in '-ium ’ internationally. Oh for an internationally agreed spelling system! Luckily we can converse with greater ease than most language conflicts!

3 Likes

The probe comes with a calibration PCB, which I was unaware of until a few minutes ago, but the amplifier on the pcb is implemented as either a switch, or as a buffer.
The sensor output is only from 2.5V to ~4.2V, a range of 1.7V, so a buffer will simply output these voltages.
Read all, think twice, cut once!
If you understand Op-Amps- the buffer can be used as a ‘dark’ level calibration by cutting the link between pins 6&7, the feedback loop of the Op-Amp.
A gain of 2.2:1 can be achieved with a 22k resistor soldered between pins 6 & 7 and a 10k resistor between pins 6 and 4, ground.
(OR Use a 27k resistor between 6&7 for a gain of 2.7, and a voltage range of 4.59 Volts which may be too much depending on your application.) You must again calibrate the maximum transparency (minimum turbidity). It may take some fine soldering, but it is possible with care and experienced soldering.
Alternatively you could build a new dedicated circuit on a breadboard or protoboard from a suitable Op-Amp, even a 741. The resistor between pins 6&7 could be a 50k trimpot, allowing an adjustable range.
The accuracy of your ADC is limited by the range used to measure the sample voltage. 1.7V/4.5V x 1024 gives a digital range of only 386!

3 Likes

Thanks Bob40996, lots to digest there! Since my last post we had a good amount of rain which stirred up the creek we source our water from :cloud_with_rain: (hence my need of a sensor to alert me :mag: ) so I grabbed a sample which I will use for testing once I’ve rescued the Nano from another project. I’ll refrain from making modifications to the calibration PCB for the time being, hopefully there will be a more substantial difference in the readings now I have a genuine sample to go by.

2 Likes

Sounds good Frank!

Hopefully, we won’t need to resort to hardware mods, but it may not be a bad idea if you continue to run into the same issue. Make sure to let us know how you go with it, it’ll be useful for others in the future if they ever have the same issue with these sensors.

2 Likes

I’ve sampled what is sometimes called water -outback. Even some coastal water supplies are not great, but if you’re taking it from a creek or dam, or sub-terranian source then a good filter is essential for health. When I worked at the Mt Crosby Water Treatment Plant the process was huge by comparison but the process is essentially the same.

  1. Strain all debris from the water, or water from the debris probably in your case.
  2. Settle the sediment from the water. In a sediment basin Sodium Aluminate is added to the water to cause the ‘mud’ to collect and settle better as ‘Floculate’.
  3. Lime is then added to neutralise the acidity of the water, and also make some of the impurities collect together to assist filtering.
  4. The ‘clean’ or ‘potable’ water (less muddy!) is filtered through a sand/charcoal filter bed to collect the fine particles from the water.
  5. The water is finally Chlorinated to remove(kill) biologicals such as Cholera which comes from many water sources.
  6. The chlorinated water is stored for use.

We built a training model for this process (and alternatives) in a system the size of a VW Bus! which would provide enough water for a small family.
Not really electrionics but my part of the exercise was in setting up the process for automation and instrumentation.
Happy to help if I can.

3 Likes

Hi Frank

Not sure if you are still on this project. I had some initial trouble with this sensor because I plugged the cable between the sensor and conversion module in head to tail. The design is not very clean in this regard. Once I swapped the cable ends around it worked as described in the wiki.

Regards
Tom

2 Likes