LED on AC Mains





Introduction: LED on AC Mains

About: "May the good belong to all the people in the world. May the rulers go by the path of justice. May the best of men and their source always prove to be a blessing. May all the world rejoice in happiness. ...

Important: Attempt only if proficient in working with AC Mains

A simple circuit diagram for a single LED on AC Mains 110v or 230 volts or even DC battery!!!

Step 1: Parts & Assembly


1. An LED - 5mm or 10 mm of any colour
2. A diode, preferably 1N 4007
3. A resistor of 2 watts or higher rating, of value anywhere from 22 kilo ohms upto 100 kilo ohms.
4. A two pin male plug (hollow)

Lower resistor values will give more brightness and higher values will prolong LED life. So choose the tradeoff, depending on requirement.

Lower wattage of resistor like 1/2 watt or lower will not do and may burn since they are meant for 6v DC circuits, not for 220v AC Mains.


1. Connect black anode of diode to negative of the led.
2. connect the resistor to the positive of the LED.
3. Connect the free ends of the diode and resistor to the male pins.

Done. See the attached pic for clarity.

Another circuit with the diode connected "across" the LED is also attached. A bulb base adaptor is used instead of a male pin.

It should work on 110v AC as well as 220v AC Mains systems.

DC Feature:

It will also work on any battery!!

Once again, read "Important" first line, in case you missed it....

Step 2: Edit: April 2014

This instructable is becoming popular and common sense tells me that despite the "important" disclaimer about being proficient in working with AC Mains, many new people may also venture into making one.

So few guidelines as below:

Since only two components are used, both of them have to be robust to withstand AC Mains load.

1. The diode that i have used is 1N4007.

This 1N4007 diode is rated for 1000 volts and hence is robust to withstand both 110 v AC as well as 220 v AC Mains that different countries follow. Its also readily available, i guess.

2. The resistor 22 kilo ohm and above, should be rated for at least two watts or higher.

This will ensure that it will not burn due to continuous operation. A resistor is a current limiter. It limits the AC Mains current and converts it to heat and thereafter dissipates it.

HEAT is a problem, since a capacitor is not used. However, since a higher wattage resistor is used, it will not fail. Lower wattage resistors will fail and can cause damage.

Please be responsible and thoroughly test your work.

3. I could not use a capacitor ( non-polarised ceramic capacitor for AC Mains ) since space was a constraint inside the male pin.

If possible, use one:

--> 0.22 uF or 224 K, rated for 400 volts, if you are on 220 VAC Mains
--> 0.47 uF, rate for 250 volts, if you are on 110 VAC Mains.

See my other Instructables, for projects that use more LEDs and therefore a capacitor. See also various other circuits in this website as well as internet.

Step 3: My YouTube Videos:

4 People Made This Project!


  • Planter Challenge

    Planter Challenge
  • Casting Contest

    Casting Contest
  • Make it Move Contest

    Make it Move Contest

We have a be nice policy.
Please be positive and constructive.


1 Questions

Hi, You wrote:

>The resistor 22 kilo ohm and above, should be rated for at least two watts or higher.

I'm in 120v country. According to another YouTube video (not yours) a 1N4003 diode and a 47K ohm resistor will work (with 120V) for small "power-on" indicator light.

I don't need terribly bright light...and I want to avoid heat. I'm adding indicator lights to light switches, similar to the attached picture...only brighter.

Can you please respond back with your thoughts on resistor rating? Thank you.


1/4 wattage you will definitely risk burning, since you are connecting to AC Mains. Also, 2 wattage or higher will not affect brightness. They are just for higher heat tolerance, during continuous use, like TV, Projector, etc...So for safety reasons use higher wattage, even with 47Kilo-ohms resistor with lower light intensity... hope it helps...

2 more answers

another clarification: The factory-made indicator light, as pictured uses a zener diode which I cannot read the small print on, and a 820K Ohm resistor, NOT a 82K Ohm resistor as I stated previously. My bad!

Clarifying the above question: The other YouTube video to which I refer above suggests using a 47K ohm resistor __at only 1/4 watt__! You're suggesting use of at least a 22K ohm resistor of at least 2 watts.

SO my questions are:

Is a 1/4 watt ok, or will I risk burning it up.
And if I go with at least 2 watts, will I reduce light output by 16x?

FWIW, the factory version uses a zener diode and a 82K ohms resistor, but it's not nearly bright enough.


if you want to connect a tiny light directly to the mains why not just use a neon bulb; simpler and safer e.g. http://docs-europe.electrocomponents.com/webdocs/1581/0900766b81581b67.pdf

1 reply

