IR Phototransistor detection IR LED

I have two circuits. One with a IR LED hooked in series with a 100 ohm resistor and the other with an 100 ohm resistor and a phototransistor which leads into an analog input. When the IR LED is not on i receive a reading of 978-1022. when the LED is on I received a constant 1023. Shouldn't their be more difference than this or is this all i get to work with? Thank for the help.

BTW both LED and phototransistor are SIZE t1-3/4(5mm)

How are you wiring up the phototransistor? You should probably have the resistor from +5v to the transistor collector, the transistor emitter to ground, and the resistor/collector junction to the arduino analog input. I'd recommend a larger resistor, maybe around 1k (and adjust as needed), since you really don't need (or want) a lot of current in your detector circuit. This arrangement would give you a low reading when sensing light, and a high reading in dark.

Also, do you have any light shielding on the phototransistor? They detect a fairly wide range of light, although most sensitive around IR. This is why TVs, DVD players, etc, have that dark plastic window in front of the detector. It cuts down a lot of the visible light spectrum, but is more transparent at IR wavelengths.

I’d recommend a larger resistor, maybe around 1k

Yes I would say even bigger, 100K is not out of the question. The bigger this resistor the bigger voltage change you see for a given current in the detector. However too big and it won’t work at all due to lack of current.

Er, ok... I haven't experimented much with phototransistors in a while... I just did some testing and had to go to a 100k resistor to get a good range. But, as I mentioned, it was definitely sensitive to ambient room lighting. Reading about 30 in full room light, and 1023 in full darkness. Your results may vary with different phototransistors.

Yes as you make the photo detector more sensitive then the background light becomes more of an issue as well.

There is also an effect known as "Dark Current" this is the current you get from a detector with no light on it. This again looks like a background light signal.

Those two factors will affect how high you can push the resistor.

Is that a pull down resistor, if so then you want to decrease the resistance so the analog read is lower due to 'more ground' but if it is a pull up resistor then you want a bigger resistor to 'decrease the 5v'.

This obviously depends on what circuit you are using. I use 5v-photoresistor-resistor-gnd Then the analog read pin after the photoresistor and before the resistor.

Hope that makes sense,

Mowcius

From earlier on in the discussion:-

You should probably have the resistor from +5v to the transistor collector,

so:-

Is that a pull down resistor,

Will be a NO

you want a bigger resistor to 'decrease the 5v'.

No resistors don't decrease voltage. They reduce current. There is a difference.

oh sorry I wasn't reading the 'transistor' part. That is how you would do it with an LDR.

Mowcius

I tried a bit more. this is what I tried

5v-----100k resitor-----phototransistor------analog input

I recieve a solid reading of 1023 in normal room light with or with out an IR LED on. Should there be a diffrence?

If I know the answer to this it may help. What does the 1023 actually represent?

An analog pin reading of 1023 means the pin is receiving 5v (or more), which in turn means your phototransistor is already saturated in normal room light. If the phototransistor is saturated, no amount of additional light will change the readings because it's already at max output .

Phototransistors without an IR pass filter are a PITA because they can be so sensitive to ambient light. I my current crop of projects I gave up on them and started capacitive touch pads and voltage divider touch switches.

--Tim.

So if I put filter over the phototransistor all my problems should* be solved?

I can do that. Ill let you know the results.

5v-----100k resitor-----phototransistor------analog input

Wrong

5V --- 100K ---- analogue input & photo transistor collector ---- photo transistor emitter --- ground.

Thanks Grumpy_Mike. That was it. Sorry for the stupidity. Thanks for you help.