Go Down

Topic: Resistor Placement and Value - Understanding assistance needed (Read 1 time) previous topic - next topic

KG1610

Hi All,

I am new to the Arduino world and new to Electronics
I am hoping someone can explain the following to help me understand whats going on.

What I would like to get more info on is the placement and Value of the resistors used in circuits.
let's use the following as an example and reference.

https://circuits.io/circuits/5145733-interactive-traffic-lights

How do you calculate the resistor value needed?
I understand we use Ohms Law - So the voltage of the Arduino is 5v and the current from the pins is 40ma so using Ohm's Law we would need a resistor with the Value of 125 ohms - is this correct ?

The Second Question is on the placement of the resistors

Why do you put the resistor for the Led before the Led - i.e Digital Pin -> Resistor -> Led -> Ground
in the same example circuit above for the Switch we put the resistor after the switch before the ground.
i.e 5v out -> Button -> Resistor -> Ground

Could you help me understand - links to video's i can watch to learn / an explanation would be great Thank you

MarkT

The resistor stops the LED or Arduino burning out.   Since the Arduino outputs 5V and the LED's forward
voltage is between 1.1 and 3.2V (depending on type/colour), the current would be unlimited without a
resistor to drop the excess voltage.

Without a resistor the internal resistance of the Arduino pin drivers (about 30 to 40 ohms) is the only
thing to limit the current, perhaps to 100mA or more, which is well above the absolute maximum current
for the pin drivers themselves as well as for the LEDs.

In a series circuit like the LED/resistor the order is irrelevant, everything is in series and thus has the same
current, the voltages sum to the same value whatever order the components are in.

The button circuit can be either way round too, though that reverses the sense of HIGH/LOW meaning
pressed/not pressed, since the Arduino is snooping on the voltage across part of the series circuit, ie
the order does then matter.

Kirchoffs current and voltage laws are simple, they should become second nature with a little practice and
thought.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

KG1610

Ok, Thank you.
Very interesting. I will go research some more.

Much Appreciated

Grumpy_Mike

Quote
Why do you put the resistor for the Led before the Led - i.e Digital Pin -> Resistor -> Led -> Ground
Their is no need to do this, it will work equally as well the other way round.

Quote
in the same example circuit above for the Switch we put the resistor after the switch before the ground.
i.e 5v out -> Button -> Resistor -> Ground
In the case of an input the resistor is acting as a pull down resistor making the input pin see a logic zero and then the button pulls the input up to a high that is 5V.

dougp

I understand we use Ohms Law - So the voltage of the Arduino is 5v and the current from the pins is 40ma so using Ohm's Law we would need a resistor with the Value of 125 ohms - is this correct ?
40ma is the maximum rated output of the pin. That doesn't mean you have to use it all, nor should you. The calculation should be made on the basis of what the LED needs to achieve a desired brightness. If that's even close to 40ma you need a driver capable of handling the desired current between the Arduino output and the LED (load). A rule-of-thumb resistor value for LEDs is 220Ω (at 5VDC). This gives a nice safe ~20ma for the LED to run on.

Limiting the current means everything runs cooler. And remember, heat is the enemy of semiconductors.
Everything we call real is made of things that cannot be regarded as real.  If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. - Niels Bohr

No private consultations undertaken!

tinman13kup

Quote
I understand we use Ohms Law - So the voltage of the Arduino is 5v and the current from the pins is 40ma so using Ohm's Law we would need a resistor with the Value of 125 ohms - is this correct ?
No. Not the way you are looking at it. The 40mA pin MAX only refers to the maximum current the pin can source. It is not used for any calculation on attached components, but is referenced AFTER to ensure that number is not exceeded. In practice, it is wise to stay well below this figure for reliability and longevity. Exactly how much under is subject to debate, some going down to 50%, while others push beyond the limits.

When you are figuring current limiting resistors, they are based on the voltage and the device you are limiting, which in your case is a led and a pull down. The led might ultimately be set to use 10mA (depending on the resistor you use), so you could put 2 leds in parallel and still only be using 20ma. 20mA is less than 40mA, so it still falls under the max limits.
Tom
It's not a hobby if you're not having fun doing it. Step back and breathe

KG1610

Thanks All - Mind Blasting
Loving this journey but I am realizing how much there is to learn

Very happy the Arduino Community is how it is  - without this I wouldn't get far and in a few years when I know enough i will do the same and share the knowledge.

KG1610

I have another question

Does a resistor use / consume the Current
or
just kind of blocks the flow of current ?


dougp

Everything we call real is made of things that cannot be regarded as real.  If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet. - Niels Bohr

No private consultations undertaken!

Grumpy_Mike

Quote
Does a resistor use / consume the Current
Yes it burns it off as heat.


kenwood120s

Yes it burns it off as heat.
... which is why you will also see resistors specified not only by their resistance but by their power handling ability. You need to ensure that the power dissipated (= I2R) is less than the rating of the resistor in Watts.
[gumby]I've got my head stuck in the cupboard[/gumby]

INTP

You are plugging in the wrong numbers. You don't throw in your source voltage.
Your source is 5v. You look up what you LED 'consumes' called the forward voltage. Subtract this voltage drop from your source. The remaining voltage is what you're dealing with in Ohm's law. The current is how much you want to pass through the LED. 15-20mA is the usual. Plug in that voltage and that current (in Amps) and you'll figure
There are numerous calculators online, some explain what each field comes from. Understand this before moving on.

WayNeDogg

The resistor stops the LED or Arduino burning out.
Hello!!

I am really fresh with Arduino and I just recently started with the Starter Kit projects.

I am really loving it and I am really willing to learn and fully understand each single process, therefore I apologize in advance for some stupid question I might raise.

My question is related to the first project of the starter kit (get to know your tools): I understand that the resistor is reducing the voltage in a circuit, in order the circuit (or, in this case, the LED) not to burn out.

As I trial, I tried to see what would have happened in the circuit if I removed the resistor. I expected the LED to light up much more and, eventually, to burn out; but actually it didn't happen. The only result was that the LED was not lighting up any longer.

Am I missing something here? How should I interprete this reaction?

Thanks a lot for your precious help!

W


Grumpy_Mike

Quote
I understand that the resistor is reducing the voltage in a circuit,
No that is incorrect. The resistor limits current, by itself it will do nothing to the voltage.

Quote
I expected the LED to light up much more and, eventually, to burn out; but actually it didn't happen. The only result was that the LED was not lighting up any longer.
Which sounds to me like it burnt out then?
When electronics go they can go fast, so that their is nothing to see.

Quote
As I trial, I tried to see what would have happened in the circuit if I removed the resistor.
You did replace it with a wire did you? If you just removed it then their is no circuit for the current to flow round.

Go Up