# Building a Tubidity meter

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

and

An Affordable Open-Source Turbidimeter

Both use light-to-frequency sensors to measure the light from LEDs reflected off particles. The codes use the FreqCounter library.

Gustavohbo: 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.

Grumpy_Mike: 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?

Increasing the resistor only reduces the current. It is decreasing the resistor you have to be careful with. Don’t go below about 300R.

Gustavo, this is the kind of diagram I had in mind:

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.

Grumpy_Mike:
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?

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.

Grumpy_Mike: 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:

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.

Gustavohbo: 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:

Clearly you need more like 3M3 or 4M7.

Just adding some info at this point as I had to trawl through the whole thread to find it;

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?

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

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... :)

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?

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.

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?

And I dont know what is part number, is that the datasheet, if so here it is.

IR333C.pdf (273 KB)

PT333-3B.pdf (247 KB)

TomGeorge: 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

Grumpy_Mike:
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

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.

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.

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.

Grumpy_Mike: 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.

dlloyd: 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?