I'm just a beginner, and though I knew Ohm's Law in high school, I never really knew what it was for, how and why you'd use it. So as I'm starting to work with the Arduino and simple circuits, there's some crucial piece I'm missing in my thinking. Here's my dilemma:
I'm having fun messing about with LEDs. From a PWM digital pin to a 220 Ohm resistor to a red LED and back to ground. Easy, right? I even understand (I think) the reason why it is this way: The LED doesn't use up all of the voltage being sent, so without a resistor to use up the rest, you'll blow the LED. 5V minus LED forward voltage of 1.8V equals 3.2V; wanting to throw 20 mA at it; plug those into the equation for Ohm's Law, turn it around and solve it means you need 160 Ohms of resistance to balance the circuit; 220 Ohms is the next step up that I have in my kit, so it can take a little more voltage than is sent, so it's a safe circuit and the LED will light at not quite full brightness. Okay, I get that. And with the blue LED I have, the forward voltage is 2.8V, so it would only need 110 Ohms resistance, but since 220 is still the nearest (above) that I have, I use the same one--but it doesn't need as much.
So that got me thinking (and thinking is where I went wrong, obviously)--if the needed voltage were high enough, you wouldn't need a resistor at all. LEDs wired in series means their forward voltage is added together (right?). Vf 1.8V * 3 = 5.4V, so voltage from a 5V pin would be fine and safe, should light all three LEDs at a little less than full brightness, without using a resistor. Well, that was my amateur thinking, anyway.
I wanted to light as many LEDs as I could, but since I had eight red LEDs and had made this design to use three, I just wired up two such circuits. Each was from a digital pin to one LED, series to another, to another, and back to ground. To wire two of these circuits simply, I wired the Arduino pins to the rails of a breadboard and each circuit to those rails, so both sets were drawing from the same 5V pin in the first iteration. I suspected the LEDs wouldn't be as bright as if they were on separate pins, but this was the first, simplest go-round. I set up a simple program to just send output voltage to the pin, like the Blink sketch without the blinking.
One set of LEDs didn't light (perceptibly, at least) at all, and the other set were dim. I switched some of the LEDs around, including from one circuit to the other, and still got the same result (that was in case one was wired backward, or one had burned out or something).
So I rewired the circuits so that each set of three LEDs was fed by a separate pin from the Arduino, but I got exactly the same result. Tried reversing the pins, tried different pins, same.
Using an Arduino Uno R3. Have tested the LED forward voltage with a multimeter, on several (if not all) of the LEDs when they were wired individually. I have checked the wiring several times over, including completely dismantling the circuit and rebuilding it from scratch.
-
Why would these two circuits, exactly the same in parallel, work differently? That is, I get that I've done something wrong and a set of three wired this way won't light as I'd intended, but why wouldn't two identical sets of three work (or not work) the same as each other?
-
Why does my (apparent) result end up the same whether both circuits are fed from one Arduino pin or each from a separate one? Instinct told me that with both sets sharing from one pin, they might be half as bright as with each set from a separate pin, but both wirings gave me the same result.
and of course, the main question:
- What about current am I forgetting, overlooking or misunderstanding in my design of the three-LED circuit in the first place? How do I figure how much current each LED is being given? I know that my thoughts about "just closely match the forward voltage to the battery voltage and you're good" were wrong, but why was I wrong? In applying Ohm's Law to this, starting with battery voltage minus combined LED forward voltage results in -0.4V, so I had no idea how to apply the equation.