
The circuit in Fig 1 performs input protection, level translation, isolation, and debouncing. The circuit allowed the output of a relay driver to connect to a computer even though the relay driver delivered a voltage as high as 24V and the relay driver had no ground connection.
With the values in Fig 1 the low and high thresholds at the circuit's input were approximately 8 and 16V, respectively. The cutoff frequency was high enough to allow counting 1200 counts/min. The input withstood 110V ac continuouslythe optoisolater's withstand voltage is 3 kV.
I tested the debouncing function with a microswitch in series with a 24V-dc power supply and the relay driver. I detected no switch bounce.
You can change capacitor C1 to suit other applications' cutoff frequencies. Altering the resistors may be tricky because you will affect the circuit's low- and high-threshold levels. To use inputs other than 24V, change R1. (DI #1425)