I would like to use an IR transmitter/receiver pair to detect when an object obstructs (or does not obstruct) the path between the the transmitter and receiver and illuminate an LED when the path is not obstructed. Initially, using an input for each of the IR receivers and and output for each corresponding LED would work, but IO would quickly limit the size of the project. Ideally, all (or almost all) of the IO would be configured for input to detect the state (high/low) of the LED circuit.

I was thinking about using the IR receiver to open/close the gate on a MOSFET that then powers the LED and measure the voltage on the drain side of the MOSFET via the microcontroller input.

However, the data sheet for the IR receiver suggests a PWM signal output from the received signal. (https://www.adafruit.com/product/157)

Would this signal cause issues with keeping the gate open/closed, or is the pulse width small enough that the gate would remain open/closed? If not, would there be a simple circuit/device that would solve the issue? Or maybe there is an "IR signal detector switch" that I am unaware of.


  • \$\begingroup\$ Terminology correction: You use an IR receiver to control/drive the gate of a MOSFET. The MOSFET itself (technically the source-drain pair) opens and closes. The gate does not open or close in the same way that your door knob does not open or close. It is the door that opens or closes. \$\endgroup\$
    – DKNguyen
    Oct 14 '19 at 20:07

Don't use that IR receiver. It was meant for serial communications and therefore has application specific circuitry integrated into it which will limit it's broad applicability.

Use a phototransistor or photodiode instead. These components are the fundamental optical receivers in electronics and all IR receivers and anything similar contain either one or the other.

Phototransistors have more gain (i.e. higher signal output), but have more noise relative to that output level and are slower.

Photodiodes are faster, more linear, and have a lower signal output but lower noise relative to that output signal level.

This means phototransistors natively produce a more usable signal level and are therefore easier to use since they require fewer additional components, as little as a resistor sometimes. They are more suited for "common" digital tasks which a low speed interruptor falls into.

Photodiodes usually requires an transimpedance amplifier, usually in the form of an op-amp, to get working. But properly built, they will ultimately outstrip a phototransistor circuit in all performance aspects. They are best for analog measurement, high speed applications, or low noise applications.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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