I know this has been asked time and time again but bear with me as I am struggling to understand, so say I have this simple circuit here enter image description here

with 120v (dc for simplicity) as the input voltage and I have an led that runs on 3.4v and max 20ma ohms law states I=V/R so R=V/I, so R=120v/0.02a = 6000 ohms or 6k is this correct? how do I know the voltage drop across the resistor is correct, and what about power dissipated by the resistor? also, Is there an easy way to calculate everything at once?

  • 1
    \$\begingroup\$ Job interview question for a beginner. \$\endgroup\$
    – user76844
    Jan 7, 2018 at 19:58
  • 1
    \$\begingroup\$ Yes, I sometimes think every third question is about how to connect one or more LEDs. Maybe we should start a separate stackexchange forum for that. \$\endgroup\$
    – Oldfart
    Jan 7, 2018 at 20:04
  • 2
    \$\begingroup\$ yea but you gotta start somewhere \$\endgroup\$ Jan 7, 2018 at 20:07
  • 1
    \$\begingroup\$ David it is best choose a supply voltage close to the diode string drop voltage not waste so much in the series R. generally the Series R drops less than one diode drop with a carefully selected supply. (LED is a diode) \$\endgroup\$ Jan 7, 2018 at 20:11
  • \$\begingroup\$ yea, but I was thinking of using an led as a power indicator for "mains" \$\endgroup\$ Jan 7, 2018 at 20:13

4 Answers 4


If you are running an LED from the mains you do not want to run it at 20mA. Any modern LED will be painfully bright at 20mA and your resistor will waste too much power. Try something more like 2mA (though you can use the same calculations, just substitute the current you want)

R = E/I = (120-3.4)/0.002 ~= 120/0.002 = 60K, so you can use 62K.

Power is \$E^2\over R\$ = \$\frac{(120-3.4)^2}{62000}\$ = 0.22. So you could use a 1/4-W resistor, though 1/3 or 1/2 would be better- it needs enough voltage rating as well as power rating.

Incidentally, a modern LED bulb of approximately 60W equivalent-to-incandescent light output takes only 6-7W so if you ran your LED at 20mA you'd be drawing almost half of that power for (relatively speaking) very little light- that's how inefficient a dropping resistor is.

If you are using the mains with a high voltage diode in series (and preferably another diode across the LED) you'll need to double the current to get the same brightness, so the resistor will be about half- say 30K, but the power dissipation will stay about the same. I'm ignoring the 11% difference between RMS and average for the purposes of a rough calculation.


You need to adjust the formula for the forward voltage of the led.

R = (Vs - Vf) / If

And wattage is simple. W = V * I

  • \$\begingroup\$ what are Vs, Vf and If referring to? \$\endgroup\$ Jan 7, 2018 at 20:05
  • \$\begingroup\$ Source voltage, forward voltage, forward current. \$\endgroup\$
    – Passerby
    Jan 7, 2018 at 20:05
  • \$\begingroup\$ forgive me for being a noob but what do those refer to \$\endgroup\$ Jan 7, 2018 at 20:08
  • \$\begingroup\$ If you calculate the resistor for 120V and for 116.6V, then the difference is so tiny, it's not worth bothering about. \$\endgroup\$
    – Simon B
    Jul 23, 2018 at 12:35

First subtract the LED forward voltage from supply voltage. R = (120 V - 3.4 V) / 0.02 A = 5830 Ohms. The closest one matching is probably 6k2. To figure the required power handling: P = I^2 * R = 0.02 * 0.02 * 5830 = 2.323 Watts. This is the power your resistor must endure.

  • \$\begingroup\$ Use English numerical notation. Because 2,323 Watts is not 2.323 Watts. \$\endgroup\$
    – Passerby
    Jan 7, 2018 at 20:02

To limit LED current, you can use the following approaches:

  1. Use a resistor to limit the current. Since most of the voltage will be dropped by this resistor, most (about 99%) of the power will also be dissipated by the resistor. Since there is no energy storage in the circuit, the dissipation for the entire circuit will be the mains voltage times the chosen LED current.
  2. Use a capacitor to limit the current. The capacitor will periodically store and release energy, so this circuit has the possibility of being far more efficient. In theory, the LED would be the only dissipating element.
  3. Use a combination of resistor and capacitor to limit the current. Most of the reason for considering this option will arrive a little later on in the discussion below.

Each of the above possibilities carries with it yet another problem. While the AC mains supply may provide the needed current for the LED in one half of its total cycle time, during the other half the voltage will be arranged so that the LED is reverse-biased. This means the entire mains voltage may be presented across the LED itself. If the LED cannot withstand this voltage well, it may cease to function (and/or explode.)

A simple idea would be to provide a bridge rectifier so that the LED is always forward biased in the circuit. So I'd like to recommend that you consider the addition of a bridge rectifier.

Also, I'd like to recommend that you consider the use of both a capacitor and also a resistor being added to the circuit. The resistor will perform the function of a safety fuse and will add only a very small amount of unwanted dissipation to the circuit. The capacitor will help make the circuit far, far more efficient.

