2
\$\begingroup\$

I want to detect an IR pulse with a phototransistor. I did the following schematic, using the voltage comparator LM339:

schematic

The problem is that this will work if in the dark, but if there is some light, the OUT LED will be ON anyway. What I want is a way to automatically subtract the "constant" ambient light, and have the OUT LED ON just during a pulse of light to the phototransistor.

Thanks a lot in advance for your help.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Even "constant" ambient light may have pulsating components: LEDs, some fluorescents, especially when driven from 60(50) Hz. Do you intend to accept these pulses too, or expect to detect your IR pulser in this environment? \$\endgroup\$
    – glen_geek
    Commented Oct 25, 2019 at 2:10
  • 3
    \$\begingroup\$ You mention phototransistor in text but draws a photodiode in the schematics. These are two different types of devices with different characteristics. \$\endgroup\$
    – joribama
    Commented Oct 25, 2019 at 5:01

4 Answers 4

4
\$\begingroup\$

The secret of successful IR transmissions in ambient light conditions, with it's combined many mixed frequencies, is modulation. The transmit source produces an on/off carrier frequency and then "information" is introduced on this carrier by switching the carrier itself on and off at some lower frequency with a recognizable pattern.

The receiver uses a band pass filter tuned to the transmitter carrier frequency that is then able to recognize the "information" modulation and output a waveform that represents that information.

The whole concept is very similar to how a radio channel can work despite the fact that the ether is full of thousands of radio signals.

The IR transmission scheme I describe is exactly the same as common TV remotes work. You could use an old TV remote as your IR source and then get an IR receiver module that has all the receiver logic built into a single chip. Check out something like a TSOP1738 and other similar devices.

\$\endgroup\$
2
  • \$\begingroup\$ very good explanation \$\endgroup\$
    – joribama
    Commented Oct 25, 2019 at 5:04
  • \$\begingroup\$ Optics can be a very, very important pre-condition part, as well. It's better, where possible, to eliminate anything getting into the first stage. Optical baffles, louvers, telescoping, polarization selection, thin film filtering, and if you really want to go insane about it, fourier plane optical filtering with multiple transmitter LEDs at regular spaced 2D intervals. Just a note. (Mostly, it's not required to go quite that crazy. But there have been situations.....) Anything you use that can narrow things down prior to the first electronic stage is to the good. \$\endgroup\$
    – jonk
    Commented Oct 25, 2019 at 6:25
3
\$\begingroup\$

The LM339 is a comparator that has a somewhat unique characteristic: it uses a PNP input stage that has nearly constant 25nA bias current. This design idea takes advantage of LM339 bias current to generate a DC offset via R1. Have never tried this idea before...its a design-by-specsheet.

R1=470k gives an offset voltage of about 10mV. This offset is about twice the inherent +/- 5mV offset of the comparator itself. That's not much noise immunity, but may be sufficient. You can increase offset by raising R1 value - sensitivity to light pulses will be poorer. This circuit may be prone to oscillation with a poor layout (I'd expect trouble on a breadboard).
C1 can be changed to accept pulses of different durations. C1=500pf is about appropriate for IR pulses of 50 microseconds. A really sensitive phototransistor may saturate in daylight and not detect light pulses...if so, R4 must be reduced in value.
Note that comparator output idles at logic "high", and pulses to logic "low" when the photo-transistor sees a pulse.

schematic

simulate this circuit – Schematic created using CircuitLab


Edit:
Another simpler version. R1 again creates about 10mV offset by means of LM339 input current. C1 (below) creates an average reference voltage proportional to ambient light hitting the phototransistor.

An RC filter (C2,R5) is added to the DC supply voltage in an effort to keep supply noise from triggering an output.
A pulse of light pulls the comparator output down from +5V to ground. The RC time-constant (R1*C1) determines sensitivity to ambient light changes. Decrease R4 to decrease sensitivity to light pulses:

schematic

simulate this circuit

\$\endgroup\$
2
  • \$\begingroup\$ Thanks a lot, this is exactely the kind of circuit I was searching for. However I find it a bit too sensive, especially for small voltage changes in the +5V alimentation.. Another question I have is how can I compute the values of resistors and condensators to change the phototransistor sensivity ? For instance what are the formula that relates R1 with the offset detection in mV and C1 with pulse duration ? \$\endgroup\$ Commented Nov 29, 2019 at 13:08
  • \$\begingroup\$ You could increase R1 to create a larger threshold voltage than 10mV, but I wouldn't recommend that. Decreasing R4 gives less sensitivity. Noise on the +5V supply (along with noise on ground-line) is often a problem. C3 is hopefully a noise filter. Wire lengths and wire paths can change noise sensitivity. Try to use single-point grounds, near comparator gnd pin 12. Add C3 close to LM339 pin 3,12. Single-point connect R4, C3, R2 close to pin 3. A low-pass filter might help attenuate noise on the +5V supply. (An alternate, simpler version added to answer). \$\endgroup\$
    – glen_geek
    Commented Nov 29, 2019 at 16:21
2
\$\begingroup\$

AC couple the phototransistor with a series cap. This won't work for DC (aka long IR pulse), obviously.

Or phototransisor anti-parallel to the current one pointed away from the IR. Or use it on the comparator inverting input so the reference voltage rises with ambient light. It needs to match and track the first phototransistor though which may not be workable.

You could also get use a visible blind phototransistor instead. It will look opaque black.

\$\endgroup\$
0
\$\begingroup\$

try this

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.