That's a brilliant idea (no pun intended). I just ordered 20! Much safer, and much easier. Thanks.

thanks for the nice piece of information. yes ! i have made...

Request to you kindly share same very easy circuit to power led smd strip roll but without transformers....

Actually i tried with capacitor.22uf(630v) Diode IN4007, resistor 4700(2w) and it worked but the light was dim not properly lit (I have used 24 led's of 2835 smd strip) .. please help...



1 reply

Two points :

1) You don't need an extra diode (1N4007) as mentioned, since the LED itself will do the rectification.

2) The Resistance should be 2 watts since the wattage drop across the resistor in that range, not because this is connected to AC. You can use a 1/4W resistor very well in ac if the current flow is limited further (by using higher value resistance). You can calculate the power drop across the resistor using the equation P = V^2/R = 230^2 / 22k = 2.4W. See that the power drop is more than 2W. To be on the safe side, use two resistors of 11K each and rated 2W each, in series, so that the power drop across each of them will be only 1.2W and hence lower than their rated dissipation.

2 replies

You could also use two 44K resistors in parallel. Half the current (and thus half the power) will go through each resistor. It would also be smart to put a 20 or 50mA fuse in series in case a resistor fails and loses it value (in the smaller direction).

You do need the diode because an LED can only tolerate about 5-6 volts of reverse voltage.

I made a signup on instructables only to thank you. It was successful, but i used 56k/1w resistor. I've enclosed this circuit inside a mcb box as an indicator. thanks again.

1 reply

Thank you! Very kind of you!

You'll find many interesting projects here...!

Hello there,
I have not found 2watt resistor of 22k ohm in my local stores. They have 22k ohm of 1watt and 100 ohm of 2watt.
Can I join them in series to make 2+1=3 watt?
**I have enough space to use capacitor. Should I use one?
I am new on these projects. Please reply.

Here is an electronics engineer's analysis of this instructable.


This design uses a half-wave rectifier to eliminate the negative half-cycles of the mains voltage, and a series resistor to limit the current. The brightness of the LED, and the power dissipated in the resistor, can both be calculated if you know the mains voltage and the value of the resistor. The formulas, written the way you would enter them on a calculator, are:


I = V / R / 2.22
P = V * V / R / 4000

I = average LED current, in milliamps;
V = mains voltage, in volts RMS (in most countries, either about 115 or about 230);
R = resistance of the resistor, in kilohms.


These formulas can be rearranged so you can calculate the right resistance for a given current or power dissipation:

R = V / I / 2.22
R = V * V / P / 4000


Using mains voltage = 115V and R = 6.8 kilohms:
I = 115 / 6.8 / 2.22 = 7.6 milliamps;
P = 115 * 115 / 6.8 / 4000 = 0.49 watts.

Using mains voltage = 230V and R = 27 kilohms:
I = 230 / 27 / 2.22 = 3.8 milliamps;
P = 230 * 230 / 27 / 4000 = 0.49 watts.


(a) LEDs are typically operated at 10~20 mA (milliamps) so in both of these examples, you will not get particularly high brightness out of them. If possible, use LEDs with high efficiency, i.e. high light output for relatively low operating current.

(b) The resistor should be rated for at least twice the expected power dissipation. In these examples, use a resistor rated for at least one watt.

(c) You may have noticed that the power dissipation in the resistor is the same in both examples, but the 230V example has only half as much LED current as the 115V example. This is correct. It's a consequence of one of the laws of physics, and ye cannae change those (Cap'n)!

(d) Heating in the resistor is proportional to the power dissipated multiplied by the "thermal resistance" to the surrounding air. The thermal resistance, and therefore the temperature, can be reduced by (a) using a larger resistor with more surface area; (b) thermally coupling the resistor to something with more mass - for example, using a rectangular resistor and squeezing it between the two sides of the plug; (c) there may be other tricks I haven't thought of.

(e) The polarity of the diode and the LED must match. Connect the anode of the diode (that's the end opposite the stripe) to the cathode of the LED (that's the shorter lead).

(f) The version of this circuit with the diode connected across the LED, instead of in series with it, will work but the resistor will dissipate twice as much power as in the main circuit (the one with everything connected in series). The calculations are for the main circuit.

(g) There are various ways to improve the performance of this circuit but none of them are as compact as this design.

(h) Yes, the LED will flicker 60 or 50 times per second (depending on your mains frequency). This is not normally noticeable, but you will notice it if you turn your head quickly from side to side while watching it. You will also see this effect with a clock that has an LED display. When you look straight at it, you probably won't notice the flickering.

