How does one read the sine wave created by a variable reluctance sensor?

32 Views Asked by At

One has access to an Rpm sensor (variable reluctance time). This sensor creates voltage pulses, which build up and later rise down many times a second. I need to read the tops of these pulses and the time in between or how many happen in a certain timespan to calculate rpm.

One prefers using a microcontroller, like Arduino or Raspberry Pi Pico in combination with any other hardware required. Having used interrupts reading falling and rising edges, however, it was not successful. Kindly help with a solution.

1

There are 1 best solutions below

0
emiled On

The interrupt method you are using is based on threshold detection. When your signal rises above a given level, the pin interprets it as a 'high' level and generates an interrupt. If your signal is noisy, it might cross that level multiple times. When this happens, you cannot calculate the frequency reliably.

For this method to work, you have to debounce this threshold detection, as you would debounce a push button. A simple aproach would be to

  • disable the pin interrupt on a rising edge
  • start a timer elapsing after x ms, x being your debounce time.
  • when the timer elapses, increment a counter and enable the pin interrupt again.

To compute the frequency, start the previously described procedure and let it run for y seconds, then stop the procedure. Your frequency will be x / y Hz, or 60 * x / y rpm.