LEDs on AC mains

Started by canman, January 12, 2015, 11:59:02 AM

Previous topic - Next topic

canman

Hi everyone,

I know this isn't really stompbox related, but if you guys don't mind, I thought I'd ask a quick question.  If that's a problem, please delete this thread mods!

I want to wire up an LED to AC mains.  I'm not as familiar with AC as I am DC, so I found a few schematics for this kind of thing.  One includes a capacitor, others don't...the basic idea is from the hot AC main, you connect a 1w or greater resistor (any value as if you were using it for a guitar pedal), and connect it to LED+.  Then connect a 1n4007 (rated at 1000v) to the LED-.  My question here is, does this just connect to common (AKA neutral, right?)? 

Another quick question...I read that if the resistor is 1w or greater, than the capacitor isn't needed.  Is this true?

Thanks!

UKToecutter

It depends.
I use a bridge rectifier on the mains (4 x 1N4007's) via a series capacitor 470nf on the live terminal and a 220R 1/4W resistor on the neutral.

If you are in US you will need to recalculate the vales to suit your mains voltage.

Have a look at http://www.marcspages.co.uk/tech/6103.htm

This shows the maths and explains why this works and draws very little current.

Cheers
ShumannPLL BOM
Reserve Boards

canman

Perfect, thank you!  I am in the US, I'll have a look at that link.  Again, thank you!

davent

The circuit i used has a 1N4007/led/2w resistor in series across the hot/neutral. They suggested a 33k but that will vary a lot depending on the LED you choose. (120v mains.)
"If you always do what you always did- you always get what you always got." - Unknown
https://chrome.google.com/webstore/detail/photobucket-hotlink-fix/kegnjbncdcliihbemealioapbifiaedg

canman

The capacitor isn't necessary then?  I just don't want things to explode, haha!

So looking at the lifetime of an LED...what is the formula to calculate how long an LED will illuminate, based upon the resistor value?  Or is there even a formula for that?  I know it must depend on the LED specs...right?

UKToecutter

Using a capacitor stops you dissipating shed loads of power across a large resistor.
ShumannPLL BOM
Reserve Boards

R.G.

1. You are aware that any work on the AC mains carries the possibility of your instant death, right?
2. You are aware that any work on the AC mains carries the possibility of your work killing you or someone else long after you're done and it has worked, right?
3. You are aware that any work on the AC mains carries the possibility of immediate or possibly long deferred fires, right?

Don't do AC mains work unless you already know how to do this safely. The internet is NOT a good place to learn these skills.

With that out of the way, LEDs require a forward voltage of a few volts, and are not tolerant of any reverse voltage to speak of. LEDs are not visible until a small current flows through them, something under 1ma, and will burn out if they get too much current. The current limit is primarily thermal ( if it gets too hot, it burns up) and for the standard 5mm diameter devices, this limit is around 20ma for most LEDs.

You can power one from the AC mains several ways. Both involve extra components.

You can use one diode in reverse-parallel with the LED, then a resistor to limit the current. The LED lights on only one half cycle of the AC, so it blinks at the AC mains frequency, but you generally can't see that too well. There is a lot of power generated in the resistor. As an example calculation, if you have 120Vac/60Hz mains, the peak voltage on the line will be about 180V. You need to keep the current less than 20ma at the peak, and 10ma is good maximum to shoot for. 180V/0.01 = 18K. The resistor drops essentially all the voltage, so it's power is about 120Vrms, squared, divided by 18K, or 0.8W. A 1W would be barely tolerable. The AC line thinks this is mostly a resistor across it and sees no DC current to speak of, because the anti-parallel diode lets almost the same current flow both directions.

If you use two LEDs that are fairly closely matched or a string of diodes for the anti-parallel diode, this corrects the AC line's view that no DC is flowing (in fact, forces it to be true) and you can use a series capacitor with the resistor to limit the LED current. You'll still want to limit the peak current to [whatever], so the total combination of the capacitive impedance and resistor impedance at the power line frequency needs to keep the peak current down. This means the cap (which dissipates NO power) keeps some of the voltage off the resistor, which now dissipates less power.

You can use one diode in series with the resistor and LED. This lets current flow in the LED the proper direction, but the diode stops current flow the other way. The resistor dissipates about half the power, but the AC power line sees a net DC current flow. This version cannot use the series cap as a current limiting impedance, because caps don't let DC flow at all.

Finally, you can tack the LED across the + and - terminals of a full wave bridge and connect a series resistor or series resistor plus cap in series with the power line and the AC terminals of the FWB. The FWB simply MUST withstand the full AC power line peak voltage, so for 120V you must use 200V PIV or more, an for 240V, 400 PIV or more. More is highly recommended. 1A current is plenty.
The resistor/cap impedance/power calculations are the same for this verison.

Again, know what you're doing before starting this. Insulating or even stripping the wires the wrong way can kill you.

R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

canman

Holy smokes, thanks for such an in-depth reply!  I am aware of the dangers of working with AC mains, and honestly I'd rather not do it.  I'm really looking for a simple way to indicate on/off on a rocker switch, so if LEDs aren't a good way to go, I'm open to suggestions.

Also...could you elaborate on stripping/insulating wires and potentially killing myself?  I've wired up a couple of AC receptacles (solder lugs) using wire rated at 300v, this should be safe, right? 

davent

There are lots of illuminated rocker switches available that require no extra efforts to wire up on your part.
"If you always do what you always did- you always get what you always got." - Unknown
https://chrome.google.com/webstore/detail/photobucket-hotlink-fix/kegnjbncdcliihbemealioapbifiaedg

UKToecutter

Or if you want a separate indicator use a neon indicator.
ShumannPLL BOM
Reserve Boards

iq01221

If U'r doing a tube amp or some, U'd take a look at this:
http://www.valvewizard.co.uk/OtherStuff.html
Scroll down, there are some good ideas for use leds as indicators.

darron

I've used that marcspages way as per the link and it works great. I have 127 LEDs lighting my toilet room with that way :)


As R.G. said, don't zap anyone.


Ideal would be to find a lower voltage somewhere to tap into to use an LED more sensibly. Or use a NEON lamp as said which would run off mains.
Blood, Sweat & Flux. Pedals made with lasers and real wires!

canman

Thanks for all the suggestions.  I've been looking into the neon lamps, that's a pretty cool idea.  The rocker switch I'm using actually has a lamp in it, but I don't know how to get it to work.  It's an SPDT, one of the end lugs is gold, which I'm sure means something.  It's rated at 125v, so safe for AC use.  The datasheet shows that lugs 2 and 3 are to be connected with a resistor and some other thing that I didn't recognize on the schematic.  It looks like an "I" inside a circle (directly after a resistor-looking symbol).  Is that just a resistor or is there some sweet component I don't know about?!

darron

looking in google, there's lot of ways to show a neon, this kinda looks like an "I" ?



neons actually need a limiting resistor like LEDs too. maybe the data sheet might specify the current for the lamp?

neon lamps just run straight off mains. they just have a small resistor built into the package already :)
Blood, Sweat & Flux. Pedals made with lasers and real wires!