(j) Many blue and white LEDs are ESD-sensitive; that means they can be damaged by electrostatic charge from your body during handling. Try to get the manufacturer's data sheet for the device you're using, to see whether it's ESD-sensitive. If so, keep the leads shorted together with a paper clip or conductive foam until the circuit is fully assembled.

(k) If the LED is ESD-sensitive, it can actually be damaged by ESD after the circuit has been assembled and mounted in a mains plug. To protect the LED, connect a low-value capacitor across it before you remove the shorting clip or foam. For example, a 0.1 uF (microfarad), 25~50V ceramic capacitor. To save space you can use an SMT (surface-mount technology) MLCC (multi-layer ceramic capacitor) such as these ones from Digikey:
http://www.digikey.com/product-detail/en/C1206C104K5RACTU/399-1249-1-ND/411524 ("1206" size code)
http://www.digikey.com/product-detail/en/C2012X7R1H104K085AA/445-7534-1-ND/2733606 ("0805" size code - smaller).

(m) Connecting this circuit to your mains supply may be illegal, depending on your country's regulations.

(n) Every point in this circuit must be considered live and dangerous. You must do everything possible to prevent any person from coming into contact with any point in the circuit. Some examples I suggest: (a) replace the screw that holds the socket together with a nylon screw and nut; (b) recess the base of the LED into the plug and/or surround it with glue to prevent any possible access to the LED wires in the area between the LED base and the plug.

8 replies

in current and power formula it was divided by 4000. What and why this division by 4000? Can you please explain?

Ignoring the voltage drops of the diode and LED, both are insignificant compared to the 230V AC mains, the RMS of the half-wave rectified pulsating DC voltage is ACVpeak / 2 = 162.64V.

When the resistor chosen is of 27k ohm, I = V / R = 162.64 / 27k = 6.02mA. Power dissipation of the 27k resistor, W = I^2 (R) = (0.00602) (0.00602) (27k) = 0.9796W.

I am afraid you may use the wrong formula to calculate the RMS voltage of the half-wave rectified supply. Full-wave DC(avg) is directly proportional to half-wave DC(avg), as the latter is half of a sine wave and is exactly half of the full-wave DC. When calculating RMS, each value has to be squared first, rendering the two not directly proportional any more.

... the RMS
of the half-wave rectified pulsating DC voltage is ACVpeak / 2 =

No. That would be true for a square wave, but it is not true for a sine wave. This should be clear from the following diagram, which shows an AC square wave and a half-wave-rectified square wave.


The square wave is unique in that it completely "fills up" the half-cycle-width area. The mean and RMS voltages are therefore half of the peak voltage.

A half-wave-rectified sine wave does not fill up the whole area, i.e. the area under the curve for each half-cycle is less than 100% of the area available, so the mean and RMS values are obviously significantly less than half of the peak value. Neither the mean voltage, nor the RMS voltage, of a half-wave-rectified sinewave is half the peak voltage. The numbers can be calculated using the formulas given in my earlier post.

When the resistor chosen is of 27k ohm, I = V / R =
162.64 / 27k = 6.02mA. Power dissipation of the 27k resistor, W = I^2
(R) = (0.00602) (0.00602) (27k) = 0.9796W.

This formula is wrong because of your earlier incorrect assumption.

Full-wave DC(avg) is directly proportional to
half-wave DC(avg), as the latter is half of a sine wave and is exactly
half of the full-wave DC.

That is true, but not relevant to this case. We are not comparing half-wave- and full-wave-rectified voltages; we are calculating the mean and the RMS voltages of a half-wave-rectified sinewave.

I did mention in point (g) that there are ways to improve the design. Using full-wave rectification is one of these.


When using Ohm's Law, V = IR, the value used for V should be the RMS value of the applied voltage for any wave forms including DC.

From a book I read, Vrms of half-wave rectified sine wave = Vpeak / 2.

The reasoning: for Full-wave Sine Wave, Vrms = Vpeak / SQRT(2)

Squaring both side, (Vrms)^2 = (Vpeak)^2 / 2

Half-wave rectified sine wave is exactly one-half of the full-wave sine wave, therefore, for Half-wave Sine Wave, (Vrms)^2 = [(Vpeak)^2 / 2] / 2

= (Vpeak)^2 / 4

Taking square root on both sides, Vrms = Vpeak / 2 for half-wave.

It sounds like you have under-calculated the power consumed. That explained for my last reply to you.

For full-wave square wave, Vrms = Vavg = Vpeak.

For half-wave rectified square wave, Vavg = Vpeak / 2,

However, Vrms = Vpeak / SQRT(2).

For a 10V full-wave square wave, the Vrms of its half-wave rectified form will be 7.071V, not 5V.

