4
\$\begingroup\$

I'm in the process of designing a controller PCB for a 10x10 white LED matrix clock (inspired by the tutorial here). It's based off an ATmega328 AVR IC and Maxim DS3234 SPI RTC.

However, I'm stuck: I have no idea how to control my custom non-standard 10x10 LED matrix. Originally I was going to use a Maxim MAX7219/7221 IC, but it can only drive 8x8 LED matrices. Then I was looking at some sort of charlieplexing solution with a ULN2803 darlington transistor array. The bright white LEDs I'm using need at least 30mA of current.

Here's my preliminary schematic (sorry it's not too clear, but note the I2C and UART lines are available for use): Schematic

Here's an example wiring schematic of my LED matrix (NOTE: the example diagram below only shows an 8x8 matrix. My matrix is 10x10.) LED matrix excerpt


What's the best way to drive my 10x10 LED matrix with the AVR? (Also, PWM is not a requirement, but would be nice.)

Thanks!

\$\endgroup\$
1

2 Answers 2

6
\$\begingroup\$

The best example I can think of is the "Peggy," A Light Emitting Pegboard Display. It is a 25x25 LED matrix display driven by an ATmega168 (which is pin compatible with the ATmega328)

The wiki page has a lot of good information. Including a detailed schematic.

There are few things to notice in their layout.

For one, they use a row common anode setup. That is the current source is on the row, and sink on the column. You have yours in row common cathode. There is nothing inherently right or wrong with either layout. Just something to keep in mind when designing your circuit. If using discrete leds, it just means flipping the led connections. If using a prebuilt LED matrix, it is something important to know. (I'll assume you can easily swap the order to match the peggy schematic. If not, just swap column for row in your head)

They use 74HC154 4-16 decoder/demux chips for row select. Since you only need 10 rows (or cols) you can get away with just one. Of course, there is the issue of current. In your case, at 10 x 30mA = 300mA minimum. To solve that problem they used 2STX2220 PNP transistors which will be able to source up to 1.5A per row. A bit over kill in your case. Since you will just use these as row select switches, just about any other pnp transistor that can source your max current should work just as well. Take a look at Transistor Circuits to figure out what resistor values you'll need for full on/off operations.

On the Peggy board, for the column sink driver they use an STP16DP05. But I have found these difficult to find and expensive. There are many other alternatives like the TLC5916 These use a serial input, and can be easily cascaded. If not, a digikey of mouser search for led sink driver will yield many results.

Alternatively, since you already have ULN2803 arrays, you could use two of these with a single current limit resistor per column. That's a lot of pins, so you'll have to get creative, but it could work for the column sink as well.

Avago published a nice application note titled "Introduction to Driving LED Matrices". It covers this and a few other things.

\$\endgroup\$
2
  • \$\begingroup\$ Wow, thanks, this is a lot of great info (especially the Avago doc). \$\endgroup\$
    – mr_schlomo
    Apr 23, 2012 at 1:22
  • \$\begingroup\$ Dead link to Avago, here's an alternate (pdf): avagotech.com/docs/AV02-3697EN \$\endgroup\$ Apr 20, 2013 at 15:12
3
\$\begingroup\$

When driving LEDs from port pins, a technique sometimes called "Charlieplexing" can be useful. Although some descriptions of it seem to be rather ad hoc, it allows N 3-state (high/low/float) port pins to drive (N*(N-1)) LEDs. here's an example using 4 port pins to drive 12 LEDs. The left-side switches are momentary and will pull an output high. The right-side switches are latching and will switch an output low. Note that the left-side switch associated with an output will only work if the right-side switch for that output is in the lower ("off") position.

The scope at the bottom shows the current through the second pin; as shown, pins will be called upon to sink about 15mA driving a column, or source about 5mA driving a row (a transistor will supply the balance of the current).

In practice, if one wanted to construct something like this circuit for a 10x10 matrix, one would electrically wire an 11x11 matrix with the diagonal missing, and "shove" the upper-right portion to the left a spot (yielding an 11x10 grid) and get rid of the bottom row.

\$\endgroup\$
5
  • \$\begingroup\$ 10x10 might be a bit too much for charlieplexing due to LED leakage currents, but it's worth a try. also, don't expect too much from a 1/100 duty cycle if you're trying to light all LEDs at the same time. \$\endgroup\$ Apr 24, 2012 at 10:19
  • \$\begingroup\$ CharliePlexing shouldn't require a 1/100 duty cycle. Just 1/11. Click on the circuit-demo link I provided. It's for an effectively 4x3 grid using four pins, each of which has a toggle switch to ground and (if not grounded) a momentary switch to VDD. \$\endgroup\$
    – supercat
    Apr 24, 2012 at 13:29
  • \$\begingroup\$ ah, I see what you did there! Neat trick with those transistors. this allows multiple LEDs to be used at once. \$\endgroup\$ Apr 24, 2012 at 14:06
  • \$\begingroup\$ @noah1989: It certainly helps with brightness, though for a 10x10 matrix if you have 25mA port pins it might not be strictly necessary; I've seen some LEDs which were really bright with 2.5mA. I find it interesting that all the discussions of Charlieplexing seem to think of an ad hoc matrix which is driven one LED at a time, when row-wise scanning is in fact fairly straightforward if the LEDs are arranged as indicated/described. I'm not sure Charlieplexing is necessarily a huge win versus using shift-register driver chips which can supply adequate current without external transistors... \$\endgroup\$
    – supercat
    Apr 24, 2012 at 15:36
  • \$\begingroup\$ ...and regulate column current without external resistors, but there is some elegance to the fact that the number of wires going to a board with "just" LEDs can be reduced (note BTW that on the circuit shown, the amount of current drawn from the CPU supply/pins could be reduced slightly if one has the resistors only connect to columns and transistors only to rows, but overall current consumption will not be affected by having them connected; since the CPU pins are being used to source a lot less current than they're sinking, it probably doesn't really matter. \$\endgroup\$
    – supercat
    Apr 24, 2012 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.