Arduino Forum

Using Arduino => General Electronics => Topic started by: Gustavohbo on Aug 13, 2020, 02:14 am

Title: Building a Tubidity meter
Post by: Gustavohbo on 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?

(https://ibb.co/wK9LDnS)
Title: Understanding Datasheet and calculating resistance
Post by: Gustavohbo on 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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: 6v6gt on 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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: MarkT on 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.
Title: Re: Building a Tubidity meter
Post by: Paul__B on Aug 13, 2020, 12:15 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=377230)


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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: Grumpy_Mike on 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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: Gustavohbo on 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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: Grumpy_Mike on 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.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 13, 2020, 08:16 pm
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);
 // }
}
Title: Re: Understanding Datasheet and calculating resistance
Post by: Gustavohbo on Aug 13, 2020, 08:35 pm
But using it with 100mA doesnt reduce it durability? or any other problem?
Title: Re: Building a Tubidity meter
Post by: PaulRB on Aug 13, 2020, 08:52 pm
What is connected to A1, A2 & A3?
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 13, 2020, 09:03 pm
Ops, i forgot to mention that.
I arleady edit my post.
thanks
Title: Re: Understanding Datasheet and calculating resistance
Post by: 6v6gt on 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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: aarg on 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.
Title: Re: Understanding Datasheet and calculating resistance
Post by: Gustavohbo on Aug 13, 2020, 09:58 pm
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?
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 14, 2020, 05:35 am
Quote
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.

Quote
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.

Quote
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.

Quote
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.
Title: Re: Building a Tubidity meter
Post by: 6v6gt on Aug 14, 2020, 06:18 am
I guess you have already seen this project:
https://www.academia.edu/8319858/Open_source_mobile_water_quality_testing_platform (https://www.academia.edu/8319858/Open_source_mobile_water_quality_testing_platform)
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 14, 2020, 08:35 am
Well in my book that student is a fail, because there is no resistors limiting the currents of the LEDs.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 14, 2020, 06:09 pm
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.

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.

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?

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
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 14, 2020, 08:06 pm
I guess you have already seen this project:
https://www.academia.edu/8319858/Open_source_mobile_water_quality_testing_platform (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
Title: Re: Building a Tubidity meter
Post by: TomGeorge on Aug 15, 2020, 09:30 am
HI,
I think you are going to keep having problems if you are trying to read very small DC values.

My approach would be to modulate the light source and use a optical semiconductor detector.
The receiver detects the modulated light, you filter and measure its amplitude.

That way you filter out ambient light  and electrical noise that can enter the system.

Most systems use scatter methods;
https://www.fondriest.com/environmental-measurements/measurements/measuring-water-quality/turbidity-sensors-meters-and-methods/ (https://www.fondriest.com/environmental-measurements/measurements/measuring-water-quality/turbidity-sensors-meters-and-methods/)

Surely you have resources there at the University that has a chemistry or analysis department that has one of these devices or can supply info about them.

Tom... :)
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 16, 2020, 10:33 am
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
(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=377230)

So the yellow portion has an arrow on the end, this is pointing to the left. This says to anyone that the light is traveling from right to left.

But on the right you label a box saying LDR or receiver, and on the left the box is labeled LED or IR emitter.

You might not have seen the triangular yellow portion as an arrow, but I assure you the rest of the world does.

Quote
What is the name of this amplifier that you mentioned? Is it expansive?
I thing you mean expensive. It is called a "tuned amplifier" an amplifier with a specific frequency response that peaks at the modulation frequency. This is not the sort of amplifier you buy but one that you make.
Title: Re: Building a Tubidity meter
Post by: Paul__B on Aug 16, 2020, 01:55 pm
It is called a "tuned amplifier" an amplifier with a specific frequency response that peaks at the modulation frequency. This is not the sort of amplifier you buy but one that you make.
Actually, the "tuning" is now digital.  You use the same signal that switches the LED on and off, to control a switch (74HC4066) which swaps the amplifier (op-amp) between inverting and non-inverting, and integrate (low pass filter) the result.

If the ADC is sufficiently fast (or you use a much lower frequency that the 38 kHz I mentioned, such as 700 Hz), you can perform this in the Arduino.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 16, 2020, 08:00 pm
HI,
I think you are going to keep having problems if you are trying to read very small DC values.

My approach would be to modulate the light source and use a optical semiconductor detector.
The receiver detects the modulated light, you filter and measure its amplitude.
What do you mean as a optical semiconductor detector?
A LDR or an phototransistor as a infrared receiver?


Surely you have resources there at the University that has a chemistry or analysis department that has one of these devices or can supply info about them.
We have a Turbidity meter at the University but unfortunately due to covid it harder to go there to test or study.
So currently Im trying to do most of my reaserch at home
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 16, 2020, 08:09 pm
(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=377230)

So the yellow portion has an arrow on the end, this is pointing to the left. This says to anyone that the light is traveling from right to left.