There are special considerations to all elements of the circuit.

Capacitors used for purposes such as these fall into two broad categories:

  1. Class X -- designed to fail as a short.
  2. Class Y -- designed to fail as an open.

These each have subcategories, but the most commonly used of each will be X2 and Y2. So we must select from those two distinct categories, I think. (For a web page discussing some of these details, see: Capacitor Class Types, X and Y.)

The choice of which to use depends on what you want to achieve. In this case, since I'm recommending the use of a fusing resistor too, you will want to use a capacitor of the X2 variety that is designed to fail as a short so that the fusing resistor will do its function.

One category of fusing resistors are flame-proof and called "metal oxide film resistors." Some of these have been carefully crafted so that they operate well as fuses, too. ERQA type code from Panasonic and PR01 from Vishay are two examples of such metal film resistors with fusing specifications.

These resistors support the inrush current for a short time, just fine. But will also have a guaranteed value of instantaneous power where they will safely fuse. (Typically, on the order of somewhere between a half-second to a few dozens of seconds duration at some rated instantaneous power rating.)

Panasonic writes something like, "Open within 30 seconds at 12 times the rated power." Vishay provides charts (look on page 12 or so.) Either way, you can use a specification like this to aid a circuit for an LED light attached to the mains system.

Let's say you want to supply approximately \$4\:\text{mA}\$ (RMS) to your LED and your mains power system is \$120\:\text{V}_\text{AC}\$ (RMS).

Looking at the above circuit, and ignoring the resistor value for now, we find that the reactance needed (using RMS values) is:

$$X_C=\frac{V_{AC}-V_{LED}-V_{BRIDGE}}{I_{LED}}=\frac{120\:\text{V}-3.4\:\text{V}-2\:\textrm{V}}{4\:\text{mA}}\approx 30\:\text{k}\Omega$$


$$C=\frac{1}{2\pi\: f\: X_C}=\frac{1}{2\pi\: 60\cdot 30\:\text{k}\Omega}\approx 100\:\text{nF}$$

That's a nice round value and easily picked up.

For the fusing resistor, we are limited by the range of values offered by suppliers. These tend to be values that are \$\le 560\:\Omega\$.

Go to page 12 of the Vishay datasheet and look at the chart on the right side regarding their PR01 types. To be well in the chart here, we need the power (with the capacitor shorted) to be \$30-40\:\text{W}\$ so that we are well within the hatched area. So let's select \$36\:\text{W}\$ as the goal and calculate the resistance as \$\frac{\left(110\:\text{V}\right)^2}{36\:\text{W}}\approx 336\:\Omega\$. A nearby value is \$330\:\Omega\$. So that's the value to select here, as this will guarantee that a capacitor failure will result in this fusing resistor to open up in the circuit.

Oh! Let's look at a schematic:


simulate this circuit – Schematic created using CircuitLab

(Note: Not all systems are handled with one side of the mains power connected to Earth ground -- parts of Japan comes to mind.)

The resistor is placed on the hot side and will disconnect the hot side of the circuit if the capacitor fails short. When the hot side has been disconnected in this way, the capacitor will also hold the entire circuit close to Earth ground, too. Since we are selecting an X2 type of capacitor, it is rated to do just that (if it fails.)

The resistor will normally dissipate under \$10\:\text{mW}\$. So the Vishay offerings regarding PR01 are just fine. You need to make sure you buy a class-X2 rated capacitor. And finally, you need to make sure the bridge supports the voltages present on the AC line. If you build it from diodes, use the 1N4007 types and get the maximum protection (though they are kind of large-bodied.) You may be tempted to use 1N4148 types. And they may work fine in this application. But it's better to get something often used with AC power and designed for the voltages involved. (Take note of the "peak reverse voltage" (PRV) / "peak inverse voltage" (PIV), as this rating needs to be above \$250\:\text{V}\$.)

So there you have it.

  • \$\begingroup\$ I think Im kinda getting it, but why have the capacitor on the ac side, why not after the bridge rectifier, or does it not matter? \$\endgroup\$ Jan 8, 2018 at 0:12
  • \$\begingroup\$ or wait is it just to limit the current? i'm getting confused over the simplest of circuits :( \$\endgroup\$ Jan 8, 2018 at 0:19
  • \$\begingroup\$ @DavidScheiber The resistor is used like a fuse and should be on the hot side. The capacitor needs to be designed to fail "short" so that it will cause the resistor/fuse to open up in case the capacitor does fail for some reason. It's just a protection scheme. If you place the capacitor on the hot side, I suppose you could use a Y2 type that should fail "open" and achieve it that way. But it is perhaps better to have the capacitor cause the resistor to open, and for the failed capacitor to ground the circuit too. \$\endgroup\$
    – jonk
    Jan 8, 2018 at 0:29
  • \$\begingroup\$ @DavidScheiber I should add that part of the complications come from safety issues and some from the usual power supply you are using, relative to the power supply needs of an LED. \$\endgroup\$
    – jonk
    Jan 8, 2018 at 1:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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