Building a Tubidity meter

Im trying to build a turbidity meter for my university project but I’m having so many problems, the project consists in a led or infrared emissor sending light that will pass through a hole in a water pipe and a receiver (LDR or Infrared receiver) that will read the intensity of the signal.

Im having problems with the receiver:

  • First the LDR seems to be unstable if i try to read the turbidity of one sample multiples times it gives me different values.

-Then Im trying the Infrared receiver but this one is suffering a lot of interferance from outside, solar light and heat and also doesnt have a great scale to measure if the water is clean or dirty.

Do you guys have any tips to give to me? Any other option i should try?

Modelo_turbidimetro.png

So I have an infrared emitter and receiver but i doesnt know a lot about eletronics and Im having problems to know which resistence i must use while wiring it.

I already found the datasheet but i didnt understand anything while reading it, which specifications do I need to know to calculate the resistence.

Im using an Arduino nano and I what to use 5V.

IR333C.pdf (273 KB)

PT333-3B.pdf (247 KB)

Continuous current and forward voltage are factors, from the data sheet, for determining the current limiting resistor value. With that information, together with the voltage you intend to drive the led at, you can use an online led calculator to see what the value should be. These use a simple application of ohms law.

If the current is higher than an Arduino pin can tolerate, either increase the resistor value, or use a transistor to drive it.

At 20mA its forward voltage is 1.2V,
at 100mA its forward voltage is 1.4V.

So, lets say 20mA, with 5V supply:

Voltage across LED = 1.2V (from datasheet, assuming the current is set right)
Voltage across resistor must therefore be 5-1.2 = 3.8V
Current through resistor is 20mA,

R = V/I by definition of resistance, so R = 3.8/0.02 = 190 ohms.

Arduino pins can handle 20mA, and have roughly 40 ohms of internal resistance, so an external
resistor of 190 - 40 = 150 ohms would be appropriate.

At higher currents you'd need some sort of driver transistor, or MOSFET or relay or whatever.

Modelo_turbidimetro.png

The LDR is relatively slow and probably unduly sensitive to temperature. Not sure whether it is very sensitive to IR either!

To use the other IR receiver, you need to modulate the light (LED) with a frequency - such as 38 kHz and use signal processing of some sort to measure the component at that frequency that is received.

Not sure what your application is but your photo transistor should be connected between an analogue input and ground. I would start with a 10K pull up resistor on that.

You should aim to get the un - illuminated photo transistor to give very roughly a reading of 512, you can change this by altering the 10K value.

However, depending on your application you might suffer from stray light giving just as low a reading as an illuminated sensor. Do not expect very much range, perhaps a couple of inches.

MarkT:
At 20mA its forward voltage is 1.2V,
at 100mA its forward voltage is 1.4V.

[...]

At higher currents you'd need some sort of driver transistor, or MOSFET or relay or whatever.

What is the difference of these two currents?
I want to emit IR continuously and read the intensity of the signal that achieves the receiver.

The ideia of my project is measure the turbidity of the water, so i have the emitter 180º of the receiver and water between them.

So I will measure the turbidity of the water according to the intesity of the signal that reaches the receiver.

What is the difference of these two currents?

Well they are different, one is when you run the LED at 20mA and the other is when you run it at 100mA.

It is part of your design to decide what current you want to flow through the LED. The more current the brighter it will be. If it is 20mA to 30mA this can be powered through an Arduino pin. If it is higher you will have to put the Arduino signal through a transistor in order to achieve the required current. It is the resistor value that determines what current flows whether you use a transistor or not.

Just to be clear!
I want to use a white LED with a LDR or an Infrared LED emitter with a IR receiver.
So you think that the IR receiver and emmiter are more appropriate for this project?

I have a IR kit 5mm LED, is it possible to modulate the LED signal?
I attached the datasheet of the receiver and emitter.

This is the code that Im using now

I have three IR receiver conected analogic pin (A1, A2, A3)

float readings = 20.0;
void setup() {
  Serial.begin(9600);
 
}

void loop() {
  int sum1 = 0;
  int sum2 = 0;
  int sum3 = 0;

  for (int i = 0; i < leituras; i++){
    sum1 += analogRead(A1);
    sum2 += analogRead(A2);
    sum3 += analogRead(A3);
  }
    
    Serial.print("Readings 1: ");
    Serial.print(sum1 / readings );
    Serial.print("   Readings 2: ");
    Serial.print(sum2 / readings);
    Serial.print("   Readings 3: ");
    Serial.println(sum3 / readings);
  
    
    delay(100);
 // } 
}