When using Ohm's Law, V = IR, the value
used for V should be the RMS value of the applied voltage for any wave
forms including DC.

Not necessarily. If you apply an AC voltage to a resistive (ohmic) load, and use I = V / R to calculate the current through that load, you can use the RMS voltage to calculate the RMS current, or the peak voltage to calculate the peak current, if that's what you want to know. You can even use the peak-to-peak voltage if you want to calculate the peak-to-peak current.

When you're calculating power dissipation though, it's only meaningful to use the RMS voltage. This is because for a resistive load, power is proportional to the *square* of the voltage (from P = V^2 / R), or the *square* of the current (from P = I^2 R), so when the absolute value of the voltage is not constant, you need to apply RMS calculation to the waveform (for every possible point in the cycle, square the voltage, then take the mean of those squares, then calculate the square root of that) to calculate the mean power it represents into a resistive load.

From a book I read, Vrms of half-wave rectified sine wave = Vpeak / 2.

The reasoning: for Full-wave Sine Wave, Vrms = Vpeak / SQRT(2)

Squaring both side, (Vrms)^2 = (Vpeak)^2 / 2

rectified sine wave is exactly one-half of the full-wave sine wave,

therefore, for Half-wave Sine Wave, (Vrms)^2 = [(Vpeak)^2 / 2] / 2

= (Vpeak)^2 / 4

Taking square root on both sides, Vrms = Vpeak / 2 for half-wave.

Hmm. "I'm beginning to think you may be right", as one of my father's co-workers used to say to him when it was finally obvious beyond all doubt!

Here's an explanation by example, that makes sense to me.

Take a full-wave-rectified sine wave with a peak voltage of 10V with a resistive load of 1 ohm. The RMS voltage is 7.07V and the load will dissipate 7.07W.

Now remove every second half-cycle, so it's the same peak voltage but only half-wave rectified. Now the load resistor will dissipate 7.07W for half the time, and 0W for the other half, so its dissipation is 3.535W, half what it was.

Because power dissipation in a fixed resistance is proportional to V^2 or I^2, a 2:1 ratio in power dissipation is a voltage (or current) ratio of sqrt(2):1, not 2:1.

The ratio between Vpeak and Vrms for full-wave is sqrt(2):1. Halving the power reduces the Vrms by another sqrt(2):1 ratio. The two ratios combined give 2:1, so for half-wave, Vrms = Vpeak / 2. As you said.

Comparing a full-wave-rectified sinewave with a half-wave-rectified sinewave, half-wave has half the power (into a fixed resistive load), and half the average (mean) voltage, but not half the RMS voltage! And the same is true for a squarewave, as you showed in the last part of your post.

This seems pretty counterintuitive to me, but I'm trying to get my head round it. In the meantime I plead no contest on your calculations relating to power dissipation in the resistors for this project. Using the values I calculated, they should be rated at more than 1W.

Thanks for the corrections!


Hi Kris, can you tell me why you have the 2.22 in your formulas as opposed to just R=V/I only please? Is it because of the ac?



The voltage of an AC sinewave can be measured in several different ways. Normally, the stated value is the RMS (root mean square) voltage.

For more information, see http://www.rfcafe.com/references/electrical/sinew...

In the USA, the AC mains voltage is around 115V. This is the RMS voltage. (It produces the same heating effect as a DC voltage of 115V DC into a given load.)

Using this as an example, several other voltages can be calculated from an RMS voltage of 115V.

The peak voltage is equal to RMS multiplied by the square root of 2, which is 1.414. So it will be 162.6V. The peak-to-peak voltage will be twice this, i.e. 325.3V.

The average (mean) voltage after full-wave rectification is 63.662% of the peak voltage. That will be 103.5V. With half-wave rectification, only half of the waveform is used, so the average voltage will be half that, or 51.8V.

Since all these voltages are in fixed proportions, you can calculate a fixed divisor value that will convert an RMS voltage directly to an average (using half-wave rectification) voltage. This divisor is the square root of 1/2 (about 0.707) divided by half of the 0.63662 from the average formula, which works out to about 2.22.

Therefore you can take an RMS voltage, divide it by 2.22, and you will get the average voltage that will be produced when the voltage is half-wave rectified.

These figures aren't exact because the AC mains voltage varies somewhat, and there are voltage drops in the diode and the LED, but they're close enough.


Thanks for the very thorough explanation; you should be a lecturer (if you are not already)!

Thanks for posting this. I wanted to know if it possible to use 22KOhm resistor of 1W capacity be used for this circuit. I have a vents in the housing where LED resides to ensure heat dissipation.

Can you guide if this will work ??