LM358 IR Sensor Circuit Guide with Schematic and Wiring Steps

For reliable proximity or motion detection, use the dual operational amplifier IC in an inverting configuration with a photodiode or IR emitter-receiver pair. Set the reference voltage at half the supply range–typically 2.5V for a 5V input–to maximize sensitivity. Connect the inverting input to the photodiode’s anode via a 10kΩ resistor, while the non-inverting input ties to the reference node. Include a 10nF decoupling capacitor between the IC’s power pins to suppress noise.

Adjust detection range by modifying the feedback resistor. A 100kΩ resistor yields a 10cm range, while 1MΩ extends it to 50cm but reduces response speed. For active IR setups, pair the photodiode with an 880nm LED driven at 20mA through a 220Ω current-limiting resistor. Use a Schottky diode across the LED to clamp inductive kickback if switching with a transistor.

Calibrate thresholds by measuring output voltage in ambient light and full IR exposure. Subtract 20% from the ambient reading to define the trigger point. Add a 100nF capacitor at the output to filter false triggers from flickering sources like incandescent bulbs. For microcontroller interfacing, connect the output directly to an ADC pin–no additional conditioning needed if supply voltages match.

Power the module from a stable 5V regulator to avoid drift. For battery operation, a 3.3V lithium cell works with a resistor divider to lower the reference voltage proportionally. Test the assembly under actual target conditions–surface reflectance alters readings by up to 30%. Mount the photodiode at a 45° angle for optimal directional sensitivity.

Building an Active Infrared Detector with the Dual Op-Amp IC

Start by pairing the photodiode with a 220Ω series resistor to limit reverse voltage overshoot when pulsed emitters strike the junction. The dual op-amp IC’s first stage should amplify the photodiode current with a 10 kΩ feedback resistor for a gain of ~45 dB, allowing reliable detection of 38 kHz modulated signals from distances up to 1.2 m.

Keep the emitter side simple: drive an IR LED at 100 mA with a BC547 transistor and a 47 Ω current-limiter. Place a 100 nF decoupling capacitor directly between the IC’s V+ pin and ground; skip this and stray 50 Hz flicker from fluorescent fixtures swamps the tiny photodiode signal.

  • Emitter IR LED peak wavelength: 940 nm
  • Modulation frequency: 38 kHz ± 2 kHz
  • Op-amp IC input offset voltage: ±2 mV (max)
  • Recommended supply: 5 V regulated

Route the amplified pulse train into the second op-amp stage configured as a comparator. Tie the inverting input to a 1.5 V reference (set by a simple voltage divider–10 kΩ and 30 kΩ resistors on a 5 V rail) and the non-inverting input to the amplified photodiode signal. Hysteresis isn’t strictly needed if ambient light is stable, but a 1 MΩ feedback resistor prevents chatter when the beam is broken.

If false triggers persist, solder a 1 µF electrolytic capacitor across the IC’s power pins. Check the waveform on a scope; clean 38 kHz bursts should appear as crisp 4 Vpp spikes. Anything below 3 Vpp suggests the IR emitter isn’t bright enough–swap the LED or reduce distance.

For battery-powered units, add a 10 kΩ pull-down on the final output to ensure the microcontroller sees a clean 0 V logic low when the path is uninterrupted. Mount the photodiode and emitter LEDs at right angles to minimize cross-talk; 5 mm spacing is enough for most hobbyist enclosures.

Key Parts for Building an IR Detection Module with Dual Operational Amplifier

Choose a precision dual op-amp in an 8-pin DIP package. Its ability to operate on a single 5 V supply and low input offset voltage (±2 mV) minimizes calibration needs. Look for variants with a bandwidth of at least 1 MHz if pulse modulation above 100 kHz is required.

Infrared emitters should match the spectral sensitivity of the detector. GaAs IR LEDs with a wavelength of 940 nm are ideal for daylight use, as ambient sunlight peaks around 550 nm, reducing interference. Forward current ratings between 20–50 mA ensure sufficient illumination without thermal drift. Mount emitters 2–5 mm apart to create an overlapping field, improving resolution at short distances (≤ 30 cm).

Passive Component Specifications

Component Role Value/Part Number Tolerance Power Rating
Current-limiting resistor (emitter) Limits LED forward current 100 Ω–330 Ω ±5% ¼ W
Feedback resistor (comparator) Sets gain and hysteresis 47 kΩ–220 kΩ ±1% ⅛ W
Bypass capacitor Decouples supply noise 0.1 µF ceramic X7R ≥16 V
Load resistor (photodiode) Converts photocurrent to voltage 10 kΩ–1 MΩ ±1% ⅛ W

