I have an Arduino DUE, that is based on an Atmel SAM3X8E ARM Cortex-M3 CPU. It has 54 Digital I/O. It works on 3.3V.

I'd like to use it to drive individually 50 LEDs (for instance 50 optocoupler to replace a keyboard).

I know that the total DC Output Current on all I/O lines is 130 mA. So I think I should use a transistor or something to drive such a big amount of LEDs.

I'm not an expert on electronics and I'd like to know which component to use (even I think a darlington transistor should be ok).

Till now I'm driving the infrared led with a BC547 but I think I should replace it… Some hint?

  • 1
    \$\begingroup\$ why are you unhappy with the BC547? There's nothing wrong with it in this application. \$\endgroup\$ – Brian Drummond Jan 6 '15 at 18:13
  • \$\begingroup\$ 50 LEDs driven by a BC547 does not require more then 130mA ? \$\endgroup\$ – nkint Jan 6 '15 at 19:15
  • \$\begingroup\$ 50* the base current you need for a BC547 driving a LED can be MUCH less than 130mA. 1mA each or 50mA total is perfectly adequate. The current you need from the power supply is a different matter, but the BC547 isn't the problem there. \$\endgroup\$ – Brian Drummond Jan 6 '15 at 19:46
  • \$\begingroup\$ I'm using the 3.3V pin from the board for the power supply of all the BC547 and it can supply 800 mA from that pin. Is it enough? Do I need an external 3.3 power? How can I calculate it? \$\endgroup\$ – nkint Jan 6 '15 at 20:20
  • 1
    \$\begingroup\$ If you aim for 15mA or less in each LED the LEDs take 750mA leaving 50mA for everything else. (15mA ought to be more than enough, 10mA ought to work an opto so I'd aim for that.) \$\endgroup\$ – Brian Drummond Jan 6 '15 at 20:23

There are multiple ways of effectively (less pins- more leds) driving 50 LEDs.

Here are some

I am sure you would not want to use all I/O pins of your Arduino for controlling LEDs only :)
Your question is kind of unclear.

  • \$\begingroup\$ Sorry but.. why not? What is wrong with using all I/O pin? \$\endgroup\$ – nkint Jan 6 '15 at 19:16
  • \$\begingroup\$ You can use 50 I/O for driving 1.1258999e+15 LEDs and you can use 50 I/0 for driving 50 LEDs. It is up to you. \$\endgroup\$ – Triak Jan 6 '15 at 19:21
  • \$\begingroup\$ Yes! I'm documenting on charlieplexing but please remove the last / character otherwise the link is broken \$\endgroup\$ – nkint Jan 6 '15 at 20:22
  • \$\begingroup\$ But in a case like this how to switch on both LEDs? \$\endgroup\$ – nkint Jan 6 '15 at 20:25
  • \$\begingroup\$ If you switch LED1 on and then LED2 on in a short period of time, the both LEDs will appear on. \$\endgroup\$ – Triak Jan 6 '15 at 20:37

If you want to keep the part count down, you can directly drive the 50 leds and the IR led's transistor. You just need to implement scanning, as in only have a few leds on at any given time.

Considering nice round numbers, you could have 7 groups of 8 (a byte). With each with a current limiting resistor set for 12~15 mA, you get a max of 120mA out. And at that point, you just cycle through in software through each set fast. Persistence of Vision make them look all on.

If course this uses every gpio you have, so it's not the best unless you have the pins to spare.


Your Answer

