Author Topic: Bourns rotary encoder with detents - no gray code?  (Read 2546 times)

0 Members and 1 Guest are viewing this topic.

Offline 0xdeadbeef

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: aq
Bourns rotary encoder with detents - no gray code?
« on: February 21, 2012, 10:50:55 AM »
Hi,

I recently bought a few Bourns PEC16 2215F-S0024 rotary encoders on eBay since I'm toying with the idea for a project where I could use some rotary knob as input. Anyway, according to the data sheet, they should have a "2-bit gray code" output. Which would mean that turning the knob left or right should cycle through patterns which differ only by one bit:
I.e. for the one direction
A 0 1 1 0
B 0 0 1 1 ...

There's also a little figure in the datasheet which looks exactly as you would expect.

However, when I test the encoders, I can observe a behavior that is quite a bit different:
A 0 1 1
B 0 1 0 ...

And for the other direction:
A 0 1 1
B 0 0 1 ...

It looks like at the detents, both outputs are open and when turning left/right there are high pulses created on both outputs, where in the one direction, the rising edges are synchronous (but not the falling edges), while in the other direction the falling edges are synchronous (but not he rising edges).
So this should make it possible to detect the direction, but this is clearly no gray code and not nearly the behavior shown in the figure. My guess is that the figure in the datasheet is only valid for the version without detents, but there is no remark and the datasheet is for both versions.
Any hints?

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3892
  • Country: 00
Re: Bourns rotary encoder with detents - no gray code?
« Reply #1 on: February 21, 2012, 11:57:47 AM »
You mixed up the ground pin and a switch pin.
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List

Offline 0xdeadbeef

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: aq
Re: Bourns rotary encoder with detents - no gray code?
« Reply #2 on: February 22, 2012, 04:38:08 AM »
In my understanding, there is no such thing as a ground pin. There are just switches which are either closed or open.
But indeed, when I connect 5V to the 1st pin instead of the middle pin, the behavior looks much more grayish.
The weird thing is that the data sheet call the middle pin C and the outer pins A and B and A/B are also used as output names in the diagrams.
I'm beginning to think that either the datasheet was made my madmen or I got completely different encoders than what I ordered...
« Last Edit: February 22, 2012, 04:53:49 AM by 0xdeadbeef »

Offline slateraptor

  • Frequent Contributor
  • **
  • Posts: 792
  • Country: us
Re: Bourns rotary encoder with detents - no gray code?
« Reply #3 on: February 22, 2012, 05:25:45 AM »
The weird thing is that the data sheet call the middle pin C and the outer pins A and B and A/B are also used as output names in the diagrams.

I'd be cussing up a storm. :P

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3892
  • Country: 00
Re: Bourns rotary encoder with detents - no gray code?
« Reply #4 on: February 22, 2012, 06:06:04 AM »
Unnecessary rudeness removed !
« Last Edit: February 22, 2012, 06:05:37 PM by Simon »
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List

Offline nessatse

  • Regular Contributor
  • *
  • Posts: 80
  • Country: za
Re: Bourns rotary encoder with detents - no gray code?
« Reply #5 on: February 22, 2012, 08:30:17 AM »
In my understanding, there is no such thing as a ground pin. There are just switches which are either closed or open.
But indeed, when I connect 5V to the 1st pin instead of the middle pin, the behavior looks much more grayish.
The weird thing is that the data sheet call the middle pin C and the outer pins A and B and A/B are also used as output names in the diagrams.
I'm beginning to think that either the datasheet was made my madmen or I got completely different encoders than what I ordered...



There appears to be a mistake in  earlier versions of the datasheet.  The one on the Bourns website [size=78%]http://www.bourns.com/pdfs/pec16.pdf[/size] is REV 05/11 and shows the pin order as A-B-C, whereas the older version on one of the datasheet archives [size=78%]http://pdf1.alldatasheet.net/datasheet-pdf/view/221373/BOURNS/PEC16-2215F-S0024.html[/size], is REV 07/07 and shows the pin order as A-C-B. 


I guess it's a good idea to always try and find the latest version of the datasheet.  :)

Offline 0xdeadbeef

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: aq
Re: Bourns rotary encoder with detents - no gray code?
« Reply #6 on: February 22, 2012, 09:06:24 AM »
Honestly I took more or less the 1st datasheet I found as I couldn't imagine that someone could screw up something as basic as the naming of the three connectors of the base functionality. But ok, I learned now that this is possible as well.
Thanks guys...

Offline SgtRock

  • Supporter
  • ****
  • Posts: 1109
  • Country: us
Re: Bourns rotary encoder with detents - no gray code?
« Reply #7 on: February 22, 2012, 01:14:09 PM »
Dear Oxdeadbeef:

--Indeed Nessatse is correct (see the attached pictures below), the older version of the data sheet has mislabeled the pins. The pin "C" is the one that gets Vs. And indeed you did not even need to look at the effing data sheet to tell that there was no "ground pin". If you had taken the advice you were so rudely hand down from the high horse, you would still be searching for this figmentary ground pin. If he says there is a ground pin, you had better agree right away, else you are going to treated to some clever profanity.

--I always wondered how rotary encoders worked, and your mention of the Grey Code put me on to some very good information about rotary encoders, and  2 digit Grey encoding (quadrature). My ignorance in these matters is now somewhat lessened. Thank to everyone for the good posts.

"There once was a worker, so bored.
That when his posts were ignored.
He'd strive on inanely,
And most times profanely.
But seldom, if ever he scored."
Gator Dundee 1948 -

Best Regards
Clear Ether
« Last Edit: February 22, 2012, 02:00:47 PM by SgtRock »

Online sacherjj

  • Frequent Contributor
  • **
  • Posts: 921
  • Country: us
Re: Bourns rotary encoder with detents - no gray code?
« Reply #8 on: February 22, 2012, 01:40:05 PM »
I'd be cussing up a storm. :P

We leave that to BoredAtWork.    ;D

Offline slateraptor

  • Frequent Contributor
  • **
  • Posts: 792
  • Country: us
Re: Bourns rotary encoder with detents - no gray code?
« Reply #9 on: February 22, 2012, 02:27:38 PM »
...you would still be searching for this figmentary ground pin.

Common, ground. Tomato, tomato.

Offline Wartex

  • Frequent Contributor
  • **
  • Posts: 404
  • Country: ca
    • http://headsplosive.com
Re: Bourns rotary encoder with detents - no gray code?
« Reply #10 on: February 22, 2012, 02:42:52 PM »
I don't care what is in the fucking datasheet. I don't even have to look at the datasheet to know that you mixed up pins.

I delete PMs unread. If you have something to say, say it in public. I love the sound of a "you are not helpful" whining in the morning.

Someone has anger management issues. Passive aggressive anger, the best kind of anger.

Offline Bored@Work

  • Super Contributor
  • ***
  • Posts: 3892
  • Country: 00
Re: Bourns rotary encoder with detents - no gray code?
« Reply #11 on: February 22, 2012, 08:56:09 PM »
Someone has anger management issues. Passive aggressive anger, the best kind of anger.

No, I have issues with idiots who can't even hold a multimeter in continuous mode to three pins in the right order after told they got the wrong order. How hard is it really? How much time would this take? One minute? And maybe another minute to draw a, I dare to say "schematic", of two switches and figure out what happens if you get it wrong?

** Unnecessary rudeness removed **
« Last Edit: February 23, 2012, 08:18:27 AM by EEVblog »
I delete PMs unread. If you have something to say, say it in public.
For all else: Profile->[Modify Profile]Buddies/Ignore List->Edit Ignore List

Offline Simon

  • Global Moderator
  • *****
  • Posts: 7148
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Politically Incorrect
Re: Bourns rotary encoder with detents - no gray code?
« Reply #12 on: February 22, 2012, 09:00:03 PM »
if you feel the original poster is not heeding your advice properly just ignore the thread and stop replying if you feel its a waste of time.

Offline 0xdeadbeef

  • Frequent Contributor
  • **
  • Posts: 359
  • Country: aq
Re: Bourns rotary encoder with detents - no gray code?
« Reply #13 on: February 23, 2012, 07:12:09 AM »
No, I have issues with idiots who can't even hold a multimeter in continuous mode to three pins in the right order after told they got the wrong order. How hard is it really? How much time would this take? One minute?
Apart from being rude, you also didn't really seem to understand the issue. Letting aside that non-existing ground pin, this kind of rotary encoder leaves both switches open when a detent is reached. And it cycles through the whole gray code between two detents (meaning that at least for some time, all three pins are shorted). Thus measuring with a continuity tester is absolutely and completely futile. Before you insult other people based on your misconceptions, you should maybe take a deep breath first and consider the fact that you're maybe not as incredibly clever an other people not as incredibly dumb as you think.
Anyway, as an engineer you have to be able to trust a datasheet and a good datasheet should contain all information about a device, not erratic and sketchy pieces of information. Reverse engineering each and every piece of equipment due to nonprofessional datasheets might be ok for the hobbyist but is certainly unacceptable in a commercial environment.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf