LED matrices without driver chip.

How large can you go with a LED Matrix before using driver chip using an Arduino?

and what’s the best way to do it!?

Arduino has 14 digital pins and 6 analog that can be used as digital as well, so in theory you coukd make a 10 by 10 matrix. BUT the 40mA max current sourcing / sinking limitation on any Arduino pin would require some kind of driver circuit anyway.

Then there is charlieplexing…

It depends on which “best way” you want : simplicity of control, number of leds, …

If you want to go with the simple solution, you have to count the number of pins available. The diecimilia have 14 I/O pins + 6 analog ins > 20 pins. (I’m not sure you can use the 6 analog ins as digital outs, but let’s say you can) With those 20 pins, you can go up to a 10x10 matrix > 100 leds.

(corrected it, made a mistake)

With the greatest number of leds, you could use charlieplexing.

With this technique, you can use the 14 I/O pins to control (14*14)-14 = 182 leds.
Way harder to code and wire.

Thank you both for your comments, I was looking at charlieplexing this morning but have ruled it out due to programming and wiring.

(14*14)-14 = 182 leds. :o !!!

regards 10x10, As you pointed out that not possible in real terms due to current sourcing, requiring drivers, so what size would be just multiplexing?

(I’m not sure you can use the 6 analog ins as digital outs, but let’s say you can)

Yes, you can. This really needs to be better described in the Arduino documentation.

There are twenty digital I/O pins. Many pins have additional capabilities.

I/O/Z PWM duty 10bit ADC I2C triggers FTDI FTDI
Pin Alias pinMode() digitalWrite() digitalRead() analogWrite() analogRead() Wire.send() attachInterrupt() Serial.read() Serial.print()
0 - YES YES YES - - - - YES -
1 - YES YES YES - - - - - YES
2 IRQ0 YES YES YES - - - YES* - -
4 - YES YES YES - - - - - -
5 - YES YES YES YES - - - - -
6 - YES YES YES YES - - - - -
7 - YES YES YES - - - - - -
8 - YES YES YES - - - - - -
9 - YES YES YES YES - - - - -
10 - YES YES YES YES - - - - -
11 - YES YES YES YES - - - - -
12 - YES YES YES - - - - - -
13 - YES YES YES - - - - - -
14 A0 YES YES YES - YES* - - - -
15 A1 YES YES YES - YES* - - - -
16 A2 YES YES YES - YES* - - - -
17 A3 YES YES YES - YES* - - - -
18 A4 YES YES YES - YES* YES** - - -
19 A5 YES YES YES - YES* YES** - - -
  • The function expects the alias pin numbering scheme.

** Both pins must be used in conjunction.

As you pointed out that not possible in real terms due to current sourcing

Well, if you’re going to stick to specs, it depends on how much current your LEDs need. Say that you decide that the hard limit is that 40mA per pin, and you think you need 10mA per LED (which is sorta low, for a multiplexed display.) That means your ‘common’ side can only handle 4 LEDs at a time, and 4x16 = 64 LEDs would work. (In theory, you can set up your 10x10 array so that it’s driven 4x30 - the current limits prevent you form having too many ON leds at one time, but you can limit the max possible number of ON leds in software instead of in the hardware.)

So as i can run a 3x3x3 led light cube (27 leds) I could run a 5x5 matrix (25 leds) without a problem?

Not exactly. I depends on how many LED’s in the cube / matrix is turned on at the same time. Thre are two current limitations on Arduino first any pin can source at the most 40mA, but all the pins can not source 40 mA at the same time, because there is also an upper current limit of the Arduino processor IC all in all. I cant remember that limit of the top of my head.

There are twenty digital I/O pins. Many pins have additional capabilities.

Nice chart Halley! You might consider also adding a column showing the I/O pins that support the SPI hardware and get the thing published somewhere in the Arduino reference. I need to use this to make a cross reference to convert the special purpose I/O pins Vs pin names for the 644P as the pin mapping works out different for that chip.


retrolefty, yeah, I forgot the SPI hardware. It’s slightly tricky, you need more pins in conjunction, but can still ignore the output or the input. I’ll document it tonight when I have a moment.

I’ll either petition for it to be added to the reference, or for me to get edit access for the non-playground areas. I have seen a number of places I could tweak spelling or improve wording, but none important enough to report the suggestions indirectly.

For lack of a better place, I put the table at http://www.arduino.cc/playground/Learning/Pins - the original pin discussion was here but moved long ago to the official reference pages. My new table may also be adopted and moved if the site administrators want to do that.