Photodiodes must have a fast response time (

Select fixed resistors with metal film construction for stability. Carbon composition types drift with temperature and humidity, introducing false triggers. Capacitors should use NP0/C0G dielectric for timing applications if oscillators are part of the design. Voltage dividers used for threshold setting benefit from resistors with matched temperature coefficients (≤50 ppm/°C).

Mechanical and Ancillary Items

Shielding reduces ambient light interference. Use black acrylic tubes (internal diameter 4–6 mm) around emitters and detectors to collimate beams. Optical filters with a 920–960 nm bandpass further suppress sunlight. For moving applications, mount components on flexible phenolic strips to prevent vibration-induced misalignment.

Voltage regulators like the 78L05 provide a stable 5 V supply if battery voltage exceeds 5.5 V. Include a Schottky diode (e.g., 1N5817) in series to prevent reverse polarity damage. Power traces on prototype boards should be ≥1 mm wide for currents above 10 mA to avoid voltage drops. Solder connections with lead-free alloy to mitigate whisker growth in high-humidity environments.

Step-by-Step Wiring of a Dual Op-Amp with Infrared Components

Connect the infrared LED’s anode to a 220Ω resistor, then wire the resistor’s free end to a 5V power supply. Ground the LED’s cathode directly. This ensures a stable current flow without overheating the emitter. For pulsed operation, add a 1kΩ potentiometer between the resistor and supply to fine-tune intensity.

Link the photodiode’s cathode to the non-inverting input (pin 3) of the first amplifier section, attaching its anode to ground. Feed the inverting input (pin 2) with a reference voltage–use a voltage divider (two 10kΩ resistors) between 5V and ground, tapping the midpoint. This configuration maximizes sensitivity to reflected IR signals.

Bridge the amplifier’s output (pin 1) to its inverting input (pin 2) via a 100kΩ feedback resistor. This creates a comparator mode, sharply switching the output when the photodiode’s voltage crosses the reference threshold. Add a 0.1µF decoupling capacitor between the dual op-amp’s power pins (4 and 8) to suppress noise from fluctuating IR sources.

Solder a 10kΩ pull-down resistor between the amplifier’s output (pin 1) and ground to prevent floating voltages when no signal is present. Route the final output to a microcontroller’s digital pin, ensuring voltages match–use a voltage divider if the MCU tolerates only 3.3V logic. Test the setup with a multimeter; probe pin 1 for binary high/low transitions as objects obstruct the IR path.

For adjustable detection range, replace the fixed 100kΩ feedback resistor with a 1MΩ potentiometer. Rotate to increase gain for long-distance sensing or decrease it to filter ambient IR noise. Calibrate by placing a reflective surface at the desired limit and adjusting until the output toggles reliably.

Calibrating the Dual-Channel Amplifier for Precise Infrared Signal Reading

Begin by setting the input offset voltage to minimize baseline drift. Apply a 10 mV differential signal at the non-inverting terminal while grounding the inverting input through a 10 kΩ resistor. Adjust a 10 kΩ trimpot connected between the offset null pins (if available) until the output swings no more than ±5 mV from zero without any IR emitter active. This step eliminates amplifier bias errors before introducing modulated signals.

Use a regulated 5 V supply to power the IR LED at 20 mA forward current; verify with a 1 Ω sense resistor in series, ensuring the voltage drop remains between 18–22 mV. Position the photodiode 2 cm from the emitter to create a stable reference beam. Connect the photodiode cathode to a –5 V rail via a 220 kΩ load resistor, leaving the anode at ground–this reverse-bias configuration maximizes responsivity to 940 nm wavelengths.

Amplify the photodiode signal with a non-inverting gain stage. Place a 100 kΩ feedback resistor between the amplifier’s output and its inverting input, coupling the photodiode output to the non-inverting terminal through a 10 μF coupling capacitor. Expect a 0.7–1.2 V swing at the amplifier’s output when the emitter pulses at 38 kHz; any deviation requires trim of the 100 kΩ resistor to match expected amplitude.

Insert a 1 nF ceramic capacitor across the 100 kΩ resistor to roll off frequencies above 30 kHz, reducing noise pickup from fluorescent lighting or switching regulators. Test interference immunity by sweeping a 50–60 Hz AC source 10 cm from the photodiode–output ripple must stay below 20 mV peak-to-peak. If exceeded, increase capacitor value incrementally in 0.1 nF steps until ripple compliance.

Verify dynamic range by obstructing the IR path with calibrated neutral-density filters. Start with 0% obstruction (full signal), then insert filters cutting irradiance to 25%, 50%, and 75%. Plot the amplifier output voltage against filter transmittance; linearity error must not exceed ±3%. Non-linearities indicate photodiode saturation–reduce the load resistor to 150 kΩ or less until response scales proportionally.

Compensate ambient light by toggling the IR emitter at 1 kHz and measuring DC output levels both on and off. Subtract the ambient level from the emitted light reading to isolate the modulated signal. Ensure this differential remains stable ±2% across room illumination changes; if not, shield the photodiode with a 940 nm bandpass filter or reposition the assembly to avoid direct sunlight.

Finalize calibration by pulsing the emitter at 38 kHz with 50% duty cycle. Confirm the amplifier output produces a clean 3.3 V peak square wave, free of overshoot or ringing. If waveform integrity falters, reduce the feedback resistor to 68 kΩ and re-check; excessive bandwidth causes instability, requiring either resistor value decrease or additional 5 pF compensation capacitor across the feedback resistor.