I am making a ATmega powered keyboard and I want to know how to control 78 LEDS in a 6x13 matrix with a 328P. I saw on the project hub someone used a 74HC138 and a DM13A to control an 8x8x8 LED cube. I am not sure if I will need any of these components for my matrix.
Yes you will, in addition you will also need a diode with each switch.
However I don’t see how you get away with just one 74HC138, you will need two of them for 13 columns or rows.
You will not need a DM13A.
I did the diode for the switches. Will I need a resistor for the lights or will the 74hc138 handle that
That may have been useful for a 8³ matrix, but it does not help for your rather odd 6 by 13.
For 64 LEDs, you should be using a MAX7219. You control it with three lines and for another 64 LEDs, you add another MAX7219 and still require only 3 control lines. Point is, the MAX7219 performs all the multiplexing for you so the code is really easy (compared to writing multiplexing code).
The 6 x 13 matrix will have to be re-formatted to a couple of pieces within the two 8 by 8 matrices but I don't think you were really going to arrange it - logically - as 6 x 13 anyway. It is just impractical. The keyboard is another matter.
I got the keyboard part set, but how would I wire up the matrix in an 8x8 fashion? I will need to do a lot of rewiring that I won't be able to do. Could I split the matrix into a 6x6 and a 6x7 with 2 MAX7219s?
Do I need to use SPI for the MAX7219 modules
You never mentioned you wanted lights as well as switches.
Now you seem to be rambling on about other stuff.
So lets start with what you actually want to make.
- Switches matrix, what by what?
- Lights matrix, what by what. Are the lights? Monochrome, on / off or fadeable? Or are they RGB LEDs.
- Do these two matrices have to occupy the same physical space so you get illuminated switches?
You need to answer these questions before you even think of a design, let alone what chips to use.
I have just finished a 14 by 7 switch matrix, and there was a lot of wiring.
I once made a 8 by 8 matrix with RGB LEDs arranged in a hexagon shape:-
Hexome
There is an excedeing amount of wiring for each.
Rewiring implies you already have something you are hopping to adapt.
This is not a beginner level project, it is medium to advanced level. Don't even contemplate doing it on solderless bread board.
If you design it right you might be able to reuse some of the scanning signals for both keyboard and LEDs, like I did with the Hexome.
- Switches matrix, what by what?
the switches are in a 7x13 matrix.- Lights matrix, what by what. Are the lights? Monochrome, on / off or fadeable? Or are they RGB LEDs
Light matrix is the same as the keyboard. they are plain white lights
- Do these two matrices have to occupy the same physical space so you get illuminated switches?
Yes
Don't even contemplate doing it on solderless bread board.
I am making a pcb
That would be fine. You got the idea perfectly. Each part is within an 8x8 matrix and they are nearly the same size, so brightness will match.
You can use hardware SPI or control them in ("bit-bang") software.
It was rather implicit in the description of a keyboard.
I want to point out an I2C Alternative: the SX1509. It's not only a 16channel LED driver for 8x8 LEDs but it can also be used to read a multiplexed keypad. Up to 4 SX1509 can be used with the I2C Bus, in your example, two for the LEDs - two for the Keys.
The Datasheet
More information at Sparkfun: SX1509 I/O Expander Breakout Hookup Guide - SparkFun Learn
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.