Go Down

### Topic: Building a Tubidity meter (Read 2506 times)previous topic - next topic

#### Gustavohbo

##### Aug 13, 2020, 02:14 am
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?

#### Gustavohbo

#1
##### Aug 13, 2020, 02:32 am
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.

#### 6v6gt

#2
##### Aug 13, 2020, 03:22 am
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.

#### MarkT

#3
##### Aug 13, 2020, 11:11 am
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.
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

#### Paul__B

#4
##### Aug 13, 2020, 12:15 pm

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.

#### Grumpy_Mike

#5
##### Aug 13, 2020, 12:51 pm
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.

#### Gustavohbo

#6
##### Aug 13, 2020, 08:02 pm
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.

#### Grumpy_Mike

#7
##### Aug 13, 2020, 08:12 pm
Quote
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.

#### Gustavohbo

#8
##### Aug 13, 2020, 08:16 pmLast Edit: Aug 13, 2020, 09:02 pm by Gustavohbo
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)
Code: [Select]
`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); // } }`

#### Gustavohbo

#9
##### Aug 13, 2020, 08:35 pmLast Edit: Aug 13, 2020, 09:53 pm by Gustavohbo
But using it with 100mA doesnt reduce it durability? or any other problem?

#### PaulRB

#10
##### Aug 13, 2020, 08:52 pm
What is connected to A1, A2 & A3?

#### Gustavohbo

#11
##### Aug 13, 2020, 09:03 pm
Ops, i forgot to mention that.
thanks

#### 6v6gt

#12
##### Aug 13, 2020, 09:17 pm
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.

#### aarg

#13
##### Aug 13, 2020, 09:47 pm
But using it with 100maH doesnt reduce it durability? or any other problem?
mAH is the wrong unit. That describes milliampere hours, not milliamperes.
... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

#14