Rotary encoder for using tachometer(RPM meter)

dear All ,
I have a rotary encoder,
can the rotary encoder be used as an RPM meter, my hope is to be able to know the number of revolutions to the left or right in the form of RPM which shows the number minus if the rotation to the left and plus if the right rotation.
thanks before

Usually that can be made. It depends how fast your object is rotating and what resolution the rotary encoder has. A rotary encoder with a resolution of 400 steps per rotation measuring a motor with 100'000 rpms won't work. As you failed to provide a link to the hardware you're using (the rotary encoder) and also didn't specify the RPM range we're talking about, we cannot give any further help.

Here are a couple of sketch examples I've used to handle tachometer control with an encoder (400 pulses per revolution)


Z

Tachometer_with_encoder_code_simple_with_notes.ino (2.95 KB)

Tachometer_Final_Auto_Duration_and_Stall_Recovery.ino (5.12 KB)

Irvanmustofs55:
I have a rotary encoder,
can the rotary encoder be used as an RPM meter, my hope is to be able to know the number of revolutions to the left or right in the form of RPM which shows the number minus if the rotation to the left and plus if the right rotation.

As with many things, encoders come in a vast variety of types, etc. One like that pictured in post #2 will probably last a long time reading RPM.

Ones like this, for human-driven front panel use, not so much. You could use it to prove the theory and get some code running but it's not made for high, continuous turning rates.

pylon:
Usually that can be made. It depends how fast your object is rotating and what resolution the rotary encoder has. A rotary encoder with a resolution of 400 steps per rotation measuring a motor with 100'000 rpms won't work. As you failed to provide a link to the hardware you're using (the rotary encoder) and also didn't specify the RPM range we're talking about, we cannot give any further help.

here i try with proximity sensor that

zhomeslice:
Here are a couple of sketch examples I've used to handle tachometer control with an encoder (400 pulses per revolution)


Z

thank you for sharing knowledge,
here I am trying with a proximity sensor instead of the encoder,
I tried it based on references from the website

http://www.hobbytronics.co.uk/arduino-tutorial6-rotary-encoder

from this source the pulse signal is generated if each time the A signal pulse changes from positive to zero, we read the value of pulse B. We see that when the encoder is rotated clockwise, pulse B is always positive. When the encoder is rotated counterclockwise, pulse B is negative. By testing both outputs with a microcontroller we can determine the direction of rotation and by counting the number of pulses A to what extent it has changed.

Is this working pattern the same as the one you made?

Origional question:

can the rotary encoder be used as an RPM meter

Yes, it can. The code I provided earlier does that. The code you provide is for the encoder part.

A Tachometer only needs one pulse source from the Data OR Clock pin of the encoder. The code you provided below is for an Encoder.
My Tachometer code provided doesn't check both Data and Clock pins and so it doesn't need to check direction just the rate of rotation.

Irvanmustofs55:
here i try with proximity sensor that
thank you for sharing knowledge,
here I am trying with a proximity sensor instead of the encoder,
I tried it based on references from the website

http://www.hobbytronics.co.uk/arduino-tutorial6-rotary-encoder

from this source the pulse signal is generated if each time the A signal pulse changes from positive to zero, we read the value of pulse B. We see that when the encoder is rotated clockwise, pulse B is always positive. When the encoder is rotated counterclockwise, pulse B is negative. By testing both outputs with a microcontroller we can determine the direction of rotation and by counting the number of pulses A to what extent it has changed.

Is this working pattern the same as the one you made?

The Tachometer only needs to know the time between pulses and the number of pulses per revolution. It doesn't need to determine what state the other pin is in.

I am not sure what you are looking for. an Encoder or a Tachometer or both.

Z