Englishscone:
Hmm. I just realized I didn't explain something, sorry about that. The grid probably won't need every led lit at the same time, very likely only about 2 - 7 at time. Would this parameter make multiplexing difficult?
Multiplexing should only light 1 led at any instant. All 3 junctions, RGB, may light at the sme time but only one led lights for some brief time before the next led has a chance. You can change that by not going through the display by row and column and just jump from lit to lit but you'll have to write that into happening.
GoForSmoke:
Multiplexing should only light 1 led at any instant. All 3 junctions, RGB, may light at the sme time but only one led lights for some brief time before the next led has a chance. You can change that by not going through the display by row and column and just jump from lit to lit but you'll have to write that into happening.
I'm suggesting that two RGB LEDs will be lit at any instant (if required for the desired pattern).
If only one led was lit at any instant, the multiplex ratio would be 1-in-16, but the instantaneous current could be increased to compensate, by reducing the series resistors, maintaining the same average current and therefore brightness. So it would make no difference in this circuit.
I don't like your idea of jumping from lit led to lit led. The brightness would then depend on how many LEDs were lit at the same time. If two LEDs were lit, they would be half as bright as if only one led was lit. Three led would be only one third as bright, 7 LEDs would be one seventh as bright.
A matrix of leds, if you have rows that ground and columns that power even with diodes you only light 1 row and column at a time. The grounding is done through a pin, how many pins should supply that with "extra bright" current at the same time? Now consider that 1 ground pin may need to take R, G and B at the same time.
Of course you could use transistors at the drains, would only need 4 then yes give the leds 25mA per junction (12 resistors) and sure each is only ON about 1/16th of a second when they should be lit.
You can light all the leds in a row that should be lit in a pattern. If the pattern changes much you will have a hard time keeping light levels anywhere near the same. Same goes if you only light the spots to be lit, if that number changes much then it will take varying ON times to get near even levels.
I did mention that I'm no fan of that way to wire leds?
I'm no fan of using a matrix that only lets 1 (or few) leds be lit at the same instant, that kind of wiring.
Addressable leds and led drivers have made it obsolete. By the time you wire cheaper parts to get an equivalent working you have spend a lot of time and maybe saved a little.
GoForSmoke:
I'm no fan of using a matrix that only lets 1 (or few) leds be lit at the same instant, that kind of wiring.
Addressable leds and led drivers have made it obsolete. By the time you wire cheaper parts to get an equivalent working you have spend a lot of time and maybe saved a little.
Now I understand, and I agree.
But maybe the OP wants to take the harder route to the solution, to learn more. I can understand that also.
Paul__B:
I suggested a sensible approach in #2. Seems like further discussion is just making it harder.
Not sure the max chips will allow the OP individual control (i.e. colour and brightness) over each led. The max chip can control brightness for the entire matrix to one of 16 levels, but it does not allow brightness/colour mixing for each led independently. So the max chip would allow dimming of the entire matrix, but each led would be limited to 7 colours (red, green, blue, yellow, cyan, magenta and white).
If I had a led matrix that fed and drained current through transistors I might be tempted to put a cap and resistor on each led to power it a short while even when the sourcing transistor is OFF. I'd want to be sure that the leds have a fixed ON/OFF time in my scheme for that.
PaulRB:
But maybe the OP wants to take the harder route to the solution, to learn more. I can understand that also.
It seems to be happening that way whether or not that was his intent (and I did not read it that it was)! Thus my comment.
PaulRB:
Not sure the max chips will allow the OP individual control (i.e. colour and brightness) over each led. The max chip can control brightness for the entire matrix to one of 16 levels, but it does not allow brightness/colour mixing for each led independently. So the max chip would allow dimming of the entire matrix, but each led would be limited to 7 colours (red, green, blue, yellow, cyan, magenta and white).
Nowhere in his posts thus far have I detected any requirement for individual colour and brightness control and all the suggestions about shift registers and multiplexing clearly prevent this.
I agree, and did so in post #2, if he wants such individual control, that WS2812 or similar LEDs would be by far the most appropriate, cheap and simple approach. If however he simply wants white, red, blue, green, yellow or purple on or off indicators, then the MAX7219 approach is the simplest and cheapest to wire and code. Once such a decision is made, then we can provide detailed instructions and even code to do it.
Sorry about this confusion, let me try to clarify what exactly I want to do.
This two player game idea has a seperate hidden joystick for each player ( make the game more interesting).
The object of the game is to move your character, ( a lit led, separate color like green ), around the grid, and fire a "laser" shot, which is represented by led stream in coordination bursting out of your charactor led in one direction. If the beam hits the opponent, (different led color character), the player loses a life.
So, preferably I need to control over at least two of the possible three colors. I thought about solving this porblem by creating a two layered multiplexing grid system. PWM would be a huge bonus, but since I don't know anything about multiplexing, I could be asking for the impossible. Couldn't I pulse the pin with x values from anologWrite? Maybe I should just use addressable leds?
Using a matrix will make this project harder, much harder and looking more amateur at best. You are already pulsing leds one at a time in a matrix, PWM won't help with that.
While pulsing leds you expect to read joystick axes? Please forget the bleeding matrix!
PaulRB:
I interpreted "full control" to mean more than simply on/off control of r, g & b, which would allow only 7 colours. Perhaps the OP can clarify?
This is for the OP;
The matrix leds R,G&B junctions all light in shorter pulses than human eyes can tell apart. Change the color from one pulse to the next in a cycle and the eye sees one blended color. And again, the matrix is the HARD WAY that can never look as good.
What I like most about real world programming is doing things in and across time on scales my senses can't touch.
Englishscone:
So, preferably I need to control over at least two of the possible three colours. I thought about solving this problem by creating a two layered multiplexing grid system. PWM would be a huge bonus, but since I don't know anything about multiplexing, I could be asking for the impossible.
While I cannot for the life of me comprehend what "GoForSmoke" is going on about, you need to clearly answer two questions:
Do you want to show any colours other than bright red, green, blue, yellow, purple or white?
Paul__B:
While I cannot for the life of me comprehend what "GoForSmoke" is going on about,
If I have just 1 RGB led and I pulse it with alternating red then green it will appear amber/yellow. If I pulse red+green and alternate with red I will see orange. By alternating primary colors seen over 40ms you can a good range of shades.
Yes it is 8 by 8 and that will make a much better game and at the price you can't go wrong.
You forgot to strip the garbage from the link!
Yes, I can't fault that suggestion, I have on your implicit suggestion, just ordered two of those boards myself which appear to be the outright best value per WS2812 LED.
GoForSmoke:
If I have just 1 RGB led and I pulse it with alternating red then green it will appear amber/yellow. If I pulse red+green and alternate with red I will see orange. By alternating primary colours seen over 40ms you can a good range of shades.
Oh yes, you certainly can. My question - as yet unanswered - is whether the OP has any interest whatsoever in generating more than a few sharply distinct colours.