Author Topic: Rotary encoder accuracy - mine doesn't seem very good  (Read 2984 times)

0 Members and 1 Guest are viewing this topic.

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Rotary encoder accuracy - mine doesn't seem very good
« on: March 06, 2019, 06:56:31 am »
I picked up one of those cheap Chinese incremental rotary encoders from Amazon to use for measuring linear speed... I'm timing the gap between pulses to come up with a speed reading.  I am seeing a variance of 15%, even when I turn the encoder at a very precise rate.  I've attached a wheel to the encoder and mounted it to the table of my (pro, not hobbyist) CNC machine, and hooked up the encoder output to my oscilloscope and I see a variance of +/- 15% in pulse width (and time between pulses) as the encoder turns.  It isn't random... it seems to cycle from -15% to +15% and back, which seems to suggest slop in manufacturing.

I'm wondering if this is normal for these cheap Chinese encoders or is this possibly just a bum unit?  I don't want to buy a handful more if they could all be expected to be equally bad.  What about the $50-100 range encoders from the likes of Grayhill, Copal, and Honeywell - should I expect more accuracy from those units over the Chinese encoders from Amazon?

Thanks for any input.
It's not always the most popular person who gets the job done.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11903
  • Country: us
    • Personal site
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #1 on: March 06, 2019, 07:23:24 am »
What specific encoder you are talking about? I've used this type https://www.ebay.com/itm/DC5V-24V-360P-R-Encoder-Incremental-Rotary-360-Pulses-R-AB-2-Phase-6mm-Shaft/141656690772 and a few units I've got were fine. But this was many years ago, so they may have optimized something in the design.
Alex
 

Offline timpattinson

  • Contributor
  • Posts: 34
  • Country: au
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #2 on: March 06, 2019, 08:36:54 am »
Is it inside the specified nonlinearity?
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #3 on: March 06, 2019, 08:57:29 am »
What specific encoder you are talking about? I've used this type https://www.ebay.com/itm/DC5V-24V-360P-R-Encoder-Incremental-Rotary-360-Pulses-R-AB-2-Phase-6mm-Shaft/141656690772 and a few units I've got were fine. But this was many years ago, so they may have optimized something in the design.

The one I am using at the moment is this one:

https://www.amazon.com/gp/product/B00Y9KDDCY

It's not always the most popular person who gets the job done.
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #4 on: March 06, 2019, 09:00:55 am »
Is it inside the specified nonlinearity?

I haven't seen any manufacturer of optical incremental encoders list a spec for non-linearity in their datasheets, and certainly not these Chinese units, so there's no way to know if it's in-spec or not.  I assume it's just crap quality... so was hoping others could speak to their experiences with them.

This is the OEM:

http://www.china-encoder.com/

and the encoder:

http://www.china-encoder.com/product_detail/productId=24.html

it seems to me that a variance of +/- 15% for an optical incremental rotary encoder is massive and shouldn't be the norm... but maybe I am expecting too much.  Just wondering if I got a bad unit, or if it's par for the course, or if I should expect a $50 or $100 encoder from a name brand to be better (and if so, how much better), or how much I need to spend to get 1% or so?
It's not always the most popular person who gets the job done.
 

Offline OM222O

  • Frequent Contributor
  • **
  • Posts: 768
  • Country: gb
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #5 on: March 06, 2019, 11:37:17 am »
Can you provide the code/oscilloscope trace which you used to measure the speed? I've used cheapie ones without much of an issue tbh.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #6 on: March 06, 2019, 12:15:42 pm »
Looking at the details of the listing for that encoder I see that it has open collector NPN A & B output pins. Are you to supplying proper pull-ups for these signals to operate properly?
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 17518
  • Country: 00
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #7 on: March 06, 2019, 03:12:53 pm »
I picked up one of those cheap Chinese incremental rotary encoders from Amazon to use for measuring linear speed... I'm timing the gap between pulses to come up with a speed reading.  I am seeing a variance of 15%, even when I turn the encoder at a very precise rate.  I've attached a wheel to the encoder and mounted it to the table of my (pro, not hobbyist) CNC machine, and hooked up the encoder output to my oscilloscope and I see a variance of +/- 15% in pulse width (and time between pulses) as the encoder turns.  It isn't random... it seems to cycle from -15% to +15% and back, which seems to suggest slop in manufacturing.

