rotary encoders

I have a shaft for which I will need to control the rotation speed between 1 and 2 RPM. The specific speed will be determined prior to the start of the cycle. The shaft will only turn roughly 130 degrees total travel. I plan on using an incremental rotary encoder to keep track of position and some control logic to provide updated power setpoints to the motor control circuit. The shaft will be driven through a ~6:1 gear set up to provide the required torque. My though is that I will need a relatively high resolution encoder to achieve the desired feedback and control. Most of the units i can find for hobbiest have resolution of ~24 / rev. I have found a unit here E6A2-C Incremental 25-mm-dia. Rotary Encoder/Specifications | OMRON Industrial Automation that can be specked up to 500/rev. However there seem to be some options that have 3? outputs A, B, and Z. The question that I have is does this provide any additional information and if so what.

I have also learned that there exist absolute rotary encoders does anyone have any knowledge of how these work or if they can be easily interfaced with an arduino?

Z is the zero index mark and usually gives one short pulse per revolution of the encoder shaft.
You can buy shaft encoders with a wide range of resolutions, including 10,000 increments per revolution or more.

The details of connecting an absolute angular position encoder to an Arduino will depend on the encoder, but some have parallel outputs that require 8, 10 or more I/O pins.

Can you put the sensor before the 6:1 downgearing? That automatically gives you 6x the resolution.

Thanks I thought that was what the Z pin was for but was not sure.

I think that sticking with an incremental will make the most sense for me as I am not an electrical engineer and am very very new to this entire area.

My idea is to have a main loop that

  • checks the state of other sensors in the setup

  • displays/records/prints the current data

  • if the time since last motor control adjustment is greater than X I am thinking ~0.5 sec also do the following

  • compute RPM from the #number of increments and time since last check

  • adjust motor power if required

I will assign interrupts for output A and B to keep track of increments from the encoder.

I think the trick, given the low RPM, will be to adjust the time between power adjustments to the motor to small enough to have relatively smooth control but large enough to get a good average speed. The more "ticks" on the encoder the better I think. But if the interrupts are too frequent I am worried about doing nothing but counting state changes on the encoder?

As I noted I am totally new to this and this is the FIRST arduino project I have done. So any input is welcome.

Can you put the sensor before the 6:1 downgearing? That automatically gives you 6x the resolution.<<

Yes that is something I am considering. There are some mechanical limitations, but I should be able to do it. Given the low RPM and the fact that I want to "continually" adjust motor power to control speed over a relatively short rotation any suggestions how many "clicks" per rotation I should use.

At one RPM 15 deg is ~2.5 sec. So to get a good number to calculate speed do I need 1 click per degree or 10 or 100. I think more is better for resolution and stability but cost goes up quick. Use the 360/rev on a 6:1 would give me 6 clicks per degree. Does that start to make sense?

Mostly thinking out loud here so any comments welcome.

My experience has been that even if the rotational velocity is constant, encoders all show some variation in the timing of increments, with less expensive or coarser ones showing more variation. So, to calculate the shaft rotational speed with reasonable accuracy you will probably need to measure the time for several increments and average. Do the experiment and tell us what you find!

Optical encoders, then?

with less expensive or coarser ones showing more variation. So, to calculate the shaft rotational speed with reasonable accuracy you will probably need to measure the time for several increments and average<<

same thing as taking a longer time between adjustments??? Longer time at constant velocity = more signals to average over.

Do the experiment and tell us what you find!<<

Ok but it is going to take me some time.

optical encoder<

not sure why or if this helps. They are also available in various resolutions. Am I missing something.

The encoders I use are all optical.

Another approach to reduce errors in determining the rotational velocity is to time each encoder increment and then use a smoothed average of several measurements, or a low pass filter. Search the forum for "low pass filter" for lots of discussion on how to do this.

Optical encoders have less positional inaccuracy when transitioning than mechanical rotary encoders.