IR333C.pdf (273 KB)

PT333-3B.pdf (247 KB)

But using it with 100mA doesnt reduce it durability? or any other problem?

What is connected to A1, A2 & A3?

Ops, i forgot to mention that.
I arleady edit my post.
thanks

Gustavohbo:
But using it with 100maH doesnt reduce it durability? or any other problem?

The main “other” problem you have is that an Arduino board cannot directly handle 100mA, so you must use a suitable transistor circuit.

Gustavohbo:
But using it with 100maH doesnt reduce it durability? or any other problem?

mAH is the wrong unit. That describes milliampere hours, not milliamperes.

And how about the IR receiver, which resistence i must use?
I have followed some tutorials online and they said many differents values.
I'm using 5V.
I tried 10k but the output is frozen, and keep showing 14.

The pins of receiver are inverted?
The longer is negative and the shorter is positive?

The pins of receiver are inverted?
The longer is negative and the shorter is positive?

Yes and what of it?

It is a result of having a pull up resistor and the photo transistor pulling down. It makes no odds, you either cope in your code with smaller numbers meaning more light or if you really can't cope with that then subtract your reading from 1023 to invert the values. This sort of thing is normal in embedded systems.

So you think that the IR receiver and emmiter are more appropriate for this project?

No, this thread has been cleaned up by the moderators due to cross posting. You didn't mention your application in your initial thread.

White light is preferable because turbidity is a visible effect, so it makes no sense at all to use IR to measure it.

I tried 10k but the output is frozen, and keep showing 14.

That suggests it it too sensitive and the photo transistor has saturated. So reduce the value of the pull up resistor, try 1K.

I have a IR kit 5mm LED, is it possible to modulate the LED signal?

Yes, but if you modulate it then you must include at the sensor end an amplifier with a frequency response that rejects DC signals and responds only to the modulation frequency. That helps with stray light, but for proper measurements your equipment must be made to measure this in the dark to have any meaning.

Given you are supposed to be a University student then I would have thought that this was blindingly obvious.

You have the arrow pointing in the wrong direction in you block diagram you gave in the first post in the thread. Again not a mistake one would expect from a University student.

I guess you have already seen this project:

Well in my book that student is a fail, because there is no resistors limiting the currents of the LEDs.

Grumpy_Mike:
White light is preferable because turbidity is a visible effect, so it makes no sense at all to use IR to measure it.

But main objective of the sensor is to measure the intesity of the signal that pass through the water.
My thoughts were that the kind of light would not interfere on it. Because in other words what I'm trying to measure is the amount of particles in water that are blocking the light.

So what should I use to measure it?
I already tried a LDR but it was unstable therefore i wasnt suitable for my project
That suggests it it too sensitive and the photo transistor has saturated. So reduce the value of the pull up resistor, try 1K.

Grumpy_Mike:
That suggests it it too sensitive and the photo transistor has saturated. So reduce the value of the pull up resistor, try 1K.

So i tried the 1k and the output still the same, frozen at 14. I burned it? How can i test if it still works?
FIXED: I changed the analogic pin and it worked.

Grumpy_Mike:
Yes, but if you modulate it then you must include at the sensor end an amplifier with a frequency response that rejects DC signals and responds only to the modulation frequency. That helps with stray light, but for proper measurements your equipment must be made to measure this in the dark to have any meaning.
Given you are supposed to be a University student then I would have thought that this was blindingly obvious.

First of all, I am a 20y old chemical engineer student so i dont know much about eletronics and coding Im trying to learn it for my project.
Secondly my equipment is inside a pipe so it already is in the dark.
What is the name of this amplifier that you mentioned? Is it expansive?

Grumpy_Mike:
You have the arrow pointing in the wrong direction in you block diagram you gave in the first post in the thread. Again not a mistake one would expect from a University student.

It is not in the wrong direction.
The yellow portion is Light, so when it hits the hole only the portion that is parallel to the hole passes

6v6gt:
I guess you have already seen this project:
https://www.academia.edu/8319858/Open_source_mobile_water_quality_testing_platform

I havent seen this one yet. This one was very helpful
If you know about any more projects like this one, please send it to me
Thanks for your attention