# LED matrix design

I am looking to make 16(columns) x 14(rows) LED matrix. Cathodes are connected to the columns and anodes are connected to the rows.

I want to drive rows(anodes) with I/O input expander MCP23017 which is controller via I2C. I am not using shift register because I need GPIO pins from microcontroller for other purposes. MCP23017 has 16 IO pins, which 14 I would use as outputs for LED matrix.

After MCP I would connect TLC59213 (LED) source driver. Interesting about TLC59213 is that it's connected to D flip-flop which requires rising clock signal in order to update signals. I am not sure how would I approach this. I need constant updates since this is LED matrix. Should I write small function in code which would create small pulse and connect one IO pin to TLC59213 clock pin? Then call that function all the time. Or should I create small circuit(maybe with 555 or such) which would constantly make pulses and connect it to the clock pin? Which of those is the best(best here means that update is quick anough you can not notice just by looking at it)? Is there a third, better, option?

On columns side(cathodes), I want to put ULN2003 sink driver just at the beginning of the column. Finally, there is TLC5940 LED PWM sink driver. I am putting ULN2003 because TLC is able to sink only 120mA. Taking in account that all LED of one column might be on at certain moment(16 x 15mA = 240mA), I added ULN2003.

Here I am having problems understanding whether do I need ULN2003 or not. Maybe is TLC5940 capacble of sinking short bursts of current so it won't harm him?

Also, the system is powered with 5V, while LED voltage is 3.3V. If all 16 LED would lit, it would need 240mA. According to Ohm law: R = U / I = (5 - 3.3) / 0.24 = 7ohm. So 7 ohm resistor will drop 1.7V when current is 240mA. But when only one LED is lit, resistor drops only U = I * R = 0.02 * 7 = 0.14V, so LED needs to drop 4.86V. Not so good! How should I approach this since the current is constantly changable?

EDIT:

After receiving some answer and analysing again, I choose to replace TLC59213 with just regulator PMOS and ULN2003 with NMOS. Simpler, wide available, even cheaper. Resistor problem stays still.

• Most LEDs have a very small peak to average max current rating making MUXing large strings impossible unless you accept dimmer than continuous avg current ratings. This is by design to allow the smallest possible sub-micron gold wirebond to the anode to not block light. So read the specs. To avoid the pitfalls of Vce(sat) with low voltage sources, use FETs for common Anode or Cathode drivers. Also efficacy declines above rated average current, so use the brightest HB LED's for the average current available. Also every LED has inherent ESR and is typically 15 ohms at 20mA for 65mW 5mm LEDs. Nov 29, 2016 at 14:17
• As well FETs have ESR called RdsOn and BJT's have an equivalent ESR called Rce(sat) at some Vce(sat) @ Ic Nov 29, 2016 at 14:19
• Thanks. I am familiar with RdsOn, but not really with LED ESR. I will switch to FETs. RdsOn for my N-FET is around 100mOhm, same for P-FET. What if I applied voltage only at one row and one column at the time, so only one LED is on? Then I would know current and needed voltage drop across the resistor. Is that a good idea? Nov 30, 2016 at 12:24

Several suggestions here.

1. For the clocking of the TLC59213 use one of the output bits of the I2C port expander that is unused. Each time you output command on I2C bus to update the 14 bits of row data simply set that extra bit to '0'. Immediately follow that with a second I2C command with the same row data but with the extra bit set to '1'. This provides the "clock" for you which is only needed when the row data changes.

2. For the issue with the resistor and varying voltage drop the easiest solution is to put a suitable series resistor for each LED in the matrix. Have the row drivers just source current without current limiting and the column drivers sink current without current limiting. This way each LED has its own current limiting and you eliminate the problem that you cited.

3. You mention running this all on a 5V supply. You may want to reconsider the supply voltage if you intend to keep using the TLC59213 for a row driver. It's outputs will drop as much as 2V or more when sourcing a lot of current due to the Darlington type output structure in the device. Be advised that discrete PNP or P-FET transistors may be a better choice. Or search out arrays of such component in a single package if you want to minimize discretes. But in the long run discretes may even be cheaper. The use of P-FETs would be advantageous because they can be used without additional resistors like would be required around PNP transistors. The discrete components should be able to provide operation as a saturated driver to the row with very little voltage drop from the power supply rail.

4. You should discard the use of the TLC5940 part. It is designed with adjustable current sink capabilities which have no applicability to matrix configured LEDs. I would recommend that you simply consider replacing that part with another of the MCP23017 port expanders to be the drive controls for the LED columns.

5. You may use the UL2003 as the current sinks for the columns of the LED matrix but be advised that these are Darlington type parts and will have a volt or more of drop across the output when they are sinking a lot of current. This will eat significantly into the 5V supply budget you have for the LED matrix. Be advised it may make sense to use discrete NPN or N-MOS transistors as the actual current sinks. The use of N-MOS FETs can be very convenient because they can be applied in this circuit without need for bias resistors as would be needed for NPN bipolar transistors. The saturated discrete drivers will have very low voltage drop.

• Okay, I would drop the Darlington drivers(ULN2003 & TLC59213) and replace them with NMOS and PMOS, respectively. Since I want to have ability to light LEDs at different intensity, I would stick to TLC5940. The resistor part really bothers me. It means that I would need to place 224 resistors, which increases price of product(they are quite cheap, but some time is needed to place 224 pieces of the resistors - no P&P). I would like to approach resistor problem in a different way.. Nov 29, 2016 at 15:04