Resistor Calculation

I am 100% new to using Arduino. I know the saying that if you give a man a fish, he can eat for a day, if you teach him to fish he can eat for a lifetime. Right now I only want to eat for a day! lol So I am not wanting to learn the formula to calculate the resistors to use in a project, only hoping someone will be kind enough to tell me what resistor to use. I have followed a tutorial to cause five leds to flash in sequence. It uses outputs 3 thru 7 on a nano board. It seems to works fine with the 1k resistors the tutorial recommended. Instead of using one led on each output, I want to use 3 leds for each output. Will I need to change the resistors?

Each led should really have its own current limiting resistor even if you have multiple leds on one pin. 1k resistors are fine for 3 leds being driven by one pin.

They have many Ohm's calculators online, some are better then others but that is your decision. Before you eat that assumed safe fish be sure it is prepared properly, scales etc are rough on the digestive system.

So do I understand the circuit would be like this, (using pin 3 as example) Pin 3 to resistor #1,other side of resistor to anode of led#1 - cathode of led#1 to resistor #2, other side of resistor to anode of led#2 - cathode of led#2 to resistor #3, other side of resistor to anode of led#3, cathode of led#3 to ground OR should each resistor be hooked to pin 3 then to each anode?

It doesn't matter if the resistor is in series with the anode or cathode as long as it's in series with the LED.

It's more common to have the resistor in-between the I/O pin and the LED but the electricity doesn't care. (2)

If you have an RGB LED (3 LEDs in on package with 4 connections) then the resistors should NOT be in series with the common pin.

With one resistor and multiple parallel LEDs the total current will be (nearly) the same(1) so it's always safe (with the 1K resistor) and the current will be divided (approximately equally) among the LEDs. With the current divided they will be dimmer but since our eyes don't see brightness linearly, they might still be bright enough.

The current may not divide exactly evenly so they may not be the same brightness. And if they are different colors, they won't be the same brightness. For this reason, it's standard practice for each LED to have it's own current limiting resistor.

When each LED has it's own resistor the currents add-up. With a 1K resistor and 5V (with about 3V across the resistor and 2V across the LED, that's about 3mA for each LED and with 3 LEDs and 9mA total, you are still OK.

(1) This isn't true with everything... It's the non-linear nature of LEDs that keeps the total current from increasing when there is a current-limiting resistor.

(2) I know you don't want to learn anything :smiley: but you can visualize current flow as water flow. And with LEDs it's the current that we're concerned about. The resistor "resists" current flow like a skinny pipe restricts water flow... It doesn't matter if we put the "skinny pipe" before or after the LED because either way the current has to flow through the resistor and the current through the resistor and LED has to be the same.

But if you cut a wire, current flow stops completely (infinite resistance) whereas if you cut a water pipe (no resistance) water flows-out all over the place! :wink:

Also with water, zero resistance isn't a problem as long as the water has somewhere to go... If you have zero electrical resistance you have a "short" and if there's nothing to limit the current you get excess current and something burns-up, or a fuse or circuit breaker blows, etc.

:woozy_face:
I cut my cable to see if it’s true but lost all my battery electrons.
:sob:

That is what is called a series circuit. It will work, sort of. You would only need one resistor in that circuit. It's value would be (5-(1.4*3)/15, presuming a 5v supply and a 15 mA current flow. (ya, I know, you didn't want to be exposed to the math, but it won't bite).
You could also put all 3 LEDs in parallel, each with it's own resistor; connect all the resistors to pin 3, all the LED cathodes to ground, and wire one LED to each resistor. Voila, a parallel circuit. The resistors should be (5-1.4))/5 mA, assuming 5V again, and assuming you want to split the current equally among the 3 LEDs; off the top of my head, I think that's about a 750 ohm resistor each.
Or, you could wire the diodes in parallel, connect the cathodes to gnd, and wire all three anodes to a 250 ohm resistor and wire that to pin 3.
If I've confused you, draw out the three circuits described, post the sketch, and ask a question.
C

I'd suggest this for 3 leds (of the same type) :

1 Like

Cruel Doug, cruel!

From the fish's mouth, no less. To paraphrase, "I don't want to learn ohm's law, so someone please calculate R = V / I for me"

The miracle is, this list is so full of helpful people, he hasn't been told to drop dead, shove off, or get stuffed. Crazy!
C

Most leds run bright on about 20mA, or 50 ohms per volt. Leds voltage varies from around 1.5v for red to 4v or more for white or blue. So figure 2.5v for the led from a 5v supply means you need to drop 2-1/2v. At 50 ohms/volt x 2.5v = 125 ohms or there abouts. Use 150-200 ohms for red / yel / green, 100-150 ohms for blue. Go high instead low to prevent overload.
Current is low enough 1/4W resistors are fine.

With 1k the led current will only be 5mA max, typically about 1/2 of that. The leds will be barely visible at 2mA

mA actually.

Too bright on many of these Chinese modules and not even near 20 mA, especially the generally unnecessary "pilot" LEDs which are there because the modules are supposedly directed at only experimenters.

Once you have a working system going there is no reason whatsoever for pilot indicators and even while prototyping they are generally a nuisance distraction.

It's also easy to lose track of the current consumption of these LEDs in the overall picture of a project; even 5 mA can add up on a dozen or more add-ons. But the flip side is, the diagnostic is useful when prototyping, and removal is easy later, with snips or a soldering iron.

C

The difference between 2 mA and 20 mA is only single order of magnitude. Light intensity perception is logarithmic - you will easily notice the difference but it is not huge. For most LEDs 20 uA will be "very dim but still visible" - unless you are at direct sunlight ofc.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.