Simultaneously Reading Two Analog Inputs with Arduino

AbdulMoizFarooq:
Yes, the gap is same for all the rotations. Thank you. But another problem arrives:

Yes, I do have an encoder... incremental rotary encoder attached to a plate with 32 teeth (per rotation, i.e every 11.25 degrees)

The problem then still arrives... how to sync the encoder with the piezo sensor correctly, without any lag?? In my case, there is a lag, which keeps on increasing every rotation so the values are not perfectly synced...

You need to have a sync sensor on the encoder, so you have a clock and sync signal.

Each time the sync point is detected, once every revolution, you start the clock counter at 0.

You need to know the exact location of the spindle as it measures, 32 teeth which gives 64 clock pulses would be good.
64 because you use rising edge as one clock pulse and falling as another.

What is the rotational speed?
Just a suggestion...
Tom... :slight_smile: