# help with voltage comparator

#### indianhits

Joined Jul 25, 2009
86
Where is the spec sheet for your photodiode?
i didn't actually buy any component i just wanted to make sure everything was right before i proceed further

i think this is the right way to keep the photodiode right?i know about reverse current but what my instructor has told me is that it will even work fine by connecting it in forward bias since the photodiode only conducts when light falls on it.

and how do engineers avoid ambient light from entering into the photodiode since i want my photodiode to sense only the IR light are there any filters for that like IR filters?

and as mentioned above i want only 5V when '+' is more and 0V when '-' is more so what should i do to the -ve supply pin should i just leave it or should i ground it.

#### Audioguru

Joined Dec 20, 2007
11,249
i think this is the right way to keep the photodiode right?
The 60 ohm resistor in series with the photo-diode does nothing and can be replaced with a piece of wire.
The (+) input of the comparator is floating so it needs a resistor to ground, maybe 100k ohms.
The resistors connected to the (-) input of the comparator have values that are much too low. Use values that are 1000 times higher.
The comparator needs a little hysteresis as is explained in the datasheet.
The output of the comparator needs a pullup resistor.

I know about reverse current but what my instructor has told me is that it will even work fine by connecting it in forward bias since the photodiode only conducts when light falls on it.
No.
A forward-biased photo-diode conducts all the time, even in the dark.
A photo-diode is used with reverse-bias and with zero-bias, never with forward-bias.

how do engineers avoid ambient light from entering into the photodiode since i want my photodiode to sense only the IR light are there any filters for that like IR filters?
You can buy photo-diodes and IR receiver ICs that look black because they have a coating that passes IR but blocks ordinary light.

i want only 5V when '+' is more and 0V when '-' is more so what should i do to the -ve supply pin should i just leave it or should i ground it.
It should be biased near half the supply voltage like it is now.

#### Jaguarjoe

Joined Apr 7, 2010
767
i didn't actually buy any component i just wanted to make sure everything was right before i proceed further
When you go to radio shack, skip the photodiode and buy a $1.79 IR phototransistor instead. It provides a much better signal. Thread Starter #### indianhits Joined Jul 25, 2009 86 It should be biased near half the supply voltage like it is now. i lost you! When you go to radio shack, skip the photodiode and buy a$1.79 IR phototransistor instead. It provides a much better signal.
but i heard phototransistors have low response time.

#### Audioguru

Joined Dec 20, 2007
11,249
"It should be biased near half the supply voltage like it is now."
i lost you!
The 66 ohm and 100 ohm resistors in series (that could be 66k ohms and 100k ohms) provide a bias voltage of 3.0V to the (-) input of the comparator that is near half the 5V supply. Then its output switches when the input signal is above and below 3.0V.

I heard phototransistors have low response time.
An LDR is very slow. A photo-transistor is faster. Photo-diodes are very fast and are used in IR receiver ICs in remote controls that operate at 38kHz.

#### indianhits

Joined Jul 25, 2009
86
The 66 ohm and 100 ohm resistors in series (that could be 66k ohms and 100k ohms) provide a bias voltage of 3.0V to the (-) input of the comparator that is near half the 5V supply. Then its output switches when the input signal is above and below 3.0V.

An LDR is very slow. A photo-transistor is faster. Photo-diodes are very fast and are used in IR receiver ICs in remote controls that operate at 38kHz.
oh you mean that one sorry what i really wanted to ask was that what should i do with the PIN 4 consider that i am using IC 741

http://en.wikipedia.org/wiki/File:Generic_741_pinout_top.png

now is this correct should i just leave the pin 4 or should i connect it to ground since i want 0V when -ve is more?

and thanks for the replies i am really learning thanks to you guys!

#### Audioguru

Joined Dec 20, 2007
11,249
An old 741 opamp is very slow and is designed to use a 30V supply. Many 741 opamps do not work if the supply is less than 10V but your supply is only 5V.

The output of a 741 goes as low as 1.5V, not 0V like a comparator. Its output goes as high as 1.5V less than its positive supply voltage while the output of a comparator goes to the positive supply voltage (5V in your circuit). Its input voltages must be far above ground and far below its positive supply voltage.

#### indianhits

Joined Jul 25, 2009
86
oh i get it.i didn't carefully look at the LM339 figure i though there would be -ve supply too.sorry my bad i though there will be a -ve supply pin(like pin 4 in 741) sorry!.

#### indianhits

Joined Jul 25, 2009
86
how do i set my IR led so that the IR light emits within the range of not more than 5CM.

is it(distance of IR emitted) directly proportional to current?

#### Audioguru

Joined Dec 20, 2007
11,249
The distance of an IR transmission also depends a lot on the sensitivity of the receiver circuit.

#### indianhits

Joined Jul 25, 2009
86
will this circuit work for 5V,200mA

@MR.AudioGuru i am trying to use this with in the range of 5CM maximum so i guess "sensitivity of the receiver circuit" will not be much problem even if i use photodiode right?

#### Audioguru

Joined Dec 20, 2007
11,249
But like I said earlier about this extremely simple IR receiver circuit, it WILL NOT WORK since its (+) input pin has no DC bias voltage.
it also won't work because its output does not have a pullup resistor.
It also might not work because it does not have hysteresis.

#### marshallf3

Joined Jul 26, 2010
2,358
Why don't you just take the receiver diode and hook it up in the photovoltaic mode such that it produces voltage on its own?

#### Jaguarjoe

Joined Apr 7, 2010
767
how do i set my IR led so that the IR light emits within the range of not more than 5CM.
That depends upon how good your eyes are too. You will not be able to limit an LED's output to 5cm, it doesn't work that way. You can set your IR LED and detector together as a pair to operate at a certain range. You'll want to PWM the LED to effectively dim it.