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.
Based on 5 ratings:
1 of 1 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.
3 of 3 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.
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.
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
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.