But on the right you label a box saying LDR or receiver, and on the left the box is labeled LED or IR emitter.

You might not have seen the triangular yellow portion as an arrow, but I assure you the rest of the world does.
I see what you mean, that was my fault. I did it just as a sketch to post the question

I thing you mean expensive. It is called a "tuned amplifier" an amplifier with a specific frequency response that peaks at the modulation frequency. This is not the sort of amplifier you buy but one that you make.
Ops, another silly mistake but english is not my native language so please take it easy. Anyway thanks for the warning.
Is it possible do this amplifier by software or do i need to buy some kind of hardware?
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 16, 2020, 08:27 pm
which swaps the amplifier (op-amp) between inverting and non-inverting, and integrate (low pass filter) the result.
I didnt understand what you said here. Can you explain this in a less technical way? What is op-amp?

If the ADC is sufficiently fast (or you use a much lower frequency that the 38 kHz I mentioned, such as 700 Hz), you can perform this in the Arduino.
This one that you mentioned (74HC4066) would be able to amplify the signal to 38 kHz or even 700 Hz?
How do i know that the frequency that i chose will not suffer amy kind of interference?
I want to emmit and read the signal continuously, will the tuning interfere on it?
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 16, 2020, 11:51 pm
Quote
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.
Yes it would. The longer wavelength IR light "gets round" small partials that white light would be blocked by.

Have a look at photographs of the night sky taken in visible  light and IR light. The visible light is blocked by dust in the milky way where as the IR light is not blocked by dust it goes round it. Go and ask at your Physics department.

Quote
This one that you mentioned (74HC4066) would be able to amplify the signal to 38 kHz or even 700 Hz?
I think this project is too much for you. The phrase "amplify the signal to a frequency" is meaningless. That chip is not an amplifier it is an analogue switch. You use it to swap signals over.
Title: Re: Building a Tubidity meter
Post by: johnerrington on Aug 17, 2020, 08:40 am
The best way to eliminate external effects is to use a square wave rather than a continuous signal.  Choose a frequency that is not a harmonic of mains frequency.

Drive your LED (white will be fine) from a digital output via a resistor, and use a photodiode or phototransistor to measure the height when its ON.

Then take another measurement when its OFF and subtract the two.

I'd still recommend you exclude ambient light.


