Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Sparkfun RGB Rotary Encoder Pinouts and Connection

  1. #1

    Sparkfun RGB Rotary Encoder Pinouts and Connection

    Is anyone familiar with this Sparkfun RGB Rotary Encoder?

    Click image for larger version. 

Name:	Rotary Encoder.jpg 
Views:	29 
Size:	91.0 KB 
ID:	12910

    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?

  2. #2
    Just found this image. I know it's not exactly the same Encoder. I might be wrong on the pins needed

    Click image for larger version. 

Name:	Rotary Encoder Connections.jpg 
Views:	80 
Size:	55.1 KB 
ID:	12911

  3. #3
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,108
    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...t=RGB+LED+3.3V

    Well, hope that helps a bit.

  4. #4
    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.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,808
    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.

  6. #6
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    911
    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):

    Click image for larger version. 

Name:	RGBrotary.png 
Views:	215 
Size:	100.7 KB 
ID:	12914

  7. #7
    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!!

  8. #8
    Senior Member mortonkopf's Avatar
    Join Date
    Apr 2013
    Location
    London, uk
    Posts
    911
    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 by mortonkopf; 02-12-2018 at 03:24 PM. Reason: Editing for resistors

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •