I'm looking for help with the code in order to program one of these to run a 5x20 R/G LED matrix. I haven't been able to find any more than one example code and am wondering whether or not any of you may have pointers or a crude example code? Thanks, Jaren.
That is 300 LEDs you need mor that just shift registers to drive this, you will also need some current drivers.
This link
http://www.thebox.myzen.co.uk/Workshop/LED_Matrix.html
Shows you the two ways you can drive the multiplexing.
With such an odd ball display size you are going to have to write the code yourself.
I make it 200 leds, assuming "R/G" means red/green as opposed to red/green/blue. Is this a pre-built display or will you construct it from individual leds? Are the R/G leds common anode or cathode? I would recommend five max7219 chips to drive it, depending on your answers.
Paul
You need to cite the matrix - either a really careful description, or preferably, a website describing it.
The display is designed to fit inside an alarm clock case. And according to the datasheet the shift register is more than capable of supplying the 30mA required. I was just wondering how I would go about the code... I a familiar with the functions of the arduino environment but cant ever seem to get the functions right. Mostly my issue is writing a byte to the outputs... if this makes sense to anyone?
And according to the datasheet the shift register is more than capable of supplying the 30mA required.
The chip can, but what makes you think the matrix will only require 30mA?
At the very least you are going to have 10 of those LEDs on at any one time so giving an LED 3mA is going to be very dim especially if multiplexed at a 20:1 duty cycle.
Jaren:
And according to the datasheet the shift register is more than capable of supplying the 30mA required.
That's not how we read it!
Care to supply the description(s) I requested? You won't get much guidance unless you correctly state your requirement.
Thanks... Ill have to look into the different components. The led matrix isn't cited its my own design. Ill post some code when I get the chance.
Jaren:
The led matrix isn't cited its my own design.
Ah! Now we are getting somewhere. That's what I was looking for, though we do need to know whether the LEDs are common anode or common cathode.
If you are constructing the matrix yourself, then you want to be using MAX7219s. You organise your array into blocks of 5 by 4 (since each MAX7219 is an 8 by 8 matrix, but you are using pairs of LEDs), so you need five MAX7219s for common cathode LEDs. Since you are multiplexing by 5 instead of 8, each group has more multiplex time and you get more brightness.
For common anode LEDs, you need six MAX7219s, multiplex by 7. You could have chosen a more convenient (binary) matrix dimension.
Why MAX7219s? No other ICs, no driver transistors, no resistors, three control lines for the lot and - perhaps most importantly - the multiplexing is done for you you just load the data in and it is displayed with no further CPU activity at all.
Common cathodes... Cathode row anode column design.
So 3 cd74ac164 to drive the 20 columns, and 5 N-channel MOSFETs to sink a row at a time?
Common cathode is good, cathode row is good. Each MAX7219 drives five cathode rows and four columns, each red and green which you can organise as either alternate colour bits or a nybble per colour. Five chips for four columns.
Took me a while to think that out - had to resort to pen and paper.
Paul__B:
no resistors
Strictly speaking you will need one resistor per max7219, to set the current for each led in the matrix. Heck of a lot better than the alternatives, which could mean 20 or more probably 40 resistors.
Jaren:
according to the datasheet the shift register is more than capable of supplying the 30mA required.
The problem is, while each output may be able to supply 30mA, the 595 chip overall is limited to around 70mA. Thats less than 10mA per output if all 8 happen to be on. Combine that with a 1:5 or 1:10 multiplex ratio and the display will be too dim to read in daylight, although fine in a dimly lit room.
Another problem you may have is that the display will be too bright in a dark room. Many people can't sleep with that. You need to be able to dim the display. An ldr attached to an Arduino analog input makes it easy to measure the ambient light levels. Dimming the display can be achieved by attaching an arduino pwm output to the output enable pin of all the 595s and using analogWrite(). With the max7219, you can send a command to dim the display to one of 15 levels.
Jaren:
Common cathodes... Cathode row anode column design.
Have you purchased the leds yet? If not, you need to decide if you want to go for the shift register or max7219 design. Common cathode better for max7219, but common anode may be better for shift registers.
As the maximum current of the 595 is so low, you could consider tpic6c595 instead. This is a high current version of the 74hc595 with the same pinout. It can only sink current into its outputs, it cannot source current from them, hence why common anode leds would be better in that situation.