Processaurus

#14
Quote from: R.G. on January 12, 2015, 12:42:39 PM

You can use one diode in series with the resistor and LED. This lets current flow in the LED the proper direction, but the diode stops current flow the other way. The resistor dissipates about half the power, but the AC power line sees a net DC current flow. This version cannot use the series cap as a current limiting impedance, because caps don't let DC flow at all.

Thanks for the explanation, I'd seen the series capacitor trick with electronics that didn't have a transformer in their power supply, , but didn't understand why it worked.  It makes sense that it there can't be a net DC current through the capacitor, or it will charge up and block the current.  It is like the coupling cap on the input of effects, it cuts out low frequencies and lets the highs through.  So here it cuts out some of the 60hz mains power, how much depends on the load to the neutral conductor, like any other RC highpass filter.

JFace

Quote from: UKToecutter on January 12, 2015, 01:02:17 PM
Or if you want a separate indicator use a neon indicator.

This is what you want. No external parts, just hook up each wire to your line and neutral after the switch. I've done this a number of times, using this indicator:

http://www.mouser.com/ProductDetail/Chicago-Miniature/6010M3/?qs=sGAEpiMZZMsEIsGLxVc9kP3RKrOBgwkU

They have different colors, too.

Brisance

Why is everyone talking about line and neutral in the context outside of house electric wiring? AC cables are indicriminate and can be plugged in either way, so the context of line or neutral diminishes after the first wall outlet.

antonis

That's true and correct but it happens only when a load is connected to a wall outlet (closed circuit)...

If you connect something (even a short-circuit) between N and G it doesn't happen anything - as long as you have the H line unconnected  :icon_wink:

(that's the principle of mains test screwdrivers function..)
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

R.G.

Quote from: Brisance on January 13, 2015, 08:10:29 AM
Why is everyone talking about line and neutral in the context outside of house electric wiring? AC cables are indicriminate and can be plugged in either way, so the context of line or neutral diminishes after the first wall outlet.
Actually, the context does not change. The wires are still connected to either line or neutral. You just don't know which is which. But the distinction is still there: the electrons know which wire they're in.   :icon_biggrin:

What it really means is that YOU don't know which wire is which, and have to allow for it. That is why AC power cables are either three-wire and preserve the distinction, or two-wire and can only feed equipment that meets the double-insulation standards.

And this is one of those subtleties I was commenting on about needing to know before you work on AC mains wiring. It's easy to make some equipment work OK, but kill someone under some odd set of circumstances later.
R.G.

In response to the questions in the forum - PCB Layout for Musical Effects is available from The Book Patch. Search "PCB Layout" and it ought to appear.

Brisance

Quote from: R.G. on January 13, 2015, 09:43:11 AM
That is why AC power cables are either three-wire and preserve the distinction
Well at least in europe, the wall plugs are three wire and omnidirectional, with earth on the outside: