Stupid question about powering leds
-
I was thinking that I could stick connect a couple of red leds to an Arduino pro mini and put in some pumkins on halloween. But I am abit shamed to ask, how do you do this simple task? In the arduino tutorials they use one pin/led and use a 220ohm resistor when powering from a 3.3V arduino.
But if I want to use 4 leds that does not need to be individually controlled how would I connect them? and what resistors do I use?
-
@Cliff-Karlsson , welcome to the Ohm law.
220ohm resistor on 3.3V = 15mA current, enough to power up most of common leds.
Supposing your LEDs consume lets say 20mA each, and you want power 4 together, you need to provide 80mA instead, so U = R/I ==> 3.3 = R / 0.080 ==> R = 41.25 Ohms.
-- BUT --- Each arduino output pin can provide a maximum of 40mA, so if you connect the 4 leds into one single pin, the leds will not receive enough power to light up, or worst, the arduino's pin internal driver will burn (most probable).
In this case you have to either use more output pins (in order to distribute the load), or use a transistor to drive the output, like demonstrated by @hek in the LED Dimmer.
Hope it helps
-
Just wait until you run out of pins for the LEDs and you have to start charlieplexing. Crazy matrix computations but lots of fun!
-
@Cliff-Karlsson @rvendrame
You have to subtract the leds forward voltage drop before you use ohm's law. Look here eg. For some leds it could be rather high (~3V), which is very much if you're on 3.3V.
-
@Cliff-Karlsson Skip the Arduino and just go with red LEDs taped to coincell batteries. Should last thru Halloween. See this...