So? The RPM will be the same.  :-//
 

Online Peabody

  • Super Contributor
  • ***
  • Posts: 2245
  • Country: us
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #8 on: March 06, 2019, 03:22:58 pm »
Seems unlikely that an optical encoder would vary that much. Does the +/-15% cycle coincide with one encoder revolution?
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #9 on: March 07, 2019, 06:58:39 am »
I picked up one of those cheap Chinese incremental rotary encoders from Amazon to use for measuring linear speed... I'm timing the gap between pulses to come up with a speed reading.  I am seeing a variance of 15%, even when I turn the encoder at a very precise rate.  I've attached a wheel to the encoder and mounted it to the table of my (pro, not hobbyist) CNC machine, and hooked up the encoder output to my oscilloscope and I see a variance of +/- 15% in pulse width (and time between pulses) as the encoder turns.  It isn't random... it seems to cycle from -15% to +15% and back, which seems to suggest slop in manufacturing.

So? The RPM will be the same.  :-//

No, it won't.  :palm:
It's not always the most popular person who gets the job done.
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #10 on: March 07, 2019, 07:00:05 am »
Seems unlikely that an optical encoder would vary that much. Does the +/-15% cycle coincide with one encoder revolution?

The variance repeats... in other words, it's over in the same position of revolution each time and under in the same position of revolution and it generally smoothly transitions from the min to the max and back.  That's what makes me think it's a manufacturing issue.
It's not always the most popular person who gets the job done.
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #11 on: March 07, 2019, 07:01:58 am »
Looking at the details of the listing for that encoder I see that it has open collector NPN A & B output pins. Are you to supplying proper pull-ups for these signals to operate properly?

Yep, I'm using pull-ups.
It's not always the most popular person who gets the job done.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11903
  • Country: us
    • Personal site
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #12 on: March 07, 2019, 07:02:09 am »
Those encoders use transparent plastic disc and a couple of optical pairs, and offset of that disc from the axis would produce this behavior.
Alex
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #13 on: March 07, 2019, 07:05:28 am »
Can you provide the code/oscilloscope trace which you used to measure the speed? I've used cheapie ones without much of an issue tbh.

I didn't save it but I just probed the encoder outputs in-circuit to see why I was getting such a variance in my reading, so there wasn't code involved as such.  I am seeing the quadrature output and the square wave looks perfect.  It's simply that the period and duty cycle/pulse width change over the course of a revolution, despite the encoder shaft being turned at a precise rate. 

I picked up a few more encoders and will see if they do the same or if this might be a bad unit.
It's not always the most popular person who gets the job done.
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1564
  • Country: au
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #14 on: March 07, 2019, 07:36:12 am »
How will this cyclic error show up once the quadrature signals are decoded?

As for speed, use a tacho  these are used as positional sensors primarily.

If used to synthesise a tacho signal... apply a bit more averaging and you wont notice it.
 
The following users thanked this post: Fungus

Online mikerj

  • Super Contributor
  • ***
  • Posts: 3382
  • Country: gb
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #15 on: March 07, 2019, 01:04:59 pm »
Looking at an Omron datasheet for a similar (but $$) encoder, it specifies a maximum phase variation between the quadrature outputs of +-1/8th of the period of one complete cycle.
 

Offline Corporate666Topic starter

  • Supporter
  • ****
  • Posts: 2010
  • Country: us
  • Remember, you are unique, just like everybody else
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #16 on: March 08, 2019, 10:02:31 am »
How will this cyclic error show up once the quadrature signals are decoded?

As for speed, use a tacho  these are used as positional sensors primarily.

