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

Thread: Powering RGB Rotary Encoders with Teensy

  1. #1
    Junior Member
    Join Date
    Jul 2021
    Posts
    2

    Powering RGB Rotary Encoders with Teensy

    Hey everyone, I'm trying to build a volume mixer over serial for Windows and I'm having a bit of trouble planning out how to put everything together. I don't have a lot of electronics knowledge or experience so bear with me

    The current plan is to use a Teensy 3.6 or 4.1, 8 push-button rotary encoders with a built-in RGB LED, possibly a few led push-buttons, and an LCD or OLED screen to show volume levels and other info. I don't have any of the components yet and I've just been playing around with a couple of regular encoders on an Arduino Nano.

    My main concern is how to provide enough power to the LEDs since from what I can tell the Teensy can only output 10mA per pin at 3.3V but the datasheet says that they need 25mA at 2-2.4V for R and 3.3-3.7V for G/B. I'm not sure if I'm understanding the specs correctly but I will link the datasheet below. If the Teensy cannot provide sufficient power then my next plan would be to use a battery pack or some form of external power and transistors for each channel on each LED but I would like to avoid that because it almost seems like its just too much going on for what I'm trying to do.

    My next issue to tackle would be how to get all the components connected since the RGB encoders alone will need 48 pins. I would rather stick with the ~40 breadboard friendly pins since I don't feel to comfortable soldering anything to the pads so I will be looking into multiplexers but was hoping you guys could give me some general information. Is the I/O speed impacted in any way with multiple connections going to the same pins on the microcontroller? And which components would you recommend I connect to the multiplexer out of 16 encoder, 8 push button and 24 RGB pins? Or does it not matter at all?

    Encoder: https://www.sparkfun.com/products/15141
    Datasheet: http://cdn.sparkfun.com/datasheets/C...108-6HSPEC.pdf
    I'm going to purchase them from a different website but I believe its the same product

    If you guys have any other advice for me on how to make this project better, easier or more compact I would be happy to hear it

    Thanks in advance

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,596
    Power supply:
    The most easy and straight forward solution would be to power the Teensy via the USB cable and the rest of your device from an external supply. But, even then, you can not directly connect 24 LEDs@20mA to the Teensy since its output per pin and its total output capability is limited (IIRC total < 100mA?, datasheet will help). Your 24 LEDs will consume about 20mA*24 =480mA.

    USB-only power supply
    In case it is important to only have a single USB cable connected to you device, you could use USB-C which usually is able supply 1.5A to a USB2.0 device. Here a corresponding USB-C -> USB-Micro converter:

    Click image for larger version. 

Name:	kicad_3d_2.jpg 
Views:	19 
Size:	51.1 KB 
ID:	25334 Click image for larger version. 

Name:	breadboard2.jpg 
Views:	22 
Size:	30.9 KB 
ID:	25335
    Details, schematic and gerbers: https://github.com/luni64/USB-C---MicroB. Building this would require some electronics knowledge and SMD soldering.

    Sparkfun has a ready to use USB-PD board which might also fit https://www.sparkfun.com/products/15801. You would use the power output of this board to supply the Teensy and the LEDs. However, you would need to solder the USB signals (D+/D-) to the Teensy. This would also require some electronics experience.

    LED Driver:
    I would go for a ready to use PWM driver and power it by a simple external 5V supply. I once used the following one in a project. It has a I2C connection, works nicely, doesn't require additional parts and can easily be daisy chained to drive your 24 LEDs.

    Click image for larger version. 

Name:	815-04.jpg 
Views:	16 
Size:	178.7 KB 
ID:	25332
    https://www.adafruit.com/product/815


    Encoders + encoder buttons:
    This library https://github.com/luni64/EncoderTool supports multiplexed readout of encoders. It can also handle the encoder buttons. The extras folder of the repo contains information on different multiplexing hardware. Since you mentioned little electronics experience I would go for the solution with the 4067 multiplexers, you get breakouts at the usual sites.
    Here an example of a compact setup to readout 16 encoders. You can stack a third board to handle the corresponding switches. Schematic and more info in the link given above.

    Click image for larger version. 

Name:	assembly3d.jpg 
Views:	19 
Size:	79.9 KB 
ID:	25333

    Have fun with your project!

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,180
    You don't have to provide the maximum rated current to an LED - in fact today they are so efficient that
    this is usually blindingly bright.

    Try 1mA to 5mA range - some experimentation may be needed to get the right current limiting resistor
    ratios. Forward voltages are less at lower currents to so 3.3V is likely to be enough for the blue and green
    devices.

  4. #4
    Junior Member
    Join Date
    Jul 2021
    Posts
    2
    Thanks a lot for the info fellas, I've got a better idea of what I'm working with and how to go forward from here now

    Try 1mA to 5mA range - some experimentation may be needed to get the right current limiting resistor
    ratios. Forward voltages are less at lower currents to so 3.3V is likely to be enough for the blue and green
    devices.
    I did consider this route but I would like to be able to drive them at full power if needed so I think I'm going to go with external power. Plus it would probably help to power the display

    I've decided to start with just 6 encoders for now so I might be able to get away without the multiplexer depending on what else I want to add in the future. The PWM driver looks like an amazing solution and much better than my backup plan of wiring up individual transistors for each channel. I've ordered the encoders and plan to order the Teensy, driver, and display this week once I figure out how I want to handle external power - at the moment leaning towards battery.

    Finally decided to try this project out after thinking about it for a couple of years and I'm keen to see it all come together

  5. #5
    Adafruit sells a PWM module designed for LEDs instead of Servos. It controls 24 LEDs and is currently in stock. https://www.adafruit.com/product/1429
    I've used them to drive grain-of-wheat light bulbs that are inside of a seven-segment style display.
    Click image for larger version. 

Name:	grain-of-wheat_display.jpg 
Views:	11 
Size:	91.6 KB 
ID:	25377

Posting Permissions

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