Author Topic: Combine keyboard- and RGB-controller  (Read 6474 times)

0 Members and 1 Guest are viewing this topic.

Offline SnowPatch

  • Thread Starter
  • Posts: 6
Combine keyboard- and RGB-controller
« on: Tue, 17 February 2015, 05:42:43 »
Hey yall. I am planning to build a 3x4 keypad with RGB lighting. I would like to ask if it would be possible to run the keyboard controller (arduino pro micro) and the RGB controller (BlinkStick Pro V1.0) on the same USB port? Thanks :)

PS: If you know a cheaper alternative to BlinkStick, that you can also make your own program to control, then please let me know :)

Offline vvp

  • Posts: 886
Re: Combine keyboard- and RGB-controller
« Reply #1 on: Tue, 17 February 2015, 11:04:52 »
Looks like you can go without a led driver for such a small keyboard:
4 + 3 = 7 pins for switch matrix scanning
4 + 3*3 = 13 pins for RGB LED matrix
So you need only 20 pins. ATmega32u4 will do.
That is at most about 40 mA ((500-100)/9 ≅ 40) per one led per one color. Big enough. You would need 3 FETs for max current amplification (because 9*40mA > 40mA (maximum current limit per port of ATmega32u4)).
That is if you are OK with at most ⅓ duty cycle (should be big enough at 40 mA per channel).

Offline SnowPatch

  • Thread Starter
  • Posts: 6
Re: Combine keyboard- and RGB-controller
« Reply #2 on: Tue, 17 February 2015, 15:49:15 »
Hey vvp. That sounds interesting :) Would I still be able to make a program in Microsoft Visual Studio, that controls the RGB diodes, like I can on the BlinkStick? :)

Offline neverused

  • Posts: 572
Re: Combine keyboard- and RGB-controller
« Reply #3 on: Tue, 17 February 2015, 15:52:16 »
I should think so as it would all be PWM

Offline SnowPatch

  • Thread Starter
  • Posts: 6
Re: Combine keyboard- and RGB-controller
« Reply #4 on: Tue, 17 February 2015, 16:00:28 »
Sounds great :) Right now I am actually in the process of designing the pcb, but I am not familiar with making matrixes. Any idea how the keyboard and rgb matrix should be set up? (btw, the RGB ligts are 4-pin diodes in case you missed that) :)

Offline vvp

  • Posts: 886
Re: Combine keyboard- and RGB-controller
« Reply #5 on: Tue, 17 February 2015, 18:03:43 »
Yes, all the LEDs will have PWM with at most 1/3, oops, wrong, 1/4 maximum duty cycle. It still should be good enough.

4+3 matrix scanning is the same as for all keyboards

4+3*3 LED matrix has:
  • 4 line to select column (only one of these lines is connected at one time, all the others are at high impedance); may need to be connected through FETs
  • 3 leads for each of 3 LEDs in one line (within the column selected in previous point we have 3 LEDs each with 3 terminals (one for each color))
  • you will divide the whole period T into 4 equal parts, one part for each column, then for each selected column you will lit the 3 colors of 3 LEDs for desired part of T/4 column time ... depending on what the final color and brightness you want

Or if you wan to achieve 1/3 duty cycle then flip the LED matrix and use 3 + 3*4 = 15 pins for it. Then the final pin count is 15+7 = 22 (still well doable with ATmega32u4).

Offline SnowPatch

  • Thread Starter
  • Posts: 6
Re: Combine keyboard- and RGB-controller
« Reply #6 on: Wed, 18 February 2015, 00:40:42 »
Hey vvp. Could I get you to make a little schematic or something of the 3+4*4 matrix? I am not intirely sure how it should be set up :)

Offline vvp

  • Posts: 886
Re: Combine keyboard- and RGB-controller
« Reply #7 on: Wed, 18 February 2015, 02:55:53 »
You probably meant 3 + 3*4. Here is an example:
91159-0

Offline SnowPatch

  • Thread Starter
  • Posts: 6
Re: Combine keyboard- and RGB-controller
« Reply #8 on: Wed, 18 February 2015, 03:02:17 »
Would that make me able do individually light them? And does that works with my 4-pin RGB diodes?

Offline vvp

  • Posts: 886
Re: Combine keyboard- and RGB-controller
« Reply #9 on: Wed, 18 February 2015, 11:58:57 »
Would that make me able do individually light them?
Yes, it allows to control each color of each led separately.

And does that works with my 4-pin RGB diodes?
Who knows? You did not post a link to the specification of your LEDs.
It works with 4 pin RGB leds which have a common cathode and can handle at least 5V reverse voltage.

There are also 4 pin RGB leds with a common anode. Those need to flip GND with Vcc and N-channel FET with P-channel FET and logic in the firmware.

Anyway, the fact that you need to ask these questions (despite having looked at the scheme first) means that you need somebody who will do a complete design for you. Either find a person who will do it for you, or build something else already designed and published, or start to study how to design simple circuits.

Offline thehijjt

  • Posts: 9
  • Location: USA
Re: Combine keyboard- and RGB-controller
« Reply #10 on: Wed, 18 February 2015, 13:18:05 »
I have been thinking about doing something like this with an Adafruit Dotstar. They have an integrated driver, take spi communication, and don't have tight timing requirements. I think it would be possible to use a atmega 32u4 to do both the keyboard, and the rgb control.

Offline SnowPatch

  • Thread Starter
  • Posts: 6
Re: Combine keyboard- and RGB-controller
« Reply #11 on: Wed, 18 February 2015, 13:57:41 »
Hey vvp. You are completely right that I dont have alot on knowledge on this area. Would you be interested in helping me designing the pcb in Eagle Board? I've already designed the CherryMX spots and the spot for the Pro Micro.

The LED's im going to use is: http://goo.gl/C4RuC0 (bought as common anode).
The specs of the my specific Pro Micro can be found here: http://goo.gl/ZaQV7L

:)

Offline vvp

  • Posts: 886
Re: Combine keyboard- and RGB-controller
« Reply #12 on: Wed, 18 February 2015, 14:45:33 »
Well Leonardo Pro Micro has a great price but it does not have enough ports pulled out. From 26 useful IO pins of ATmega32u4 only 18 pins pulled out to the PCB edges. But almost for sure you could hack it to get the additional 2 or 4 pins out too. For comparison, Arduino Micro has 24 pins easily available, and Teensy 2.0 has 25 easily available pins.

The other option is to make the matrices like this: 4+3 (keyboard) + 4+3*3 (led matrix) = 20 pins, but you can share the 4 keyboard scanning pins with the 4 pins of led matrix, so the needed number of pins is only 20-4 = 16 (which your Leonardo Pro Micro can easily provide).

The RGB LEDs you have look OK. Since they are common anode you would need to use FET-P instead of FET-N, flip polarity and flip logic in firmware. It does not really matter if your leds are common catode or anode ... you just flip all logic and that is it.

I cannot design and build this with you since I'm used to KICAD (and lazy to learn Eagle), and (much more important) I already have a project on my shoulders: katy keyboard. Maybe you can find somebody else.