If used to synthesise a tacho signal... apply a bit more averaging and you wont notice it.

As I mentioned in the first post, I am timing the pulses to determine speed.  This is necessary to accurately determine speed. 

Can't average it out when it's +15% on one side of the wheel and -15% on the other side of the wheel.  If the wheel was turning at sufficient RPM, that would work... but there are mechanical constraints I must work within on this project.

It's not always the most popular person who gets the job done.
 

Offline IconicPCB

  • Super Contributor
  • ***
  • Posts: 1564
  • Country: au
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #17 on: March 08, 2019, 11:02:37 am »
Sooo...whas the pulse rate you are seeing at the rotational speed in question... parts of an RPM?
few RPM?
tens of RPM
?













 

Offline tecman

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: us
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #18 on: March 08, 2019, 07:51:14 pm »
Your machine rotating the encoder could have mechanical tolerances in the drive gearing that would give velocity variations within one turn.  If you can determine that the error is at the same rotary phase angle it could be the drive.   I have used many hundreds of encoders over my years (none chinese) and have never seen variations as you are seeing.  The disc which is typically photo lithographed could have reeors that you are seeing, but it would be a gross error in production, and would generally effect an entire batch of products.  I would be surprised by that.

paul
 

Offline techman-001

  • Frequent Contributor
  • **
  • !
  • Posts: 748
  • Country: au
  • Electronics technician for the last 50 years
    • Mecrisp Stellaris Unofficial UserDoc
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #19 on: March 12, 2019, 12:00:51 am »
Your machine rotating the encoder could have mechanical tolerances in the drive gearing that would give velocity variations within one turn.  If you can determine that the error is at the same rotary phase angle it could be the drive.   I have used many hundreds of encoders over my years (none chinese) and have never seen variations as you are seeing.  The disc which is typically photo lithographed could have reeors that you are seeing, but it would be a gross error in production, and would generally effect an entire batch of products.  I would be surprised by that.

paul

Excellent point, my money is on this reason as the cause.  The OP needs to use a method of guaranteed rotational accuracy, perhaps on the cross slide of a lathe or milling machine etc.
 

Offline exuvo

  • Contributor
  • Posts: 21
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #20 on: March 13, 2019, 05:47:16 pm »
In my opinion your encoder is just fine, you are just reading it badly. Don't measure the time between the last two transitions, that is way too sensitive to manufacturing errors. Instead measure the amount of transitions in a given time interval. If you have too few transitions in your time interval for decent speed resolution either increase the measurement period or gear up the encoder to produce more transitions.

In my robot I use a hardware quadrature decoder and 16bit counter which i read often enough to ensure it has never moved more than half in either direction, otherwise i would not know if it went up or down between the last read. For me this rate is 50Hz, which gives the average speed over the last 20ms with good resilience to encoder step variability and random EMI events as the measurement includes hundreds of steps. This also gives the ability to count revolutions/distance at the same time.

If I need to drive the motors really slowly I instead add the last 5 speed readings of the counter, effectively the last 100ms, and use that value with a differently tuned PID loop.
« Last Edit: March 13, 2019, 06:06:13 pm by exuvo »
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11903
  • Country: us
    • Personal site
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #21 on: March 13, 2019, 05:51:14 pm »
I think people here are talking about different things. The goal of this encoder is to determine the position. It is not an RPM sensor. You can't measure the amount of transitions in a time interval, it just does not make sense. You need to read each edge transition.
Alex
 

Offline exuvo

  • Contributor
  • Posts: 21
Re: Rotary encoder accuracy - mine doesn't seem very good
« Reply #22 on: March 13, 2019, 06:00:41 pm »
I picked up one of those cheap Chinese incremental rotary encoders from Amazon to use for measuring linear speed...

That sounds very much like it is to be used for speed and not position? Either way my method still works fine for both. Just gear up the encoder so that you are not relying on the relative positions between individual transitions and can instead average out the edge to edge differences over a much larger amount of transitions at which point they are no longer noticable.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf