Illuminated buttons on a Leonardo… how many?

So I've got a Leonardo that I'm going to use as a keyboard control panel for a simulator game. For flashiness and coolness/trendiness, I'm using illuminated buttons. Each one contains an LED which suck down the standard 2(ish) volts, and 20mA.

My initial plan was to power them via the 3.3v port in parallel, but I'm looking at using 18 illuminated buttons and possibly a 16x2 LCD. So about 360mA for the buttons, and another 100 or so for the LCD screen. The LCD will be powered via the required pins (using a backpack) so am now concerned about shoving too many milliamps through the Arduino and making something go snap, crackle, pop.

Should I be looking at an external power supply for this, or would it be okay just drawing power via the USB?

Each one contains an LED which suck down the standard 2(ish) volts, and 20mA.

What are you talking about ? (the forward voltage ? (1.3V ?)

My initial plan was to power them via the 3.3v port in parallel, but I'm looking at using 18 illuminated buttons and possibly a 16x2 LCD. So about 360mA for the buttons, and another 100 or so for the LCD screen. The LCD will be powered via the required pins (using a backpack) so am now concerned about shoving too many milliamps through the Arduino and making something go snap, crackle, pop.

Forget about using the 3.3V for leds. In fact , in your case, forget about the 3.3V until you are more familiar with arduino electrical specs. You can find them on the arduino home page.

You can power up to about 800mA from the UNO +5V , and you NEVER use 3.3V for leds. (EVER). You use 5v and a 220 ohm resistor.

Yep, forward voltage indeed. To the best of my knowledge, the forward voltage of a red LED is about 2.2v?

And durp, forgot that the maximum current draw for the 3.3v is 50mA. But is there a limit on what current that 5v pin can provide, or as mentioned, should I use an external power source?

raschemmel is right about using the 5V for the LEDs, but a better solution is to see if you can power them from the 5V, 2 at a time.

To be sure, you should test the particular LEDs you have. Put two of them and a resistor (say 150 ohms or so) in series. Connect them to 5V and GND, so they light. adjust the resistor to make the LEDs as bright as you want them to be, then measure or calculate the current. You want to know the current so you don't draw too much from the 5V supply when you power all your LEDs.

The reason for putting two in parallel is that two LEDs (or 50 LEDs), take the same amount of current for the same brightness as does 1 LED. The only thing you have to do is to (a) supply sufficient voltage to satisfy the forward voltage required to light an LED, and (b) to choose the resistor to arrive at that current.

So, let's say the current required to light one LED is 20 mA. 18 of them, all in parallel will take 360 mA. If they are connected as I said above, they will take 180 mA for the same current.

Great point, Lar3ry - now that I'm using 5v rather than the 3.3v, I can set up the LEDs in an 8x2 array. But are you sure about the current wiring them that way? If my admittedly basic level of circuitry is right, it basically acts the same as having 8 LEDs, which would be drawing 160mA?

LEDs.png

Yes , your right, 2V. I don't know why I thought it was 1.3. Maybe I was thinking of a 4N25 optocoupler.

RED LED.pdf (97.7 KB)

Well, that's not gonna work. Hooked up a pair of LEDs using a breadboard as shown, and only one of them is lighting up. No clue why, the LEDs are fine, and there's surely enough voltage and current to power them?

Ahh, 'twasn't the LEDs, it was my @$@# breadboard. Soldering 'em up with a resistor did the job nicely. Hooray!

ubermick:
Great point, Lar3ry - now that I'm using 5v rather than the 3.3v, I can set up the LEDs in an 8x2 array. But are you sure about the current wiring them that way? If my admittedly basic level of circuitry is right, it basically acts the same as having 8 LEDs, which would be drawing 160mA?

Yes, I am absolutely sure of the current. Heck, it even looks like the Wizard agrees with me. 8)

The reason it works is this.

An LED, as you increase the forward voltage, will not start to conduct until it reaches a certain voltage (different LEDs will have different points at which they conduct. Red is about the lowest, Blue the highest, (in common LEDs). If you then increase the voltage supplied, the LED will still maintain the voltage it started conducting at. Yes, the voltage will rise slightly, but the current will increase a LOT. So, after the LED starts conducting, the only thing that changes is the current, and more current equates to brighter light. See the attached picture.

Putting two in series and increasing the voltage, will cause each LED to reach its turn-on point, the they will clamp the voltage to double the amount that one LED will. Let's say they are LEDs that conduct at exactly 2 volts. two in series will conduct at 4 volts, and you can calculate the resistor by subtracting 4 from the total voltage supply, and applying ohms law, so 5-4 = 1 volt left to drop, and to set the current at, let's say 20 mA, so R = E/I or R = 1/.20, or 50 ohms

led_curve.png

And nine 50 ohm resistors in parallel is equal to a single 5.55 ohm resistor . E= IR = 0.180A5.55 ohms = 1 V.
Power dissipated by a single 5.55 ohm resistor with 1 V dropped across it is P= IE = 0.180A * 1 V =0.180W = 180mW.
Power dissipated by the 18 leds wired in series parallel with two in each branch is P= I
E= 0.180A* 4V =0.720W = 720mW.
Total power dissipated by circuit = 0.72W +0.18W=0.9W = 900mW.