For a while now I've been trying to come up with a simple module to handle modulated light detection for part of a laser trip sensor. Initial attempts I wanted to use a dual op-amp as an RC Oscillator and a comparator but could never get the circuit to work. Now while reading up on logic gates and flip flops I thought I could use those to accomplish the same this. Initially I thought it would use two JK flip flops and several logic gates but ended up finding something far more simple.
Can I use nothing more than a D flip-flop to detect if the pulse I'm receiving is that same as the one emitted? Here is the circuit simulated in CircuitJS. A little bit of hand waving is required do to simplification and shortcomings in the sim but assume that
clk is the
PWM being fed into a
MOSFET powering the laser diode and the switch represents a phototransitor either receiving the laser light while closed or the beam being broken when opened. The inverter is to trigger an interrupt on break.