Sparkfun RGB Rotary Encoder Pinouts and Connection

Status
Not open for further replies.

tenorjazz

Active member
Is anyone familiar with this Sparkfun RGB Rotary Encoder?

Rotary Encoder.jpg

https://www.sparkfun.com/products/10982

I am not very good at reading datasheets yet (I am still real new at this stuff) so have not been able to figure out how to hook it up. Can anyone help me out?

I am guessing you will need 2 analog pins to use this encoder? One for the data and one for the RGB light?
 
This encoder has three things all in one product:

  1. a rotary encoder
  2. a switch
  3. an RGB LED

The SparkFun page mentions Gray Code but it is wrong; the datasheet they link to clearly shows quadrature encoding (two pulse outputs on two pins, offset so you can tell not only that the encoder is being turned, but also in which direction).

Teensyduino ships with the Encoder library, which handles this type of encoder. You will need two pins. On Teensy 3.x all pins are interrupt enabled.
https://www.pjrc.com/teensy/td_libs_Encoder.html

For the switch, use the Bounce library. You will need one pin for reading the switch.
https://www.pjrc.com/teensy/td_libs_Bounce.html

The relevant information for LEDs in the datasheet is right at the end. LEDs have two pins, the anode (+) and the cathode (-); this RGB LED is wired with all three anodes connected together (common anode). For driving RGB LEDs, there is a tutorial (but for Teensy 2, so assuming 5V; could use an update for Teensy 3.x)
https://www.pjrc.com/teensy/tutorial2.html

I will let someone who has experience with RGB LEDs on the 3.3V Teensy LC/3.x comment on how best to connect and drive them.

There was a thread about using the MCP23S17 expander to drive these SparkFun RGB encoders (but it was with Teensy 3.5, so 5V tolerant)
https://forum.pjrc.com/threads/42514-SPI-MCP23S17-and-RGB-Rotary-Encorders?highlight=RGB+LED+3.3V

Well, hope that helps a bit.
 
For the LEDs and full color range, you'll need at minimum 3 PWM pins with current limiting resistors. If you have many of them, arranging in a matrix and using a chip like MAX7219 (very expensive) is a nice, safe, way to do it without the need for resistors or anything. If you have mad soldering skills or a stencil and toaster oven, PCA9685 is also a very nice chip, but you need to add resistors yourself. I've also had some success with the TLC5940 but this chip takes a lot of pins and is a bit complicated. Again, resistors don't seem to be required here.

I'm no expert but I hope that helps you.
 
For the 3 LED pins, resistors are required if you connect to digital PWM pins on Teensy. Special chips like TLC5940 have the current limiting built into the chip. But ordinary digital/PWM pins do not. 3 resistors are required if you use the Teensy's pins.
 
I found that you had to tie the ground of the button switch with the ground of the leds. The button is the push part of the rotary. You need to read rotary and the push, as nantonos says two of the pins are just for the rotary, a third is for push button, and then three for rgb. Here is the schematic that I used (it has hardware debounce):

RGBrotary.png
 
Mortonkopf - This is just what I was looking for. One question.. Would I have to change any of the component values since I am running everything at 3.3V? NOTE: I am only about 1 month into learning electronics and I am a bit overwhelmed by all I need to learn.

Thanks again to everybody for your great feedback!!
 
you can probably increase the brightness of the leds by swapping out the resistors for 220, but check the Led specs first. In the end I used a T3.6 and kept the circuit as above, and stuck with the brightness as is. I was too lazy to do the sums and then change the resistors.

Edit - reread the spec sheet and led values are:
colour / typical v / max v
Red / 2.0 / 2.4

Green / 3.3 / 3.7

Blue / 3.3 / 3.7
 
Last edited:
Status
Not open for further replies.
Back
Top