Rotary Encoder - Illuminated (RGB)

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). This is a quadrature encoder and outputs similar to 2-bit 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.

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

Rotary Encoder - Illuminated (RGB) Product Help and Resources

Getting Started with the LilyPad MP3 Player

May 8, 2013

The LilyPad MP3 Player is an amazing little board that contains almost everything you need to play audio files. You can use it to create all kinds of noisy projects, from MP3 hoodies to talking teddy bears. Your imagination is the only limit! This tutorial will help you get started.

Core Skill: Soldering

This skill defines how difficult the soldering is on a particular product. It might be a couple simple solder joints, or require special reflow tools.

1 Soldering

Skill Level: Noob - Some basic soldering is required, but it is limited to a just a few pins, basic through-hole soldering, and couple (if any) polarized components. A basic soldering iron is all you should need.
See all skill levels


Core Skill: Electrical Prototyping

If it requires power, you need to know how much, what all the pins do, and how to hook it up. You may need to reference datasheets, schematics, and know the ins and outs of electronics.

2 Electrical Prototyping

Skill Level: Rookie - You may be required to know a bit more about the component, such as orientation, or how to hook it up, in addition to power requirements. You will need to understand polarized components.
See all skill levels


Comments

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • Member #57306 / about 6 years ago * / 1

    I like it! Lots of fun potential. I've created a "translated" and simplified datasheet. Scruffy, but, I hope, useful... wiring etc, a page at SheepdogGuides.com

    Someone said you needed to use drivers for the LEDs... I had usable brightness at 2mA with a 10k resistor, 5v Vcc. Just things mentioned elsewhere in these comments... but in diagram form, which I hope is easy to use.

    Someone said the breakout board had been discontinued. Maybe an old one was, but as of 24 Mar 18, there was one... suitable for either the RG or the RGB encoder. Part ID: BOB-1172. Buy one! $3 well spent! (8 pins, and NOT 0.1" spacing.)

  • nvladimus / about 6 years ago * / 1

    I struggled with this encoder for a couple of days, but in the end I really like it. It just needs debouncing and good documentation. I made a small and simple PCB that contains resistors and caps this encoder needs: github.com/nvladimus/ArduinoRotaryEncoderPCB

    Happy encoding!

  • Edge Effect / about 8 years ago / 1

    I'd like to see the sketch and wiring diagram from your product video.

    • Member #57306 / about 6 years ago / 1

      For help with the wiring: http://sheepdogguides.com/elec/iec/IEC173-RotEnc.htm

  • Member #333036 / about 12 years ago / 7

    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.

    • Edge Effect / about 8 years ago / 1

      I just got the pin-outs from Sparkfun's breakout board... even if you're not using the board, you can use the photos of it that are online.

    • MikeGrusin / about 10 years ago / 1

      The datasheet oddly doesn't have the pinout, but the Dimensional Drawing does.

  • pubdc / about 12 years ago / 6

    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.

  • embeddedtom / about 12 years ago / 6

    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?

      • fungus / about 12 years ago / 3

        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.

      • Far_Seeker / about 12 years ago / 3

        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.

  • XMicron / about 12 years ago / 4

    Do these have a 'Click' feeling when turned? because these COM-10596 don't...?

    • jimblom / about 12 years ago / 5

      Yes, this one does have detents. Very nice and tactile.

  • ddegn / about 10 years ago / 3

    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.

  • FiletMignon / about 10 years ago / 3

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

  • Member #410134 / about 11 years ago / 2

    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.

    • Member #57306 / about 6 years ago / 1

      Are you sure that NOT having a connection from the "common" terminal to either of the "sometimes connected to common" terminals when shaft is "in" a detent(ed?) position is a FAULT? I don't see why it should be. (Any more than I can see why the PRESENCE of a connection when it is "detented" should be considered a fault. But maybe I just haven't thought about it hard enough yet.

    • Kerbal / about 11 years ago / 2

      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.

    • Mayo2017 / about 10 years ago * / 1

      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.

      • ddegn / about 10 years ago / 3

        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.

  • ro0ter / about 12 years ago / 2

    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

    • ro0ter / about 12 years ago / 2

      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

  • Member #299668 / about 12 years ago / 2
  • EasternStarGeek / about 12 years ago / 2

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

  • Member #213113 / about 12 years ago / 2

    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.

      • Member #213113 / about 12 years ago / 2

        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.

          • ddegn / about 12 years ago / 2

            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

  • SigEpBlue / about 12 years ago / 2

    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.

  • LabRat / about 12 years ago / 2

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

  • kbowerma / about 9 years ago / 1

    Can we get a wiring digram for the RGB pins? A wiring diagram from that matches the video would be great. Someone posted we need to use a NPN for them. I went straight to the Arduino via 270 Ohm measure 5 volts but still know light. Put 5V from my bench power supply to another one (I bought three) and heard a pop. I have never used an RGB led but it seems pretty straight forward. I am using the breakout board and agree it covers all but one row on breadboard so I put some right angle headers on the extra ABC (encoder side) so I could use the one row on my breadboard for the RGB.

  • Member #603835 / about 10 years ago / 1

    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!

    • Kamiquasi / about 10 years ago / 2

      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

  • reginr / about 10 years ago / 1

    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.

  • Bigollo X1 / about 10 years ago / 1

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

  • soundman98 / about 10 years ago / 1

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

  • Mayo2017 / about 10 years ago * / 1

    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.

  • JEK3 / about 10 years ago * / 1

    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.

  • Member #472879 / about 10 years ago / 1

    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.

  • gabrielgiacomini / about 10 years ago * / 1

    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)
    

    • Member #570952 / about 10 years ago / 2

      Hey Gabriel,

      would you please be so kind and post the whole code?

      Thanks in advance!

  • 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);  
    }
    

  • 42towels / about 11 years ago / 1

    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.

    • 42towels / about 11 years ago / 1

      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!

    • M-Short / about 11 years ago / 1

      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.

  • NatL / about 11 years ago * / 1

    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.

  • BiohazrD / about 11 years ago * / 1

    These are common CATHODE, not common anode.

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

  • Member #403185 / about 11 years ago / 1

    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

    • MikeGrusin / about 11 years ago / 1

      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.

  • Member #197238 / about 11 years ago / 1

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

    Curt

  • Member #385316 / about 11 years ago / 1

    I'm getting around 4 interruption per click, is it something related to what they call "chattering" on the datasheet ?

    • Mayo2017 / about 9 years ago / 1

      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

  • Member #356346 / about 12 years ago / 1

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

    • Member #380900 / about 11 years ago / 1

      Ignore the previos... I'm retarded ... Most probably you meant they will not fit in the breadboard

    • Member #380900 / about 11 years ago / 1

      Really ? :| I'm using it on a breadboard, and the Arduino is going nuts. It's because of the breadboard ?

  • lax.ste / about 12 years ago / 1

    Any ETA on when these will be available again?

  • ddegn / about 12 years ago / 1

    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.

  • Member #295019 / about 12 years ago / 1

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

  • Member #295019 / about 12 years ago / 1

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

  • The Best / about 12 years ago / 1

    Very nice :)

  • Sleepwalker3 / about 12 years ago / 1

    Pity they are mechanical instead of optical :(

  • GregFR / about 12 years ago / 1

    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).

    • greenwing / about 12 years ago / 2

      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.

  • philfromseattle / about 12 years ago / 1

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

  • padvinder95 / about 12 years ago / 1

    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.

    • padvinder95 / about 12 years ago / 1

      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

