The following circuit consists of two IR (Infra-Red) LED diodes; one as light transmitter (IR1) and other as light receiver (IR2). They are spaced for approximately 4 cm, so distance is not the issue here. The issue is that when square wave is applied to transmitting diode, the receiving one does not completely "replicate" the transmitted signal. Applied square wave on transmitting diode results in distorted square wave at receiving diode with significant fall time. Fall time increases as frequency of transmission is increased.
Measured signal on receiver diode versus signal on transmitter diode:
In both pictures, ideally square signal is applied signal to IR1 from function generator. Other signal, with noticeable fall time slope is measured signal at IR2. The left picture shows measurements taken at 1 kHz square signal and the right picture shows measurements taken at 10 kHz.
Main problem here is that this circuit is a part of triggering circuit. IR2 is then connected to comparator. This means that if IR2's slope changes with frequency then output of comparator is square signal, which ON-state length changes with frequency. But if received signal would be approximately replicated from the transmitted signal (not in amplitude but in shape of signal's waveform), then I wouldn't be seeing such behavior at the output of comparator.
NOTE: I also tried to replace receiving diode with IR optocoupler TSOP32230, which is meant to be used as optical communication receiver devices that operates at much higher frequencies. Its output was very low in amplitude (OFF-state = 50 mV, ON-state = 80 mV) but received signal's waveform was completely identical to transmitted one. This optocoupler's datasheet indicates that output should be much greater in amplitude, however my measurements gave different results. The problem here would be that if such optocoupler would be used as triggering device for my circuit, then comparator would need very stable reference voltage, which would be somewhere between 50 mV and 80 mV to properly trigger the rest of the circuit. However, I don't have the knowledge to design such stable reference voltage source. It would be much easier for me, if optocoupler would generate square signal, whose OFF-ON difference would be much higher than only 30 mV.
Any ideas how to proceed? Can IR diode's fall time be compensated somehow? Or could something else be done about optocouler?