11
\$\begingroup\$

I created the following circuit on a breadboard and used the Arduino Uno 3.3V supply for the power supply:

               330 ohms         .......
 ------------------^^^^---------| LED |-----
 |                              ```````    |
 |                                         |
(3.3V)                                     |
 |                                         |
 |                                         |
 -------------------------------------------

It is mentioned on Arduino's website that the 3.3V pin has a 0.05A current. According to KVL this would give us 3.3V - (330 Ohms * 0.05A) - Voltage drop across LED = 0

According to the equation Voltage drop across LED will be negative and hence the LED should NOT turn on. However, on the breadboard the LED does light up... WHY? This goes completely against basic theory... is this normal? or is this only possible because I have made a mistake somewhere? =O

\$\endgroup\$
2
  • \$\begingroup\$ Any chance of replacing "arduino uno" with LED in the subject line? \$\endgroup\$ Commented Aug 6, 2011 at 6:30
  • 1
    \$\begingroup\$ You're almost there. Clearly the LED lights, so assume it has some voltage drop, or measure it, then solve for current \$\endgroup\$
    – JustJeff
    Commented Aug 6, 2011 at 18:09

4 Answers 4

18
\$\begingroup\$

The problem is that you do not (yet) understand the correct basic theory to apply :-).

However - congratulations for trying to work it out by yourself. Keep it up and you will soon become familiar with how to calculate it correctly.

Voltage and current and resistance can be modelled reasonably well by a water analogy. Voltage is similar to pumping pressure or "head" pressure in a reservoir, current is similar to current flow and resistance is similar to pipe resistance to water flow or the resistance to flow offered by a hydraulic motor.

SO the "error" with your model is assuming that the Arduino's current rating was what drove what happened, when what matteris is the voltage or pumping pressure.

If the Arduino's 3V3 circuit has a 50 mA rating this is the maximum current that should be allowed to flow, and not the amount of current that must flow.

Using your ASCII art circuit diagram:

               330 ohms         .......
 ------------------^^^^---------| LED |-----
 |                              ```````    |
 |                                         |
(3.3V)                                     |
 |                                         |
 |                                         |
 -------------------------------------------

The key equation here (one arrangement of Ohm's law) is

  • I = V/R

This says that current will increase with increasing applied Voltage and will decrease with increasing resistance. There is an extra factor thrown in here just to make things more interesting. LEDs act approximately like a constant voltage "sink". That is, as current is increased above some initial limit the voltage will not increase linearly with current - it will increase but at a lower rate than the current increase rate.

Rearranging that equation you get

  • R = V/I

This allows you to calculate the required resistor value needed to get a given current with a given available voltage. Before we can apply it there is a "gotcha" that we need to understand.

When operated in their design current ranges most LEDs have a reasonably limited range of Voltage drops. A modern white LED may start to emit light visibly with about 2.8V "drop" across the LED, have a drop of say 3V3 (= 3.3 Volt) at 20 mA (which is typically the maximum design oprating current for 3mm and 5mm leaded LEDs,) and burn out from excess current at say 3V8 across the LED. Typical figures will vary but that gives some idea. A modern red LED may have a forward voltage dropwhen operated at rated current of 2.5 V and an infrared LED may operate at 1.8V typical. When calculating LED current you can start by using the typical forward voltage drop from the LED's datasheet.

Typical red LED

Here's the datasheet for a typical modern red LED. It's a Kingbright WP7113ID. I chose it by finding the cheapest in-stock 5mm leaded LED sold by at Digikey. In 1's it's 11 cents US.

The datasheet says the forward voltage is typically 2.0V at 20 mA so I'll use that figure.

Operation at 20 mA

Because the LED has an approximately constant voltage across it we need to subtract that voltage from the available voltage which will "pump" current through the resistor. We'll design the circuit to give 20 mA - the LEDs rated maximum value. So our prior formula becomes.

  • R = (V_supply - V_LED)/ I

For V_LED = 2v0 and Vsupply = 3V3 we get

  • R = (3.3 - 2.0) / .020 = 1.3 / .02 = 65 ohms.

68 Ohms is the nearest standard "E12"* resistor value.

The voltage drop across the resistor = 3.3 - 2.0 = 1.3V - as above. The data sheet says that the LEd's Vf MAY be as much as 2V5 at 20 mA. Lets see what would happen if we used an LED with Vf = 2.5V at 20 mA.

As above I = V/R = (Vsupply-VLED)/R

Here we now use I = (3.3-2.5)/68 = 0.8/68 = 0.00176A ~= 12 mA.

So we designed for 20 mA but got about 12 mA in this case. Similarly, if the LED's Vf had been lower than 2.0V at 20 mA (as can happen) the current would have been higher than 20 mA. Overall the LED current could vary by > 2:1 due to production variations in the LEDs' Vf. This is the reason that "real" LED drive design use constant current sources, or circuitry approximating a constant current source. But, that's another story.

Operation with 330 ohm resistor

For your 330R resistor.

With LED Vf = 2V0. I_LED = V/R = (3.3-2V)/330 =~ 4 mA

With LED Vf = 2V5. I_LED = V/R = (3.3-2.5V)/330 =~ 2.4 mA

The datasheet does not say what Vf minimum is - only typical and maximum - but let's assume it is 1.8V.

I_LED = V/R = (3.3-1.8)/330 = 4.5 mA

So LED current can vary from 2.4 mA to 4 mA = a 1:1.666 ratio depending on LED Vf.

BUT the Vf in the data sheet was at 20 mA. As current drops Vf will fall "somewhat". Here's the characteristics of the chosen LED from its datasheet.

enter image description here

We can see that Vf is about 1.7V at 2 mA and about 1.78V at 4 mA so the assumed value of 1.8V is good enough for our purposes.


  • E12 - most common resistor series with 5% accuracy - 12 resistors per decade.

Preferred number series - search for E12, and then read the rest as well :-)

