detecting two rising edges from camshaft signal

TomGeorge:
Hi,
OPs image;
2cb1f7f78351bf963745dcdc1ab490ff7a6cf42f.png
What is the yellow signal
How many cylinder diesel?
2 stroke or 4 stroke?

So the start of, or the end of, the double pulses indicates Cylinder 1, TopDeadCentre?
If the engine is 4 cylinder then from your blue trace the last of the pair will represent No1 Cyl TDC.
What is the amplitude of the pulses?

Your biggest problem is the fact that the pulse width and intervals will not be constant , but change with speed.

Tom... :slight_smile:

The yellow signal is the output (if the double pulse is detected i set a pin).
It is a 4 stroke 4 cylinder engine (cylinder one has 2 teeth of the camshaft disk and 2,3 and 4 have only one tooth). Based on that if the system detects a double pulse, I know that the cylinder1 is in compression stroke.
Yes you got the point TomGeorge, it is related to the speed of the engine. But for now I based my program on one speed.