My page here shows how to drive an LED (http://www.skillbank.co.uk/arduino/led.htm).
Title: Re: Building a Tubidity meter
Post by: Paul__B on Aug 17, 2020, 05:04 pm
Drive your LED (white will be fine) from a digital output via a resistor, and use a photodiode or phototransistor to measure the height when its ON.

Then take another measurement when its OFF and subtract the two.
As I was suggesting in #22.  :smiley-lol:  It seems you have explained it better.

The best way to eliminate external effects is to use a square wave rather than a continuous signal.  Choose a frequency that is not a harmonic of mains frequency.
Which is why I suggested 700 Hz.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 17, 2020, 09:34 pm
The best way to eliminate external effects is to use a square wave rather than a continuous signal.  Choose a frequency that is not a harmonic of mains frequency.

Drive your LED (white will be fine) from a digital output via a resistor, and use a photodiode or phototransistor to measure the height when its ON.

Then take another measurement when its OFF and subtract the two.

I'd still recommend you exclude ambient light.


My page here shows how to drive an LED (http://www.skillbank.co.uk/arduino/led.htm).
How do i filter the light/signal that the phototransistor is reading?
And how do I modulate the frequency of the LED?
Can you indicate me a photodiode that you would use. I have the cheap ones and I dont know if they are very good and the only ones I have are covered with some black filter that filter most of the visible light.

Thanks for your help!
Title: Re: Building a Tubidity meter
Post by: johnerrington on Aug 18, 2020, 08:53 am
OK Gustav, you will know that low energy (infra-red 800 - 1000nm) will penetrate MUCH better than high energy (blu-violet 380 - 480nm)

unfortunately silicon (& germanium) photodevices are MUCH more sensitive to infra-red (peak typically 900nm) and have little sensitivity to blue light.

So ideally you'ld like a detector that is uv/blue sensitive.  You could use a VEML6070 and pair it with a UV LED.

As a compromise I'd recommend you use a high intensity blue LED (around 460nm) - or even white - and a silicon phototransistor that DOES NOT HAVE  a black coating.

Ebay - loads for little money (a few pence).  EG
https://www.ebay.co.uk/itm/IR-Infrared-Visible-Phototransistor-450mn-1070nm-50-3mm-2-Pin-Osram-SFH-310/302831495809?hash=item468229ea81:g:yvAAAOSwqvNaT~g0

An interesting alternative would be to use an LED as a detector (yes you can)
https://wiki.analog.com/university/courses/electronics/electronics-lab-led-sensor?rev=1551786227
Title: Re: Building a Tubidity meter
Post by: Paul__B on Aug 19, 2020, 04:39 pm
How do I filter the light/signal that the phototransistor is reading?
It's not so much filtering the light, but restricting the light coming in to that from the LED as far as possible.  As to the signal, you may need an amplifier (op-amp) between the photodiode and the analog input.

And how do I modulate the frequency of the LED?
The LED is switched on and off by the same Arduino that you use to read the photodiode.  So you take successive readings when the LED is turned on and when it is turned off, in order to compare them.

Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 19, 2020, 07:35 pm
It's not so much filtering the light, but restricting the light coming in to that from the LED as far as possible.  As to the signal, you may need an amplifier (op-amp) between the photodiode and the analog input.
So what you meaning is that the phototransistor must be in dark and somewhere that heat and other kind of interference doesnt reach it?

The LED is switched on and off by the same Arduino that you use to read the photodiode.  So you take successive readings when the LED is turned on and when it is turned off, in order to compare them.
But how do i do this switch?
I saw one video using delay() but if my code bigger the delay will not work as expected.

Code: [Select]
void setup() {
  Serial.begin(9600);
  pinMode(4, OUTPUT);
  pinMode(A3, INPUT);
}

void loop() {

    digitalWrite(4,HIGH);
    delay(13);
    Serial.println(analogRead(A3));
    digitalWrite(4,LOW);
    delay(13);
    Serial.println(analogRead(A3));
}

I tried this code just to see what would happen.
LED emissor -> pin 4
Phototransistor -> pin A3
When the LED is on it gives near 600 and when it is off it gives 1023
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 19, 2020, 07:43 pm
So ideally you'ld like a detector that is uv/blue sensitive.  You could use a VEML6070 and pair it with a UV LED.

As a compromise I'd recommend you use a high intensity blue LED (around 460nm) - or even white - and a silicon phototransistor that DOES NOT HAVE  a black coating.

Thanks for you help!
Now i just have some infrared kit and white LED's.
I will try to build the sensor white infrared and measure it behavior, if it works as expected maybe I will try to improve it with the LED and UV sensor.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 19, 2020, 07:48 pm
Mike
I found this code that you posted in an old topic about modoluting a LED and I wanted to know if I copy and paste it will work in a arduino nano.
And how does it work?

Code: [Select]
/* Code to pulse pin 3 with a modulated signal
* Can be used to drive an IR LED to keep a TSOP IR reciever happy
* This allows you to use a modulated reciever and a continious beam detector
* By Mike Cook Nov 2011 - Released under the Open Source licence
*/
volatile byte pulse = 0;

ISR(TIMER2_COMPB_vect){  // Interrupt service routine to pulse the modulated pin 3
    pulse++;
  if(pulse >= 8) { // change number for number of modulation cycles in a pulse
    pulse =0;
    TCCR2A ^= _BV(COM2B1); // toggle pin 3 enable, turning the pin on and off
  }
}

void setIrModOutput(){  // sets pin 3 going at the IR modulation rate
  pinMode(3, OUTPUT);
  TCCR2A = _BV(COM2B1) | _BV(WGM21) | _BV(WGM20); // Just enable output on Pin 3 and disable it on Pin 11
  TCCR2B = _BV(WGM22) | _BV(CS22);
  OCR2A = 51; // defines the frequency 51 = 38.4 KHz, 54 = 36.2 KHz, 58 = 34 KHz, 62 = 32 KHz
  OCR2B = 26;  // deines the duty cycle - Half the OCR2A value for 50%
  TCCR2B = TCCR2B & 0b00111000 | 0x2; // select a prescale value of 8:1 of the system clock
}

void setup(){
  setIrModOutput();
  TIMSK2 = _BV(OCIE2B); // Output Compare Match B Interrupt Enable
}

void loop(){
// do something here
}
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 20, 2020, 12:22 am
Quote
if I copy and paste it will work in a arduino nano.
Yes.

Quote
And how does it work?
It changes the registers that control Timer 2 in the chip. This timer controls two of the PWM generators and by altering the prescaller of the timer's input it changes the frequency. The names in all capitals are the internal register addresses. You can look them up in the data sheet of the 328 processor which is used both in the nano and the Uno.
Timer operations can be hard to understand because what is important is what individual bits are changed in these registers. The collection of bits make up the number you put into them, but the numbers themselves don't have any meaning other than defining the bit pattern.

The TSOP series of detectors have built in tuned amplifiers to help with the rejection of ambient light. They are mainly used for TV remote controls.

Quote
But how do i do this switch?
By using the analogue multiplexers you mentioned previously.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 20, 2020, 01:36 am
The TSOP series of detectors have built in tuned amplifiers to help with the rejection of ambient light. They are mainly used for TV remote controls.
If i use this code with the phototransistor that i have it will work as expected but it could suffer of ambient light inteferrence?

By using the analogue multiplexers you mentioned previously.
Like the 555?
Just to be sure, if I use one of this i will not need your code?
Thanks for explainig the code!
Title: Re: Building a Tubidity meter
Post by: johnerrington on Aug 20, 2020, 08:51 am
You can use this code
https://www.arduino.cc/en/tutorial/BlinkWithoutDelay
and just change the interval from 1000 to say 43.
That will give you a 43ms on & off.
then in this bit of the code
Code: [Select]
// if the LED is off turn it on and vice-versa:
    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;
    }


add in lines to measure the transistor level when LED ON & OFF and subtract to get the difference.
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 20, 2020, 09:31 am
Quote
Like the 555?
No the 74HC4066.

Quote
If i use this code with the phototransistor that i have it will work as expected but it could suffer of ambient light inteferrence?
There is no point in modulating the LED, if you do not use a tuned amplifier on the receiver, and the tuned amplifier is what gives the light sensor some degree of ambient noise immunity. Ever with a modulated light source and tuned amplifier too much ambient light can saturate the light sensor and so you will not be able to do your measurements.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 20, 2020, 07:55 pm
Ever with a modulated light source and tuned amplifier too much ambient light can saturate the light sensor and so you will not be able to do your measurements.
I understand but in my project the phototransistor will be covered or inserted in a structure like a 3D printer adapter so I guess the ambient light will not interefere that much.

My partener and I were doing some tests and we noticed that the reading wasnt stabilizing so we thought that the temperature was interfering the results.
Does the temperature can interfere the reading of signal?
If so is this interfance substancial?
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 21, 2020, 04:00 am
Quote
Does the temperature can interfere the reading of signal?
Not in the way you are experiencing. Temperature changes would affect the signal level but only on the time scale of the temperature changes.

There are many reasons why the signal was not stabilising, one might be if the sample fluid was in motion. 
Title: Re: Building a Tubidity meter
Post by: Paul__B on Aug 22, 2020, 12:56 am
There are many reasons why the signal was not stabilising, one might be if the sample fluid was in motion.  
That would be the very first thing to consider!  :smiley-roll:
Title: Re: Building a Tubidity meter
Post by: johnerrington on Aug 22, 2020, 08:41 am
Fascinating project. Can you give us some more detail about your experimental set-up? (eg a diagram or sketch?)
and also on the characteristics of the liquid you are using, as if its homogeneous this may not work?

Quote
In turbulent flow the speed of the fluid at a point is continuously undergoing changes in both magnitude and direction.
So you should not expect a smooth signal. Perhaps you could do a statistical analysis of the variations you are seeing; in any case, the fact you ARE seeing variation is a good sign your messurement system is working.

Are you measuring transmitted or 90 degree scattered light? or both? and how are you collimating the light from the LED?
https://publiclab.org/questions/warren/12-18-2017/can-a-diy-spectrometer-be-used-to-measure-water-turbidity
Title: Re: Building a Tubidity meter
Post by: Nazaar-- on Aug 22, 2020, 10:13 am
I've used scientific turbidity meters in the field, and even the ones with 2ml cuvettes don't fully stabilise within a minute or so. The meters just look at the readings and lock them when they're relatively stable.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 22, 2020, 07:05 pm
There are many reasons why the signal was not stabilising, one might be if the sample fluid was in motion. 
I am aware of this, for now I am testing it in small scale prototype that I put and take out the water.
If the prototype works fine I will install it on my home plumbing and with it a flow sensor so I the turbidity sensor will only measure the turbidity when there is no flow.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 22, 2020, 07:46 pm
Fascinating project. Can you give us some more detail about your experimental set-up? (eg a diagram or sketch?)
and also on the characteristics of the liquid you are using, as if its homogeneous this may not work?
I dont have a sketch of the actual prototype but I have of the old one with and LED and a LDR and the idea is the the same.
The only difference is that the actual has a infrared LED and a fototransistor.
OBS: I dont know how to attach an Image here so I atacched it at the end.

So the main objective is to measure if the water that Im receiving at home is always clear, for now I dont want to measure the turbidity in any scale (NTU, FTU, ...).

Im trying to make three equal sensors, so now I am analyzing their behavior with the same liquid and observating if they suffer the same variation from one sample to another. To make some tests with the sensor I am soiling (I dont know if it the correct word I used google translator for this one) the water with some dirt, coffee, milk.

So you should not expect a smooth signal. Perhaps you could do a statistical analysis of the variations you are seeing; in any case, the fact you ARE seeing variation is a good sign your messurement system is working.
In the future I will try to make some statics analizing.

Are you measuring transmitted or 90 degree scattered light? or both? and how are you collimating the light from the LED?
Currently I am using a 180º sensor but i think that i will make another prototype with the 90º and compare them.

I am not collimating the light, i didnt even think about it. I will make some research about it
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 22, 2020, 07:52 pm
Im using a 10k ohm pull up resistor what would happen with the reading if I reduce or increase it?

I want to know if there is some whey to make the sensor a bit more sensitive?
In the scale 0-1023 if there is nothing in the pipe (Air) the output is near 30 and if I put clear water the output goes to near 60.
Title: Re: Building a Tubidity meter
Post by: Nazaar-- on Aug 24, 2020, 01:55 pm
Quote
If you know about any more projects like this one, please send it to me
Thanks for your attention
These might be interesting to you:

A low cost continuous turbidity meter (https://www.mdpi.com/1424-8220/19/14/3039)

and

An Affordable Open-Source Turbidimeter (https://www.mdpi.com/1424-8220/14/4/7142)

Both use light-to-frequency sensors to measure the light from LEDs reflected off particles. The codes use the FreqCounter library.
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 24, 2020, 05:47 pm
Im using a 10k ohm pull up resistor what would happen with the reading if I reduce or increase it?
I think I answered this before. Increasing it will make it more sensitive. As a transistor is a current operated device the voltage changes more across a higher value resistor than a lower one for any given current through it. Its called ohms law.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Aug 28, 2020, 07:53 pm
I think I answered this before. Increasing it will make it more sensitive. As a transistor is a current operated device the voltage changes more across a higher value resistor than a lower one for any given current through it. Its called ohms law.
If I increase it a lot is there any chance of burning something? or something bad happpen?
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Aug 29, 2020, 05:11 am
Increasing the resistor only reduces the current. It is decreasing the resistor you have to be careful with. Don't go below about 300R.
Title: Re: Building a Tubidity meter
Post by: johnerrington on Aug 29, 2020, 08:15 am
Gustavo, this is the kind of diagram I had in mind:

(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=379594)

the collimators are there to control the illumination angle and prevent light leaking from the source directly to the detector(s).

Ideally you want a narrow beam from the source, so choose an LED with a narrow beam angle.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 13, 2020, 08:40 pm
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.
I stopped trying to measure the turbidity with these pair of infrared sensor, but now i need to make some new tests so I came back to this topic and read I all once again and I this part called my atention.
Why I should aim to measure 512 with an un-iliminated photo transistor?
And what you mean with a un-iluminated sensor?
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Nov 14, 2020, 12:17 am
Potential dividers work best when the two legs are about the same because any change in the sensor's value.
 Sensor and photo transistor are the same thing.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 15, 2020, 10:48 pm
Potential dividers work best when the two legs are about the same because any change in the sensor's value.
So i tried many resistors to reach  readings near 512 while the sensor is un-ilumininated but i think something is weird. I tried a wide range of resistor but still the reading are high.
1k      -> Un-iluminated Sensor = 995
2.2k   -> Un-iluminated Sensor = 994/995
3.3k   -> Un-iluminated Sensor = 994/995
10k    -> Un-iluminated Sensor = 992/993
22k    -> Un-iluminated Sensor = 990
100k  -> Un-iluminated Sensor = 983
1M    -> Un-iluminated Sensor = 824

My schematic:
(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=389568)
Title: Re: Building a Tubidity meter
Post by: aarg on Nov 15, 2020, 10:56 pm
I didn't read the entire thread, but it seems to me, your reference value of 512 should be when illuminated using a calibration solution - i.e. distilled water in the actual test fixture if you are measuring turbidity in water. Not when un-illuminated.
Title: Re: Building a Tubidity meter
Post by: MarkT on Nov 16, 2020, 12:19 am
So i tried many resistors to reach  readings near 512 while the sensor is un-ilumininated but i think something is weird. I tried a wide range of resistor but still the reading are high.
1k      -> Un-iluminated Sensor = 995
2.2k   -> Un-iluminated Sensor = 994/995
3.3k   -> Un-iluminated Sensor = 994/995
10k    -> Un-iluminated Sensor = 992/993
22k    -> Un-iluminated Sensor = 990
100k  -> Un-iluminated Sensor = 983
1M    -> Un-iluminated Sensor = 824

My schematic:
(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=389568)
Clearly you need more like 3M3 or 4M7.
Title: Re: Building a Tubidity meter
Post by: johnerrington on Nov 16, 2020, 06:53 am
Just adding some info at this point as I had to trawl through the whole thread to find it;

Quote
the actual has a infrared LED and a fototransistor.
Gustav, you need to get the sensor part working first.  You also need to understand the behaviour of the devices you are using.

When un-illuminated a good (ideal) phototransistor should have infinite resistance -as no carriers are being generated at the junction.

Hence there is NO POINT in making measurements with it unlit.  Its no surprise your readings are high.
Really it would be better to

measure the current through the phototransistor, so connect it to +5 and your resistor to ground.

Try a 10k resistor.

Then point the LED at the phototransistor. 

Check how the value changes with LED on & LED off.

Come back to us with ..

1: DETAIL what are the device part numbers?

2: REVISED SCHEMATIC  - so we can see what you have done

3: ANSWERS - what results did you get? 

Meanwhile read this

https://johnloomis.org/ece445/topics/egginc/pt_char.html

Title: Re: Building a Tubidity meter
Post by: TomGeorge on Nov 16, 2020, 07:36 am
Hi,
Can you please post a  picture of your phototransistor please?
You are  sure you are connected to the correct legs?
What is the part number off the phototransistor?

Thanks... Tom... :)
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Nov 16, 2020, 10:32 am
Quote
So i tried many resistors to reach  readings near 512 while the sensor is un-ilumininated
Is the sensor in the dark or is it exposed somehow to daylight?
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 16, 2020, 07:35 pm
Quote
Gustav, you need to get the sensor part working first.  You also need to understand the behaviour of the devices you are using.
I know, that is what I am trying to do but now I am having some problems with how the phototransitor work and which resistor I must use.
Quote
measure the current through the phototransistor, so connect it to +5 and your resistor to ground.
1: DETAIL what are the device part numbers?
I did not understand this part is that what you mean?
(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=389700)
And I dont know what is part number, is that the datasheet, if so here it is.

Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 16, 2020, 07:41 pm
Hi,
Can you please post a  picture of your phototransistor please?
You are  sure you are connected to the correct legs?
What is the part number off the phototransistor?

Thanks... Tom... :)
In the begging I was making some mistakes with the phototransistor legs but now I already fixed it. The longer is at GND and the shorter is at 5V. And about the part number I already anserwered in the previous post. Thank for your help 
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 16, 2020, 07:47 pm
Is the sensor in the dark or is it exposed somehow to daylight?
It was exposed but i did this test at night so there was no ilumination besides the light bulb. 
Today I did some tests during the morning and the 22k resistor reduced the reading to about 570
Title: Re: Building a Tubidity meter
Post by: dlloyd on Nov 16, 2020, 09:15 pm
Some things to think about or experiment with: (sorry, I didn't read through all the previous replies)

What range of operation do you need?
When looking at the ADC, you have 0-1023 which would represent 0-5V on the analog input.
When looking at the phototransistor, check the "Collector Current vs. Irradiance curve" ... it only shows 1 one order of magnitude in range, however if you extend the line to the left down to 0.01mA (dark current) there's really 3 orders of magnitude. Therefore, the maximum range of the phototransistor is from dark current (0.01mA) to 10mA (on the graph) ... absolute max is 20mA.
Ideally you would use the full range of the ADC for the desired operating range of the turbidity meter.

Max Reading Calibration:
For example, say you'd like to use a range of 0.1mA to 10mA representing analog reads of 10 to 1000. If you wire up the phototransistor so that its collector is at 5V and the resistor is from emitter to GND, then the signal will go lower as the light levels get darker and increase for increasing light levels. The minimum reading will be difficult to calibrate, but it could be measured and utilized in your code. To calibrate for maximum reading, first, get a good level of infrared light ... for example, 100 to 220 ohm in series with the IRLED. Then, use a resistor in series with the emitter that gives close to 1000 ADC count with clear liquid.
Title: Re: Building a Tubidity meter
Post by: Grumpy_Mike on Nov 16, 2020, 10:01 pm
The resistor in that photograph seems to show an IR LED, with a 10K resistor. That is way too high to give you a decent amount of light. You need something like a 47R for that.

Quote
is that the datasheet
Well the LED data sheet shows a clear housing, so if that part is the IR emitter it is not the data sheet for the one you have.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 16, 2020, 11:09 pm
The resistor in that photograph seems to show an IR LED, with a 10K resistor. That is way too high to give you a decent amount of light. You need something like a 47R for that.
Well the LED data sheet shows a clear housing, so if that part is the IR emitter it is not the data sheet for the one you have.
No I think the way that it is wired to the bread board confused you.
The picture represents the way that johnerrington requested me, so I could measure the current through the phototransistor
The black one is the phototransistor and the clear one is the Infrared LED.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 16, 2020, 11:26 pm
Some things to think about or experiment with: (sorry, I didn't read through all the previous replies)

What range of operation do you need?
When looking at the ADC, you have 0-1023 which would represent 0-5V on the analog input.
When looking at the phototransistor, check the "Collector Current vs. Irradiance curve" ... it only shows 1 one order of magnitude in range, however if you extend the line to the left down to 0.01mA (dark current) there's really 3 orders of magnitude. Therefore, the maximum range of the phototransistor is from dark current (0.01mA) to 10mA (on the graph) ... absolute max is 20mA.
Ideally you would use the full range of the ADC for the desired operating range of the turbidity meter.

Max Reading Calibration:
For example, say you'd like to use a range of 0.1mA to 10mA representing analog reads of 10 to 1000. If you wire up the phototransistor so that its collector is at 5V and the resistor is from emitter to GND, then the signal will go lower as the light levels get darker and increase for increasing light levels. The minimum reading will be difficult to calibrate, but it could be measured and utilized in your code. To calibrate for maximum reading, first, get a good level of infrared light ... for example, 100 to 220 ohm in series with the IRLED. Then, use a resistor in series with the emitter that gives close to 1000 ADC count with clear liquid.
Thanks for your help, I think that what you said will be very helpful
But I dont get it, what is the real difference between using the ADC 'scale' and the phototransistor 'scale'? They have about the same range
So the difference between a pull-up resistor and a pull-down resistor is the interaction with reading? 
Pull-down is no light is 0 and direct light 1023 and Pull-up is no light 1023 and direct light 0
Title: Re: Building a Tubidity meter
Post by: dlloyd on Nov 17, 2020, 12:49 am
Quote
But I dont get it, what is the real difference between using the ADC 'scale' and the phototransistor 'scale'? They have about the same range
Its good if you can achieve 0 to full scale swing on the ADC (0-1023). However, what if the reading stays at 0 until 30% light and rises to 1023 when the light level increases to 50%? In this case, you'll read 1023 for direct light (100%) and 0 for no light (0%) but your meter will have "tunnel vision". Here, 80% of what needs to be within measurement range is excluded. Other possibilities are some of the upper range or lower range excluded, therefore choosing the resistor(s) value is important. Ideally, the range in light levels to be measured will use up most of the ADC range available.

Quote
So the difference between a pull-up resistor and a pull-down resistor is the interaction with reading?
Pull-down is no light is 0 and direct light 1023 and Pull-up is no light 1023 and direct light 0?
With resistor on the collector end of the phototransistor (pullup) the signal level decreases for increasing light levels.
With resistor on the emitter end of the phototransistor (pulldown) the signal level increases for increasing light levels.
Each connection method operates inversely to the other. Also, the recorded signal's response can be "flipped" in your code if needed. For example: Reading = 1023 - analogRead(photoTransistor);
Title: Re: Building a Tubidity meter
Post by: johnerrington on Nov 17, 2020, 07:32 am
@Gustav great progress. Thanks for data sheets too - sorry I didnt spot them in your second post.

Part numbers

Phototransistor is PT333-3B,

important characteristics are
dark current 100nA &
On State Collector Current 3mA

Emitter is 5mm Infrared LED,T-1 3/4IR333C/H0/L10

important characteristics are
Forward voltage Vf = 1.4V at If = 20mA

Lets get the idea working first and deal with any problems as we meet them.

You need to drive your LED with a square wave from the NANO. An output pin can provide up to 40mA max but lets just go for 20mA. Vol is about 0.7V at 20mA and Vf for the diode about 1.4
so we have 5V -(0.7 +1.4) = 2.9V left and 2.9V 20mA = 150 ohms

If the phototrans is passing 3mA when the LED is ON then you need 3mA 5V = 1k6, 2k2 or so

schematic looks like this

(https://forum.arduino.cc/index.php?action=dlattach;topic=700105.0;attach=389769)

run the program and tell us the high and low value readings

Code: [Select]
/* copied from arduino examples
  Blink - Turns on an LED on for one second, then off for one second, repeatedly.
  AnalogRead example
  This example code is in the public domain.
 */
 
int led = 4;
int det = A0;
int val = 0; //value from adc

void setup() {                
  pinMode(led, OUTPUT);  // initialize the digital pin as an output.
 Serial.begin(9600);           //  setup serial  
}

void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  val = analogRead(det);  // read the input pin
  Serial.println(val);          // debug value
  delay(1000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  val = analogRead(det);  // read the input pin
  Serial.println(val);
  delay(1000);               // wait for a second
}




Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 17, 2020, 09:50 pm
run the program and tell us the high and low value readings
Thanks for your help, I did every this as you said and the results are:
The LED is immediately in front of the phototransistor about 5mm apart from each other
When the LED is ON the output is about 1000 and when it is OFF the output is about 30.
I noticed that if I cover the phototransitor with my hand while the LED is OFF the readings decrease more, to about 3 a few times even 0.
Where did you make this schematic?
And what does dark current mean?
Title: Re: Building a Tubidity meter
Post by: raschemmel on Nov 17, 2020, 10:09 pm
Do you have a test chamber and some method to simulate the turbidity range ?
Title: Re: Building a Tubidity meter
Post by: johnerrington on Nov 18, 2020, 06:54 am
Hi Gustav..
Those are great results, couldnt be better.
Quote
I noticed that if I cover the phototransitor with my hand while the LED is OFF the readings decrease more, to about 3 a few times even 0.
Yes - the phototransistor is sensitive to light.

Quote
Where did you make this schematic?
How to make a schematic you can post. (https://forum.arduino.cc/index.php?topic=705669.0)


Quote
what does dark current mean?
https://en.wikipedia.org/wiki/Dark_current_(physics)

Your next steps - modify the code to subtract the dark value (LED off) from the light value (LED on)
and reduce the delay to 10msec.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 18, 2020, 06:22 pm
Do you have a test chamber and some method to simulate the turbidity range ?

Unfortunately due to Corona Virus pandemic I am not able to frequent the university, so I dont have a proper method to simulate the turbidity, but I have some 3D printed test chambers that I am using to test.
But for now I am trying to understand and make the phototransistor work as expected.


Title: Re: Building a Tubidity meter
Post by: raschemmel on Nov 18, 2020, 07:28 pm
Well, actually I didn't mean anything that fancy. I just meant a 1/2" diameter glass beaker with various percentage'
mixtures of some powder that blocks light so you can vary the light intensity by varying the mixture percentage.
I'm not a chemist or artist so I wouldn't have a clue what powder particles would work best. It only needs to be 1"
high so size is not an issue. Most of the work would be experimenting to find a suitable powder.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 18, 2020, 07:35 pm
Your next steps - modify the code to subtract the dark value (LED off) from the light value (LED on)
and reduce the delay to 10msec.
Ok, but why? what does the result of this subtraction mean?
When I copy and paste the code that you send to me te output is not as god as the one I said before, I have add another two delay, right after the digitalWrite that controls the LED.
If i run the code as you sent the results are:
ON: 993    OFF: 886    ->     ON: 994    OFF: 924    ->   ON: 995    OFF: 925
Code: [Select]

void loop() {
  digitalWrite(led, HIGH);  
  delay(100);               // NEW DELAY
  val = analogRead(det);  
  Serial.print("ON: ");
  Serial.println(val);          
  delay(1000);              
  digitalWrite(led, LOW);    
  delay(100);               // NEW DELAY
  Serial.print("OFF: ");
  val = analogRead(det);  
  Serial.println( val);
  delay(1000);              
}


I did as you said and this is the output:
ON: 972 OFF: 4 Subtraction: 968
ON: 972 OFF: 3 Subtraction: 969
ON: 972 OFF: 3 Subtraction: 969

Basically I added this 2 lines at end and reduced all for delays to 10miliseconds
Code: [Select]
Serial.print("\tSubtraction: ");
Serial.println(val1 - val2);  //Subtract the output when the LED is ON from OFF




Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 18, 2020, 07:45 pm
Well, actually I didn't mean anything that fancy. I just meant a 1/2" diameter glass beaker with various percentage'
mixtures of some powder that blocks light so you can vary the light intensity by varying the mixture percentage.
I'm not a chemist or artist so I wouldn't have a clue what powder particles would work best. It only needs to be 1"
high so size is not an issue. Most of the work would be experimenting to find a suitable powder.
I already did some test with wheat flour, coffee, dirt and paint. But it is very unstable, I could realize the same test with the same sample with another prototype or even the same prototype but a few days later and have a different output, maybe the powder decanted or reacted with something in the water... there are many variables.
I can not repeat the test with another prototype and expect the same output because I can not trust that the sample is the same that it was in the other protype/test.
But for simple tests, as just know if the sensor is working as expected coffee and flour are great.
Title: Re: Building a Tubidity meter
Post by: raschemmel on Nov 18, 2020, 08:07 pm
I meant powder:water ratio
or milk:water
or powder:some other clear liquid
Title: Re: Building a Tubidity meter
Post by: johnerrington on Nov 19, 2020, 06:52 am
Quote
Ok, but why? what does the result of this subtraction mean?
COme on Gustav, its the difference between the photosensor with led on & LED off - so its measuring the light coming from the LED.

You have a pint of beer. You need to know how much you have drunk.
Amount drunk =amount originally - amount left.

You NEED to exclude outside light from your system. Thats why your "dark" reading is high as compared to this

Quote
When the LED is ON the output is about 1000 and when it is OFF the output is about 30.
I noticed that if I cover the phototransitor with my hand while the LED is OFF the readings decrease more, to about 3 a few times even 0.
Title: Re: Building a Tubidity meter
Post by: Gustavohbo on Nov 22, 2020, 08:30 pm
Quote
You NEED to exclude outside light from your system. Thats why your "dark" reading is high as compared to this
I fixed this issue. Now the LED and the Phototransitor are inside a dark container that day light can not reach.
And I weld some wire to the LED and phototransistor to wire it to the breadboard.
Now the output is very stable:
ON: 989   OFF: 0   Subtraction: 989
ON: 989   OFF: 0   Subtraction: 989
ON: 989   OFF: 0   Subtraction: 989

The output from other phototransitor that is exposed to day light at the same time is:
ON: 973    OFF: 13
ON: 973    OFF: 13
ON: 973    OFF: 13
Title: Re: Building a Tubidity meter
Post by: johnerrington on Nov 23, 2020, 09:02 am
Thats great. The subtraction is to exclude lots of other effects - stray light, temperature changes etc.
Time now to try it with your sample tube.