Creative Commons images are CC BY-NC-SA 3.0

$ 3.95

Notify Me

added to your
shopping cart

quantity
Out of stock out of stock
3.95 1+ units
3.56 10+ units
3.16 100+ units

We have a purchase for 2500 units. We expect some of these to arrive next on Mar 17, 2015.

Incoming stock values are estimates, and subject to change without warning.

Description: Rotary encoders can be used similarly to potentiometers. The difference being that an encoder has full rotation without limits (It just goes round and round). They output gray code so that you can tell how much and in which direction the encoder has been turned. They’re great for navigating menu screens and things like that.

This encoder is especially cool because it has a common anode RGB LED built in, as well as a push-button. Look below for the clear knob that goes with this potentiometer.

Features:

  • Switch Travel: 0.5mm
  • Shaft Diameter: 6.0mm
  • Shaft Length: 18mm
  • Vertical Through-Hole Mount
  • 24 Pulses per Rotation
  • Red/Green/Blue LED
  • Pushbutton

Documents:

Customers Also Purchased

Customer Comments

  • The datasheet doesn’t say which pin goes to what, so here you go: The side with 3 pins is the rotary encoder output - central pin looks to be common. The easiest way to use this with an arduino is to connect common to ground, and then use the Arduino inputs in pull-up mode.

    The LEDs and central button are interfaced using the side with 5 pins. With the shaft facing away from you, looking at the bottom of the device, with the 5-pin side on the top and 3-pin side on the bottom, the pins are: Common (+5v), Blue, Button, Green, Red. Pressing the shaft button shorts the +5v common and the center pin. There are no internal resistors, so be sure to use one on each of the 3 LED pins. Use a 120ohm (or higher) resistor on the red, and a 68ohm (or higher) resistor on the other two, if you’re using 5v.

  • It’s a bit misleading that 4th picture with the breakout board, as that has only the 4 pins of the Red/Green rotary encoder. And on its product page, that refers to THE rotary encoder, not specifically the RG one. One could easily be confused by this and order 2 incompatible items. That said, can’t wait for the RGB rotary breakout board.

  • This (and its right-angle brother) outputs quadrature, not Gray code. (And capitalize “Gray”, since it’s named after a person, Frank Gray.)

    Love the data sheet: “for microscopic current circuits used in electronic equipment”!

    • What’s the difference between quadrature and 2-bit Gray code?

      • Gray code only repeats once around the shaft. You can tell exactly where the shaft is at any time.

        Quadrature code usually repeats around the shaft. You can see the shaft turning but you don’t know the absolute position.

      • In the context of rotary encoders, n-bit Gray code normally refers to absolute rotary encoders, while quadrature usually refers to incremental rotary encoders. In the first type the sensors can continually output a signal the angle of the rotor, even when it is not moving. The second type only outputs a signal when the rotor is turning. So while a signal from both a 2-bit Gray code encoder and a quadrature encoder would look the same during rotation, there are potentially significant differences between the two components that is indicated by the nomenclature. Here’s a Wikipeadia link with some more info.

  • Do these have a ‘Click’ feeling when turned? because these COM-10596 don’t…?

  • This encoder seems to be nothing but trouble. Has anyone figured out how to use the Due’s hardware quadrature decoding?

  • After reading the reviews, I was a little skeptical of the quality I would get, however I haven’t found anything that offers the exact same product as this. So I ordered 2, incase one didn’t work. Well after spending hours trying to figure out why one wasn’t working, I looked at the second one to find that it wouldn’t work either. The switch (rotary encoder), in the resting position, would never make contact with the common pin (labeled C I believe in the datasheet). While rotating, the outputs (A and B) would close to the common ( C ) as they should (pre the datasheet), but NEVER would rest where they were supposed to. After taking them both apart, it seems that the divots that are supposed to hold the shaft in position are misaligned. So when you let go and the shaft “clicks” to a spot, it is always open (doesn’t make contact). I seriously doubt this is how it is supposed to operate! To fix it (so to speak) I flipped the copper sheet around that makes the shaft stay (and click) to each divot. Now it spins smoothly AND works like it’s supposed to! I can’t believe how cheap this was made! So keep in mind that this is junk and you’ll have to fix it yourself.

    P.S. I would have returned it on the spot, but I already built my enclosure to the dimensions for this switch and like I said, nothing I have found fits as a replacement.

    • I am having the same issue. If/when rotation is detected, it is immediately cancelled by an opposing rotation detected at the same time. Turning the encoder one detent at a time, will not increment a counter. This is already soldered into the RingCoder breakout and I doubt it’s going to come back out easily.

    • Your spring trick did work (on my second one - first one was just defective) and gave me 96 positions per rotation, BUT after some real digging, what you originally had IS how they’re supposed to work - these are FULL CYCLE per detent, or 4 state changes per detent. This sure isn’t made obvious and led to massive headaches! My detents were still misaligned it seems, so I had to play with the spring a bit but got it to work.

      • I think the description should be clarified to make it clear there are (usually) four transitions per “click” of the encoder. You’re right about the 96 transitions per rotation.

  • Bad quality encoders received. I don’t know where to post this, so I add a comment. I have seen that SparkFun moderators often post answers and/or hints to user comments/questions. Looking forward for this.

    I’m sorry to say this, but the encoders you sent me are of poor quality. The “rest position” of the encoders is actually connecting one of the outputs to the common if resting in a 120-degrees area (maybe more). I state that I did not subject the encoders to any mechanical factors except when adding the clear plastic knob on top of them (extreme care is taken, I was never even close to the 5kgf in the datasheet).

    The encoders seem to be faulty. I will test the remaining 3 encoders this afternoon and keep you updated with the results. I noticed this problem yesterday late-evening while struggling with Gray debouncing inside the code. For two thirds of the rotation the algorithm worked but for one third it didn’t. I have also tested the encoders against two LEDs, that is how I noticed the awkward “rest position”… I only tested 2 encoders (of the 5 I bought last month) and both seem to have the same problem. I dismantled one of the two faulty encoders but I saw no problem; I’ve put it back and it works the same. Still, maybe the leads are miss-aligned, my eye-meter isn’t micrometer-accurate. The second faulty encoder was not dismantled but it behaves the same.

    Any hint?

    Thanks, ro0ter

    • UPDATE: A total of three encoders of the 5 I bought have this problem. I further analyzed the problem and I noticed that the rotary shaft of the faulty rgb encoders has a margin (it rattles a bit unlike the shaft of the working rgb encoders). I was able to fix the encoder I dismantled by tightening it better. I’m not sure how it will hold in time since the metal claws are a bit fragile now due to the bending.

      The rotary encoders that failed: 1) hand-soldered ~250°C, knob added and removed, dismantled, tightened back, works better now (shaft rattles less) 2) hand-soldered ~250°C, knob added and removed, shaft rattles a lot 3) brand-new from the bag, not soldered, no knob added to this one, seems not to have that clicky feeling so pronounced.

      Sparkfun, I thought you sell better products, really… I was thinking to return them but the shipping to USA is like $40-50… It’s more expensive than the total value of these 5 encoders plus the original shipping… It ain’t worth it sending them back…

      I wonder if anyone else has problems with these encoders. Please let me know about this.

      Regards, ro0ter

  • Hi, guys- Anyone have an ETA on this unit? Thanks!

  • Can you post the wiring diagram and arduino code for the RGB Rotary encoder that you show in the Product Showcase video, please?

    • The demo code above should work.

      • The demo shows an encoder without the LED and it’s not clear to me that it shows the use of push button. The example shown in the Product Showcase video shows all of these things.

        • I’ll see if we still have that. the push button is just a button, that’s all. you would read it into your microcontroller like any other button. I’ll see if I can dig up the code.

          • This push button is not a normal push button.

            It can only be used “normally low” (if you want to use the LEDs).

            The button shorts the common anode to the center pin of the five pin group.

          • Here you go: code

  • Looks to be a chinese knock-off of the Bourns PEL12T: http://www.bourns.com/data/global/pdfs/PEL12T.pdf.

    Even the LED voltage and current table is identical.

  • Typical.. the week after I order two of the “Bi-Colour” ones, you come out with this.. (sigh).

  • Hello everyone,

    can anyone tell me how to use the switch of this Rotory Encoder? What do i have to connect and do i need a resistor? Would really appreciate any help i can get. Thanks in advance!

    • I believe you’ll find everything you need in the description and/or the comments. For the push button, for example, see the Dimensional Drawing document that describes the pinout, and this comment

  • Please have pity and grace

    I want to use this with an Arduino Pro Mini 3.3v - Can I just connect the RGB pins to Arduino Pro Mini. - If not what do I need, and how do I connect it.

    Thank you so much in advance.

  • These are fun encoders. IMO, you should clarify the description to say the “24 Pulses per Rotation” means 24 full encoder cycles. Each “click” of the detent will transition the encoder through a full cycle of four transitions. There are 96 transitions per rotation (as Mayo2017 mentioned earlier).

    Since there are four transitions per detent click, pressing the button can cause the encoder to fluctuate a couple of transitions.

  • Great product and work for me well, but is any chance to get waterproof version or at least IP55?

  • the datasheet for both rgb rotary encoders now goes to a 404 error.. it makes checking the pinout problematic.

  • Wish I had tested these when I first bought them a couple months ago. It seems the detents in the shaft are misaligned relative to the actual switch contacts. Finally broke them out for a project I was waiting to start, and I ran into the same issue as another commenter did. It wouldn’t change state and stay in a given state - the contacts stayed open on any given detent.

    After reversing the detent spring inside to let it free-wheel, I can use it normally, but without detents. If I reenable the detents, it stops working… only thing I can think of is that the detents aren’t aligned properly. Wish I had tested months ago before putting it in the bin. Shame because they’re gorgeous when lit up with a nice knob on tip.

  • I figured out a way to use this (or any other quadrature/2-bit Gray code encoder) with an Arduino (or other controller). No interrupts, and no switch bounce issues. Just take an old PS/2 ball mouse (NOT optical), open it up, and replace the phototransistor from the optical encoder wheel with three wires going to the A-B-C terminals. You can also replace the left/right mouse button with the switch on this encoder. For some example code, go to http://playground.arduino.cc/ComponentLib/Ps2mouse for a description and library of how to hook up a PS/2 mouse to your Arduino. The mouse controller IC takes care of debouncing, direction sensing, and counting steps between queries. It will also allow you to hook up two encoders (three if the mouse has a scroll wheel) simultaneously.

  • I’ll add to the complaints of poor quality - ordered 2, the first one is now shorting out my arduino. I’ll have to try the second; I may just have to order a better unit from mouser.

  • I had similar problem as the other users and didn’t manage to use this encoder by using libraries or example code. After a few nights failing to implement existent code I decided to go reverse engineering and figure out what kind of output this thing was giving, and I came out with this code that is working nice with all the units I have (a bought a bunch of them with ringcoder breakouts and everything). This code adds or subtracts from encoderPosition every time the encoder reachs a detent. It will still fail to detect 1% of the times you reach a detent. I used port 52 and 53 since I’m testing this on Arduino DUE (all pins can be used as interrupts), but if you are using other arduinos you should use external interrupt pins.

    int aPin = 52; //connected to the A port
    int bPin = 53; //connected to the B port
    
    void setup()
    {
      Serial.begin(115200);
    
      pinMode(aPin, INPUT); 
      digitalWrite(aPin, HIGH); //pulled-up
      pinMode(bPin, INPUT);
      digitalWrite(bPin, HIGH); //pulled-up
    
      noInterrupts();
      attachInterrupt(aPin, readEncoder, CHANGE);
      attachInterrupt(bPin, readEncoder, CHANGE);
      interrupts();
    
    }
    
    signed int encoderPosition; 
    
    volatile char rotaryData = 0x0;
    
    void readEncoder()
    {
      noInterrupts();
    
      char newData=digitalRead(aPin)
    
  • I just received this interesting little doodad, I’m using it with a Teensy 3.0 and here is some demo Code I wrote for it. Maybe it can help some others out. I haven’t had the issue with it that others have been seeing described as poor build quality. Also, the comment from Member #333036 was pretty spot on as far as pin out. I used the encoder library from PJRC found here example which handles this device well. It does however increment +-4 every tick of the detent so just be careful when coding.

    #include 
    
    Encoder encoder(A5, A4); //These 2 pins are A and B of the encoder side, C is connected to ground
    
    const int redPin =  10; 
    const int greenPin =  A8;
    const int bluePin =  9;
    volatile boolean encoder_button = false;
    
    void setup() {
      Serial.begin(9600);
      pinMode(A3, INPUT);
      pinMode(redPin, OUTPUT);
      pinMode(greenPin, OUTPUT);
      pinMode(bluePin, OUTPUT);
      attachInterrupt(A3, buttonPush, CHANGE);
    }
    
    void loop() {
      int32_t value;
      value = encoder.read();
        Serial.print("value = ");
        Serial.println(value);
    
      if (Serial.available()) {
        Serial.read();
        Serial.println("Reset Encoder to Zero");
        encoder.write(0);
      }
      if(encoder_button)
      {
        for(int i=0; i< 20; i++) //Careful with this if you or a friend has epilepsy 
        {
          setColor(255, 255, 255);
          delay(10);
          setColor(0, 0, 0);
          delay(100);
        }
        encoder_button = false;
        Serial.println("Button Pushed");
      }
      else
      {
        setColor(value,0,0);
        delay(1000);  
        setColor(0,value,0);
        delay(1000);
        setColor(0,0,value);
        delay(1000);
      }
    }
    
    void buttonPush()
    {
      encoder_button = true;
    }
    
    void setColor(int red, int green, int blue)
    {
      analogWrite(redPin, red);
      analogWrite(greenPin, green);
      analogWrite(bluePin, blue);  
    }
    
  • I ordered some of these the other day, and what I received today is not what is described here. The shaft has no threads and is much smaller than the included mounting nut and washer, so they are basically useless, as I cannot panel mount them. Further, they do not ‘click’ as you rotate them, it is just a smooth rotation. The part number on the bags is as listed on this page. Rather frustrating, I was in the middle of a project with my daughter and needed them, now we’re going to have to wait.

    • Just thought I’d give an update here. I had indeed received the wrong parts, and techsupport sent me the correct ones, got them a couple days ago. Problem solved, thanks a bunch guys!

    • Sorry about that, email us at techsupport@sparkfun.com and we’ll see if we can get to the bottom of this and get you what you need.

  • Just wanted to mention that you can easily remove the detents on these encoders. Just open the 4 metal legs, take it apart and flip the copper spacer/detents ring. You might want to flatten it a bit for best results.

  • These are common CATHODE, not common anode.

    As such you can use single resistor on the common side for all three LEDs

  • According to the datasheet, it looks as if this is a QUADRATURE output encoder, not GRAY CODE.

    Is this so? Or does it actually put out GRAY CODE as it says in the description?

    If so, how does it put out 24 pulses with four pins?

    Am I missing something.

    Confused in Saint Paul

    • Depending on how pedantic you want to be, 2-bit Gray code and quadrature could be defined as the same thing; but as Gray code is generally applied (usually with higher bit resolutions) to absolute encoders, I understand the confusion. Consider this a quadrature (incremental) encoder. The three pins on one side are the encoder; the five pins on the other side are for the RGB LED and pushbutton switch.

  • Hello all, has anyone code like the product video using a 20m2 picaxe? I’ve goggled until my fingers can’t goggle anymore.

    Curt

  • I’m getting around 4 interruption per click, is it something related to what they call “chattering” on the datasheet ?

    • For anyone who comes across it, there ARE 4 state changes per click. The datasheet is NOT clear on this, and I wish the description would point this out.

  • Hi all I got two of these and started designing something in SketchUp so I thought I’d share this model that I created for it. SketchUP COM-10982 Model

  • Could you specify that this product is not breadboard friendly? apparently you only specify this when you have a breakout board for it….

  • Any ETA on when these will be available again?

  • The button shorts the common anode of the LEDs to th center pin of the five pin group.

    Connect the center pin to your uC with a pull-down resister to monitor its position.

  • can anyone give me some info on how to debounce the push button in this?

  • Does anyone have a wiring diagram or tutorial on how to get the LEDs on this thing to work? Thanks

  • Very nice :)

  • Pity they are mechanical instead of optical :(

  • Are you making a break-out board for this part, and is it going to have holes for pins that are aligned on both sides so it fits square in a breadboard or protoboard? (not like the break-out for the red/green illuminated rotary encoder where the holes are not aligned).

    • Here’s a break-out I’m using until SparkFun comes out with theirs.

      http://www.batchpcb.com/index.php/Products/78935

    • Yes, but it’s going to have some other stuff attached. This should be in the eagle library.

  • More importantly, is that really the datasheet for this part? No mention of a switch or LEDS, just the two quadrature switches.

  • So is this an encoder or a potentiometer? “Look below for the clear knob that goes with this potentiometer.” Same thing on the right-angled version’s page. Now, I don’t know if you also carry an illuminated potentiometer, but otherwise I would suggest also changing the “Clear Plastic Knob” product page, which talks about an illuminated pot.

    • The knob page does now mention it’s for encoders, but this' and its right-angled brother’s product pages still say “Look below for the clear knob that goes with this potentiometer.” at the end of the second paragraph :(

Customer Reviews

4 out of 5

Based on 3 ratings:

5 star
1
4 star
1
3 star
1
2 star
0
1 star
0

0 of 1 found this helpful:

it glows

kind of difficult to prototype with, data sheet is confusing, but it works. also fun to take apart. can count to 3 really well.


Excellent product!

The instructions and data sheet isn’t very helpful for this encoder, but it works really well once you become familiar. I used this to create a new table lamp that glows from under a shelf (above the table). The lamp has 4 NeoPixel strips so I can control their exact colour variation. This encoder is perfect for the test because of the glowing indicator, letting me know exactly which RGB value I’m modifying.

It’s useful to get the RG/RGB breakout. Interpreting the grey code was somewhat difficult due to high amount of current bounce that occurs in this encoder. I saw online that some people use a debouncing circuit with resistors/capacitors. I wrote a C++ class RotaryEncoder(int pinA, int pinB, int start, int min, int max, int step) to accurately convert the grey code changes to an integer counter and didn’t need a debouncing circuit. Using logic, I only needed 2x1K resistors, one for pinA and pinB.

The diagram for this unit may look strange for the LEDs, but it’s accurate. You’ll need to supply positive voltage to the unit, and the RGB pins will need a transistor if you want to control their state from a microcontroller (I used NPN, and supplied output from Adruino pin to the base of R,G,B pin transistor).

I’m VERY happy with the end result of the project.


It works if you do your homework...

I bought a few of these for a project I’m working on thinking they were a traditional “Gray code” rotary encoder but that is not the case. Read through the comments and you will find that this is a quadrature or “incremental” encoder which basically means that you HAVE to detect the edge of the output or you will have lost inputs. The encoder at resting position will ALWAYS output all high (or OFF in the datasheet) and so you have to detect when it is turned and not simply poll your pins whenever convenient like you would a normal rotary encoder.

The product description is frankly misleading and needs to be updated. I wish I would have read the user comments before purchasing so I would have known what I was buying.

Also note: the LEDs are more sensitive than you might anticipate. One of my encoders now has only blue and green because I accidentally put too much current through the red diode. I’ve done this with other LED products for a short time and they were fine but in this case the diode was dead instantly.