# Calculating Voltage and Current after resistor from an Arduino Uno.

1. Dec 25, 2012

### sepoto

I have an Arduino Uno micro controller that operates at 5V and I'm doing some work with an LED. The positive leg of the LED has a 220ohm (1/4watt) resistor on it and goes into output pin 13 which produces 40ma @ 5V. My LED wants to have 2V @ 18ma. I'm not quite sure yet how to calculate the voltage and current after the 220ohm resistor yet and I really could use a little help out with the proper formulas. Thanks in advance for any commentary or answers...

2. Dec 25, 2012

### gnurf

1) What do you mean when you say that pin 13 produces 40mA @ 5V in this context? Please check your understanding of this statement against Fig 14-1 (I/O Pin Equivalent Schematic) and section 29.1 (Absolute Maximum Ratings) in the ATmega328 datasheet (http://www.atmel.com/Images/doc8271.pdf [Broken]).

2) With question 1) out of the way, you can assume that the LED will drop 2V across its terminals and from there figure out the voltage across the resistor. Hint: 220Ω will not necessarily give you the ID = 18mA you said you wanted, but it probably doesn't matter.

EDIT & FWIW: http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

Last edited by a moderator: May 6, 2017
3. Dec 25, 2012

### sepoto

http://arduino.cc/en/Main/ArduinoBoardUno

This is the actual specification of my board. It says:

DC Current per I/O Pin 40 mA

I have measured the voltage to 5V with a volt meter coming out of the pin 13. I can't seem to get an accurate OHMs reading from my home depot IDEAL volt meter for some reason.

In this case the 220 ohm resistor is on the positive lead coming out of pin 13 before any current actually reaches the LED so I am asking to remove the LED from the system at this point so we can talk about just the output of the pin and what is the correct current and voltage in the circuit after the resistor. If I can figure that out I should be able to re use the formula over again. Thank you for your reply and oh yes the led forward is 2V but I'm unclear about the forward current in ma.

4. Dec 25, 2012

### gnurf

Yes, I can see that. I'm asking you if you understand what that really means?

5. Dec 25, 2012

### sepoto

Out of pin 13 when my program instructs the controller to do so the output is 5V of force with 40ma of current that then hits a resistor and after the resistor there should be less current and also less voltage I think but I do not know how much yet which leads me to ask the question. The circuit is completed to the ground pin.

6. Dec 25, 2012

### Staff: Mentor

No. As gnurf was trying to clarify, you are not understanding yet how to think about or describe voltages, resistances and currents. That is totally fine -- you are here asking questions to learn. And that's why we come here -- to help you learn.

The output specification of the uC pin is a typical specification for a power supply or a logic drive pin. It specifies what the output drive voltage is (the open-circuit drive voltage) and what the highest drive current is. You usually don't get both at the same time, because the voltage source has a finite output resistance. So usually the more detailed specification would be that the open circuit voltage is 5V, but that falls to something like 4.5V at the maximum output current.

So to figure out what the appropriate series resistor is for driving the LED, you would first start with the Vforward for the LED at its specified current, and then use the difference between that and the 5V supply to calculate the series resistor to drop the extra voltage at that current.

You can see then that if you are using an LED with a built-in resistor of 220 Ohms, that will result in an LED current less than the nominal rated current for that LED. It's close enough though that you may not notice the decrease in brightness.

Does that make more sense?

7. Dec 25, 2012

### sepoto

Thank you so much for this depth of knowledge you are providing. To begin with I had calculated by simple law of Ohms. The potential of the circuit I had calculated to 5V and my volt meter agrees with you that the true potential is a bit less than that. In any event 5V & 220ohms = .022~A or 22~ma. So then even the same calculation for 4.5V yields 20ma~ which is still more than the 18ma required by the spec of the LED. It's not that I don't believe you in that you are saying that the LED will be under juiced it's that I don't fully see how yet.

8. Dec 25, 2012

### Staff: Mentor

Not quite right yet. You forgot to include the LED forward voltage drop.

If the LED typically drops 2V, then given a stiff 5V supply, how much voltage is dropped across the series resistor? And if that resistor is 220 Ohms, what is the maximum current that the LED will see?

And as a better approximation, look at the datasheet for the drive gate, and what is the voltage drop for it at the calculated LED current? So that will lower the actual LED current a bit more.

You can keep iterating, factoring in the drop across the drive gate for the LED drive current, but usually you can just do the calculation once or twice to figure out the LED series resistor to get most of its brightness without overdriving it.

Closer?

9. Dec 25, 2012

### sepoto

I see your point about the voltage drop however in this case the out pin of the LED leads to a ground so if my understanding is correct then the voltage drop is not relevant in this case because power never circles back around it gets sent out into the environment to the ground. Is that not the case?

Also what are you referring to when you are talking about the drive gate? That is new terminology for me.

10. Dec 25, 2012

### Staff: Mentor

No, sorry, your post makes no sense. I think the translation software is part of the problem. I'm not sure how to fix that.

The drive of the LED is this: The output of the microController (uC) is a voltage source in series with its built-in output resistance, the same as any power supply or voltage source. The load is the series LED voltage dropping resistor and the LED.

Assume that the forward voltage drop of the LED is relatively constant versus forward current, and call that voltage 2V. Then there is 3V of voltage drop for the LED current to drop across the output resistance of the voltage source / gate plus the series LED resistor.

If the LED Vf is 2V and the open circuit (no load / zero output current) voltage of the voltage source is 5V, then there is 3V left over to drop across the source resistance of the supply (Rs) and the series LED resistor Rled. If you want 18mA of LED drive current, what is a good guess for the series resistor with 3V across it...?

11. Dec 25, 2012

### sepoto

If I could the find a 165 ohm resistor that would be right on target to 18~ma if I'm correct. I see how you have factored this now. I have learned a lot from this and I thank you very much!

12. Dec 25, 2012

Good job!