E12 specific - values and colour codes - more focused but less useful overall

\$\endgroup\$
5
\$\begingroup\$

You have to start with the LED voltage drop. It's that which determines the current, not the other way around. The reason is that the LED voltage is more or less fixed, while the current will be variable, and adapt to the circuit's demands.
KVL is indeed what you need. If the LED voltage drop would be 2V then the resistor voltage would be 3.3V - 2V = 1.3V, and hence the current in the circuit

\$I = \dfrac{1.3V}{330\Omega} = 4mA\$

So, if the voltage drop over the resistor would be too large it automagically adjusts to a lower value by lowering the current.

Note: The 50mA is what the pin can deliver. What it delivers in reality depends on what is asked by the circuit, and that should not be higher. And in our case it's a lot lower, so that's OK.


For most situations the above calculation, which supposes a fixed LED voltage drop, is sufficient, but sometimes you want a more exact answer, which takes the variable forward voltage into account. Most of the time you won't have an equation for current versus forward voltage, but only a graph. That means you can't solve it analytically. We'll see that it's easy to solve graphically.

Graphically determining LED current

The trick is in the red line. In the given graph this is the load line for a 100\$\Omega\$ resistor and a 3V supply. To draw the line you find the points where it intersects with the axes. The point on the X-axis is the power supply voltage, here 3V. The point on the Y-axis is the current if the LED voltage were 0V, so \$\dfrac{3V}{100\Omega}\$ = 30mA. You may have to extend the graph so that the Y-axis becomes visible.
The red line shows the current for a given LED voltage. If the LED voltage is 3V the current is 0. If the LED voltage is 2V the LED current is \$\dfrac{3V - 2V}{100\Omega}\$ = 10mA, etc. The function is linear, hence the straight line.
Now all you have to do is find the point where the load line intersects with the LED graph. So for the given situation the LED voltage will be 1.81V, and the current 12mA. It's that easy, no hassle with complicated formulas.


See also this question to find out how to calculate the resistor's value.

\$\endgroup\$
3
\$\begingroup\$

Two possibilities:

  • the current rating is what the sourcing device is able to handle without damage/overheating, but not something it takes measures to limit itself to

  • the voltage drop across the LED is higher than you think, hence the voltage drop across the resistor and the current through it are lower than 50 ma. A random LED data sheet I just dug up listed a forward voltage of 1.85v - that would give you a drop of 1.45v across the resistor and a current of 44 ma (which happens to be twice what is recommended for the LED I picked - you might want to consider a larger resistor - the old radio shack kits would use 680 ohms with a 3v battery supply)

If you have a voltmeter (or maybe the arduino's own analog input) you can measure the voltage of the node between the resistor and the LED and determine the respective drops across the resistor and LED, and thus the current from the drop across the known resistance.

\$\endgroup\$
1
\$\begingroup\$

The short answer:

The current will not be 0.05A simply because the spec for the supply says 0.05A; when a power supply spec provides a current, that's just the maximum you should try to take from it. What you actually end up getting for current depends on the load.

That said, you can get quantitative answers for this particular case from some of the nice graphs that have been given in the other answers.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.