Hi,
I would like to make a simple circuit powered from mains. I have never used more than 9V DC so I want to show it to you and ask if it works as I expect and if there are any problems. There is the circuit:
The main function is light the LEDs - Christmas are near ;-). The "DC out" may be used for powering a controlling circuit that may turn the lights off or something like that. I am aware the "DC out" will fall to zero some part of the cycle but it is not a great problem - since mains frequency is predictable the MCU may be prepared. But there are other problems.
I plan to use two back to back electrolytes. If I wanted to use single cap it needed to survive 230VAC - capacitors with so large bipolar voltage rating and decent capacity are more expensive than 2 standard caps + 2 diodes. Also only one of the 2 diodes is conducting and only for first halfperiod when the AC is connected - then no diode should be conducting. I have read the diode is not needed at all - the wrongly polarized cap will leak current so it will be as if there were the diode. But i am afraid - 230 V in wrong polarity looks like too much for a cap and it will destroy it - or is it possible the cap survives one short wrong polarity pulse without harm?
Next thing I am not sure about are transients, and what I see as more threat power glitches. When the cap is fully charged to +230V and I unplug it from the wall and then change my mind and plug it back at the opposite half period there will be more than 400V over the circuit. There will be only resistance of the polyfuse (~80 Ohm) + ESR of caps (???) - in theory around 4A peak current (shunted trough the poor Zener diode). The pulse would be brief - is it just a nuisance or will it kill caps/Zener or possibly LEDs because Zener will be unable to shunt the current? Should I add more resistance to limit the current?
Several issues come to mind - if you are in the US, we typically use 110 vac from the wall, but Europe etc. use 220 - recognize that is rms NOT peak - peak would be 220 * 1.414 = 311volts. The second (well, actually most important) concern is you are not providing any isolation from the mains. I always like to have a transformer in there to provide isolation from the mains - Christmas is not nearly as much fun if you manage to electrocute yourself (or someone else). :o
Wow, I always believed it is 220 (or 230)V peak here in Europe. Thanks for this.
I thought about isolation from mains and decided it is not so essential. Why exactly I want it? There is plenty of others opportunities to get electrocuted - every lightbulb is connected directly to mains. All cables to printer, computer, cooking ware are directly connected to mains. I am more afraid of possibility of fire if a wrong part fails like closed circuit.
Also I wonder if electrolytes would work here - I thought large ESR would be helpful to reduce current spikes in case of transients/glitches. But on the other side it would mean more heating leading to possibility the caps will be damaged. Maybe foil cap + resistor of known value would be better after all.
The 220v is an RMS voltage, not peak. If you are using rectifiers to feed capacitors in a power supply, with no load, they will be at the peak voltage which is NOT the 230 you mention (that is probably peak RMS), but at the peak of the sine waves which is 1.414 * RMS so for Europe, an unloaded supply consisting of a rectifier and capacitor running on 220 v RMS you will see over 300 volts output from the capacitor. As far as isolation goes, not sure how they wire it in Europe, but here in the US, with the 110, the black wire is supposed to be hot and the white is neutral (and ties to ground in the breaker panel). That is the way it is supposed to be (and polarized plugs should follow that). Unfortunately, that is not always the case - a friend of mine found that his basement had been wired by someone that did not know what they were doing and all the "neutral" connections were hot and the "hot" connections were grounded. A transformer for isolation prevents the possibility of you getting connected to the hot wire since the output of the transformer is relative to whatever you want (well, within reason and the isolation voltage rating of the transformer).
Smajdalf:
Wow, I always believed it is 220 (or 230)V peak here in Europe. Thanks for this.
I thought about isolation from mains and decided it is not so essential. Why exactly I want it? There is plenty of others opportunities to get electrocuted - every lightbulb is connected directly to mains. All cables to printer, computer, cooking ware are directly connected to mains.
Computers and cooking ware usually have a protective ground.
Not isolating from the mains can lead to high voltage on your 'DC out' connections.
see, for example
where there is enough voltage on the shield of a USB jack to illuminate a light bulb.
Well, yes - your circuit would light the leds.... but.
Anything running off live 240ac mains is a serious danger... you'd better be very sure what you're doing.
Your R1 might have to dissipate a lot of power and get very hot.
and what on earth is that diode/capacitor net on the mains input for? The fact you included it suggests to me that you don't, and you'd be better/safer off using premade psu's as suggested elsewhere...
A simple x2-rated capacitor would do a safer job. But I still wouldn't go there
How many amps do you need for your LEDs? How many LEDs? What kind of LEDs?
Commercial LED strings have two sets of LEDs in series, paralleled. Basically using enough LEDs in series to drop the voltage supplied while using the diode function of the LEDs on the other half of the waveform. It doesn't get much simpler than that.
Once you start making a power supply, you need to evaluate if you can make something smaller and cheaper than something like this, which is $1 and tiny and can give you 2A
I was inspired by this. Foil capacitors our local store has are more expensive, larger and with lower available capacity (and voltage rating) than electrolytes so I thought replacement would be handy. Maybe it was not so clever idea because (...).
And I am aware any part of the circuit may have higher than mains voltage - I know it cannot be touched while connected at no cost. There is plenty of similar devices here (i.e. lights for Christmas tree lights 30 years old - small bulbs connected in series powered directly from mains).
To power question I expect <10 LEDs will be powered with maybe 20mA. So R1 should stay cool. What happens when it is connected to mains after some time bothers me more - current for one whole halfperiod (10ms) may rush trough it - I have no idea what it can do to the components.
Smajdalf:
And I am aware any part of the circuit may have higher than mains voltage - I know it cannot be touched while connected at no cost. There is plenty of similar devices here (i.e. lights for Christmas tree lights 30 years old - small bulbs connected in series powered directly from mains).
Old xmas tree lights like that could not be sold these days. The UK fire brigade campaign for people to
chuck them out, due to the fire-risk they pose, and replace with LED ones. Most old mains lights would
fail current safety standards for both fire and electrocution risk I bet.
If you insist on going through with this, a schematic I reverse-engineered from a nightlight (US mains) is in reply #12 of the "Analog Nightlight" thread. You could use something similar as a base, though it won't be highly efficient.
OK, I have found the major flaw of this design. For anyone as slow as me there it is:
The circuit cannot draw more than very little power through the capacitor (~20mA average). Even if someone connects to the mains through the cap it should be safe - according to Wiki it shouldn't be able to kill you via hearth fibrillation (or burn skin or do something like that) - unless you lick it. When the cap starts leaking the fuse should blow up and break the circuit long before the cap can fail in short circuit mode (and even if it does abruptly the fuse should still protect rest of the circuit from burning). Everything looks nice apart from the $%$#$@# second connection to mains. NOTHING stays it way between the person and the mains here! Even placing another cap here will help little - with two caps in series one may fail without notice (who cares if LEDs are shining twice as intensive as last year) leading to dangerous circuit again... Still it looks so simple and elegant I am tempted to build it anyway for some other application. But now it is time to get a transformer.