I'm working on a project but I've hit a block now. I need to drive a total of 169 LEDs using 26 pins at worst case all may be ON at once. I'm afraid that this may fry the MCU since 200mA is absolute maximum rating for my ATmega2560 microcontroller.

Is there any way to increase source and sink capacity so that I can drive all 169 LEDs?

EDITED: I have already written the code so now am accessing the LEDs with 32 GPIOs and the new IC should be compatible with my existing code. I hope there is a solution.

  • 7
    \$\begingroup\$ Use the GPIO pins to drive transistors. \$\endgroup\$
    – Matt Young
    Aug 20, 2015 at 13:25
  • \$\begingroup\$ -ve of led is connected to MCU pins and some current will come into that pin which needs to be sinked or grounded sort of \$\endgroup\$
    – Lokanath
    Aug 20, 2015 at 13:30
  • 1
    \$\begingroup\$ How are you connecting the 169 LEDs to the 32 GPIO's? Row and column multiplex or ???? At least provide a word description that is clear and complete and ideally a circuit diagram. Diagram camn be hand drawn but should be `tidy and understandable and use a ruler to draw lines. \$\endgroup\$
    – Russell McMahon
    Aug 20, 2015 at 14:17

2 Answers 2


It's not the MCU's job to drive those many LEDs directly, so you shouldn't look into increasing your MCU sink/source capability. Instead you should make your MCU drive transistors that, in turn, would drive the LEDs.

One common configuration to achieve what you want is called a LED matrix, in which you have two sets of transistors (or IC drivers): one set controlling the rows and another controlling the columns. In this configuration, you'd usually multiplex the LEDs in the matrix, by having only one column turned on at a given time. At the same time, you'd turn on the specific LEDs you want in that column. Then you'd turn each column and row real fast to give the user the impression that the whole matrix is on all the time. That's what's called multiplexing and it's based on a property called persistence of vision.

In this setup, you'd normally use shift registers (such as the 74HC595) combined with Darlington transistor arrays (such as the ULN2003A), using one output pin per column and row. You only need 3 pins to control the shift registers (you can daisy-chain them together).

Here's a more detailed example on how to build a LED matrix:


Processor aren't design to drive component, they are design to command and give instruction. Your processor output a command that you must transfer to other circuit which his job is to drive the leds. A simple example is a circuit like that:

enter image description here

The enable pin is where you feed your MCU command. That circuit that I just give isn't enough to drive 169 leds, but the general idea is the same.

  • \$\begingroup\$ how do i turn on only d3 or d26??? if possible this is the solution to my problem \$\endgroup\$
    – Lokanath
    Aug 20, 2015 at 13:35
  • \$\begingroup\$ So you want to turn on each led individually? \$\endgroup\$
    – MathieuL
    Aug 21, 2015 at 11:26
  • \$\begingroup\$ yup,,,,i need individual access \$\endgroup\$
    – Lokanath
    Aug 21, 2015 at 11:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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