I was looking into how to make this LED matrix work the way it should on my Arduino. I finally resigned myself to the fact that I would need to utilize shift register ICs. So I started researching how to use them. Logically, I kept thinking that I had to use the PWM pins on the anode side of the LEDs. I thought that to vary the signal, I had to vary the positive side. So I coded that way thinking that I had to set the PWM on the anode for one color, then ground it. Then I coded each other color, but got terrible flicker and found that there was absolutely no way to run the while matrix this way.
WRONG!
What was I thinking?
What is PWM, but a toggling between positive and negative. The higher the value on the pin, the longer the pulse stays positive. Because LEDs only allow current to move one direction, I can put the PWM on the cathode.
This next part I am just guessing, but because I will now be modifying the pulse on the cathode, lower PWM values will make shorter pulses, but in effect make the LEDs brighter because the cathodes will be negative longer making the LED stay on longer. Furthermore, it makes sense that common anode LED matrices would be preferred because they can be powered independently and not draw their power from the PWM pulse preventing too much strain on the Arduino's power supply.
It's after midnight now, so I can't try this out now. I can't wait to try this tomorrow.
One last thing I realized, I can't address the entire matrix with my Arduino. It only has 14 PWM pins and I need 18. But, I can definitely test this on a 4x4 section of the LED matrix, right. I've already ordered some shift register ICs from a US supplier that promises delivery by Friday.
No comments:
Post a Comment