IR Light Transmission Delay Error
simulate this circuit &ndash; Schematic created using CircuitLab

 The receiving photodiode equivalent circuit in OP's 'scope photo is the one on the left. I'm assuming a direct connection to the standard oscilloscope input that is typically 1Meg resistor in parallel with about 25 pf capacitance. The oscilloscope probe cable adds approximately 100pf.
The diode itself adds another capacitance (estimated at 30pf).
Photocurrents must charge these parallel capacitances when it sees light. This slows the leading edge of a "pulse".
When light is turned off, these capacitances must discharge somehow. In this case, the discharge path is through the 1M 'scope resistance. That's a slow RC time-constant type discharge on the trailing pulse edge.

The cheap way to speed this circuit's time response reduces the RC time-constant by adding a parallel resistance (right circuit). Now photo-currents must charge the diode's self-capacitance. Discharge speed is improved because the RC time constant is shorter.
However, by adding R2 (10k) voltages produced by photocurrents into R2 are much smaller. There's a tradeoff here: speed or sensitivity? A result of gain-bandwidth product.

An even speedier solution reverse-biases the diode with a DC voltage. This reduces its self-capacitance substantially. More complexity. You'll only notice the speed improvement if other capacitance (like 'scope, cable) have been minimized.

A trans-impedance amplifier is faster still: photodiode currents are applied to the opamp's feedback resistor, instead of charging or discharging capacitances. Capacitor C1 (5pf) is added to control the transient edge: without it, the edges will "ring", and sometimes the circuit may oscillate. The value of C1 depends on circuit layout, and the opamp characteristics, and the value chosen for R1. A proper photodiode (rather than an LED) will likely have smaller self-capacitance, allowing a faster time response. LEDs are large-area and have substantial self-capacitance.






simulate this circuit