3.8 out of 5

Based on 8 ratings:

Currently viewing all customer reviews.

1 of 1 found this helpful:

Question - breakout board

What is the part number for the bar graph + encoder breakout board? I see the basic breakout board but not the one shown in the picture.

Unfortunately, that breakout board was retired in September of this year. https://www.sparkfun.com/products/retired/11040

2 of 2 found this helpful:

Great Encoder - Will Need Debouncing and Current Driver For RGB

This is a great encoder that worked perfectly right out of the box. I was able to use a class from the Teensy library and had it reading pulses in minutes. A couple of caveats. First and foremost if you want good accuracy you will need some debouncing. The datasheet calls for .01uF caps to be placed across the A/C and B/C terminals. That should quiet the noise considerably. That does reduce the Nyquist cutoff though so your accuracy will fall off if the knob is spun super fast (although in testing I couldn't make it happen, but in principle you will get aliasing if you spin if faster than Nyquist/2).

Finally, you WILL need a current driver for the LEDs. Don't try to drive those bad boys directly from a Due or Teensy - you could kill your poor chip. Also the forward voltage for the green and blue LEDs are somewhere around 3.3v so that leaves scant voltage after the cutoff on 3.3v systems (and the RMS voltage will be even lower). I suggest a separate driver circuit using tip120, bc547, or even 2n2222s. Since you should treat the leds as a power device it makes sense to have a separate power supply for them (leds can be quite the current hogs and three in parallel just increases that current threefold). DON'T FORGET current limiting resistors. You will end up with a fried diode otherwise.

I forgot to add that you should add a pull up to the switch if you are reading it with a digital pin. It won't work otherwise.

4 of 4 found this helpful:

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.

1 of 1 found this helpful:

Few issues (for me atleast)

I admit I'm fairly new, though I have a few other pieces of hardware figured out. But I seem to have an issue figuring out switch part of the encoder. I have the rotate working, but I can't seem to get it hooked up correctly. I've sent an email about 4-5 days ago and haven't received a response yet. I'm really trying to get this thing figured out. I've read about it needing to be Active LOW because of the shorting etc.I have a regular pushbutton working but when using the same pins on the switch (encoder), i can't seem to get it. Please get back with me when you have a chance, thanks.

Hi, Your support ticket was received late on a Friday night. We are not open on the weekends. You have been assigned to a Support rep who will be in contact with you in the order your ticket was received. Thanks

1 of 1 found this helpful:

Quite Nice

I bought some of these and some of the basic rotary encoder sparkfun has (https://www.sparkfun.com/products/9117) and found this one to be much more reliable. Each click is consistently one grey code shift on this model, whereas other encoders can be much more finicky. The LED are an appropriate brightness, and the button has a good clicking feel. I do use it with the sparkfun breakout board and clear knob, and it has a sturdy feel. Importantly, the other encoder (and the tutorial linked on this page) needs a pullup resistor for the encoder lines and the push button; this model however needs pullups on the encoder and a pulldown on the button. I'd recommend springing for this model over the basic one.

4 of 5 found this helpful:

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.

1 of 2 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.

3 of 6 found this helpful:

Bad Description

Overall the part is fine, but the description is completely inaccurate and needs to be corrected. It states that the part outputs "gray code", which it does not.

Gray code is outputted by absolute rotary encoders (https://en.wikipedia.org/wiki/Rotary_encoder#Absolute_rotary_encoder), this part is an incremental rotary encoder (https://en.wikipedia.org/wiki/Rotary_encoder#Incremental_rotary_encoder) and your code needs to detect changes in the quadrature outputs in order to determine direction.

Hope this is helpful for other users, Sparkfun please fix the description.