2 Bit Gray Encoder Supplier

Eschatonic

New Member
I have been looking for ages for a reasonably priced Gray encoder incorporating a momentary switch. They are surprisingly hard to find. Maplin and Rapid don't carry any kind of Gray encoder much less cheap ones. Finally I found these: http://cgi.ebay.co.uk/12mm-Rotary-Encoder-Switch-With-Keyswitch-10pcs_W0QQitemZ350126007559QQihZ022QQcategoryZ67003QQrdZ1QQcmdZViewItemQQ_trksidZp1713.m153.l1262

In case the link buggers up they are an ebay shop called sureelectronics. At $1.60 a piece these are great value for money especially since this price includes the knob which can often double the cost of a pot.
These are the same component as are used by Big Clive on his splendid knob RGB LED controller: http://bigclive.com/knob.htm

Sometimes sureelectronics also sell a fancier looking encoder with a silver, narrow knob. These also have a momentary push switch built in.

Obviously at this price they aren't bulletproof Omron quality but for project work or even daily light use these are a cool and elegant way to input positive/negative values to your code.

If you haven't used a Gray encoder before there are a bunch of code examples all over this site of using them as both interrupt generators or just polling them. As an input device for controlling things like volume or intensity and mode (with the momentary switch) they are the dog's danglies.

All the Best
Graham (New Zealand)
 

BeanieBots

Moderator
You're probably finding them hard to find because "gray" is used for position feedback (many bits) whilst "quadrature" is more typically used for replacing panel knobs.
Quadrature 'knobs' are very abundant and cheap with countless hardware and software routines.
Why go for an obscure 'gray' system that offers no advantage?
 

hippy

Technical Support
Staff member
I would guess the exact terminology is a regional and cultural thing, plus spelling of 'grey' and 'gray' differs as well. "Rotary encoder" is another generic term often used.

Rapid stock 61-1602 which is not cheap but made by Bourns is probably good quality and there may be others.
 

womai

Senior Member
Hi Hippy,

as to spelling, in this case "Gray" is not the name of a color (or colour :) but the name of Mr. Frank Gray who was working at Bell Labs and patented the code in 1947. So it's "Gray" in the UK as well as in the US.

Wolfgang
 

hippy

Technical Support
Staff member
@ Wolgang : Good point and I would say you are correct. A Google search shows quite a few "grey encodings" even from reputable education sources in the US and elsewhere.
 

Eschatonic

New Member
Clarification

The term 'quadrature' applied in this sense means that the signals from the pins on the encoder are 90 degrees apart. When the position of the encoder changes the direction of rotation can be deduced by knowing which pin goes high first.
There is nothing to prevent a Gray encoding device also exhibiting quadrature.

If the Wikipedia is to be believed Wolfgang is right, Gray code is named after its inventor and is very far from obsolete. This article is very interesting: http://en.wikipedia.org/wiki/Gray_code
To put the whole thing in a nut; irrespective of their type or bit width successive sequential Gray codes do not change by more than one bit unlike counting up in binary.
Gray (2 bit) code goes like this: 00 01 11 10 00 . . . .
You can have Gray code with more than 2 bits.

In a practical sense this suits it very well to cheap and cheerful knob based input devices for things that require digital input. You let your control code poll the switch and if you get an unexpected position code you just throw it away, reset you previous position to the current and resume polling. You miss a few bits here and there but the operator never knows. The upshot to us is that you poll the switch as often as you like and forget about bounce and intermediate values. In an overall sense the control will appear to the operator to work perfectly. I may not have made it clear that the knob doesn't have end stops like a pot. You can just spin it in either direction - it's your program code decides when maximum or minimum values are reached.

So why did I bother to draw your attention to this component?
The component mentioned by Hippy from Bourns is an optical quadrature encoder and not at all what I wanted. Aside from anything else it costs 29 pictures of the Queen without so much as a free knob of your choice plus, of course, postage. This is to me way over $100. It also doesn't have a momentary switch built in. On the other hand it has a mechanical parts life of 10,000,000 rotations and no contact bounce.

The link that I posted here to sureelectronics is for a HARD TO FIND inexpensive and versatile control with free postage and a free swatting knob. They have a specified service life of 30,000 rotations and 20,000 momentary activations, in my current project that translates into 'lasts forever'.

If you want a light duty control for amplitude, frequency and mode and you can get these delivered free for a buck sixty (including that knob don't forget) why wouldn't you want to use them?

I wish you all a joyous Waitangi Day.

Graham
 
Top