# De-bounce circuit?

I have a laser sensor that randomly triggers on sunlight.

The signal is fed to an opti-coupler to a FTDI chip.

I am looking for advice for the easiest solution to take out these false positives which can be up to 250 ms.

The problem appears to be the opto-coupler which is switching at less than 1 V DC and simple resistor / capacitor circuits take to long to discharge. :(

I'm guessing it's going to be some sort of logic circuit.

Any guidance given would be appreciated.

Edit Currently under the winter sun where - worst case is 250ms / Second

• Can you add an optical filter to the sensor? Nov 2, 2018 at 16:12
• You might want to describe the wanted signal to be able to distinguish it. Certain sensors work around the problem by modulating the light. Nov 2, 2018 at 16:14
• Why not just use a low-pass filter + comparator? Nov 2, 2018 at 16:15
• No! We've been there, tried all sorts of filters and shading. Basically the frequency of the laser operates at a range of sunlight. When the sun emits a solar flare and when we get "the glint of sun light" at the frequency of the laser, it trips it. Filter it out and the laser doesn't work :) - we made the same mistake :) Nov 2, 2018 at 16:18
• How long is an actual pulse ? If the actual pulse is longer than the glitch, measure the time of the pulse rather than look only at it one edge? Nov 2, 2018 at 16:22

You can solve this with two op-amps.

The first is configured as an integrator. Its output rails low most of the time. When a high signal is present, it starts ramping up linearly.

The second op amp is configured as a comparator. Once the output of the integrator reaches a specified voltage, the comparator triggers.

For a short pulse, the integrator begins ramping up, but doesn't reach the comparator threshold before the input goes low again and the integrator starts ramping back down.

By adjusting the integrator gain and comparator threshold, this circuit gives you fine control over the minimum pulse width required to trigger. You should have enough precision to, say, trigger after 300mS, but ignore a 250mS pulse. You didn't state how long the "desired" signal pulses are expected to be.

However, be aware that multiple short pulses may trigger the comparator if the integrator doesn't have time to fully return to zero before the next pulse hits. If this is a concern, please add a comment and I'll discuss some ideas to solve it.

• Thanks Selvek - just those two words "integrator" "comparator" have opened up a Pandoras box. will spend the weekend chasing Google Nov 2, 2018 at 16:34
• Haha have fun! I wasn't sure what your electronics background was - let us know if you get stuck somewhere! Nov 2, 2018 at 16:54