My clock bodges an Arduino collision detector module. It's a comparator rather than a Schmitt Trigger, so interesting to compare how the two misbehave when ambient light changes.
I used a comparator rather than a Schmitt Trigger for a non-technical reason – Arduino modules are widely available and cheap! Of the two, I'd expect a Schmitt Trigger to do a better job.
A comparator compares a signal voltage to a reference voltage set by the user. When the signal is lower than the reference voltage, the comparator outputs zero volts. When the signal is greater than the reference, the comparator flips and outputs 5V. A disadvantage is the circuit is sensitive to noise, and I had considerable trouble with it early on. Ambient light puts an unwanted voltage on the signal. In consequence, strong sunshine triggers the comparator whatever the pendulum is doing whilst, lesser brightness alters the effective sensitivity of the trigger, causing false triggering. Enclosing the pendulum revealed my sensor was also sensitive to legitimate IR from the sender bouncing off the moving pendulum, the shiny Aluminium structure, and the shiny white PVC case.
A Schmitt trigger is also a comparator circuit, but uses positive feedback to the signal to flip the output. Not only is detection faster, but the circuit provides hysteresis. As with a comparator, the circuit triggers when the signal rises above a certain level, but hysteresis keep it triggered until the signal drops below a second, lower, trigger level. Hysteresis makes the Schmitt trigger less vulnerable to jitter, which is always present in beam break applications. John's description of how his Schmitt Trigger reacts to ambient light is valuable to me, because replacing my comparator with one is an obvious upgrade to my clock.
Good news is the cure appears to be identical: shielding! I appear to have tamed my sensor by mounting the IR sender and receivers inside slotted tubes, lightproof at the rear. The slots narrow the beam considerably, making it harder for ambient light and reflections to cause trouble.
One advantage of the Arduino comparator module is that the IR sensor and sender can both be unsoldered and rewired elsewhere to cover largish gaps. In contrast, many Schmitt trigger modules encase the sensor and sender within a limited gap: no problem when used to measure rpm, but a bit awkward for my design.
I haven't proved yet that my comparator isn't good enough, but it's a strong possibility. John's observations are valuable because it's likely that I'll swap it for a Schmitt Trigger later.
Dave