SparkFun will be closed Monday 7/4 for the holiday. All orders placed after 2pm MT on Friday 7/1 will be shipped out next week.
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). 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.
Based on 8 ratings:
1 of 1 found this helpful:
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.
1 of 1 found this helpful:
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
3 of 3 found this helpful:
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:
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:
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.
2 of 3 found this helpful:
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.
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
0 of 1 found this helpful:
kind of difficult to prototype with, data sheet is confusing, but it works. also fun to take apart. can count to 3 really well.