Transformerless power supplies circuit, cheatsheet and questions  - Page 1
Forum section: electronics / beginners

author: waste
author_rank: Contributor
timestamp: February 05, 2019, 01:59:45 pm
content: I have already built a dozen Transformerless power supplies with X2 rated capacitors and I 've been very happy about them (mostly around LEDs). They are cheap, easy to build, pretty nice in low amperage needs.The negative side is that everything should be enclosed as the whole circuit is potentially hot and not isolated.For the 230V people out there my little chart and cheatsheet goes as follows.for every 100nF you get around 7mA (10mA peak),so 150nF would be around 10mA (15mA peak)220nF around 15mA (22mA peak)330nF around 25mA (33mA peak)470nF around 33mA (47mA peak)the inrush current resistor would be 1/2watt and I use the following values:2.2K for 100-150nF,1K for 220-330nF and470Ω for 470nFIt's pretty nice to have a 680KΩ or 1MΩ resistor parallel to the X2 capacitor as it discharges the capacitor when plugged out (and prevents your fingers from getting shocked).Another nice addition to have is a smoothing capacitor. In my LTspice simulations I get the following results for 6LEDs in series (normal 20mA-30mA MAX LEDs)220nF X2 capacitor6μF smoothing capacitor (3.5mA min 20mA max)22μF smoothing capacitor (8mA min 16mA max)50μF smoothing capacitor (10.5mA min 14mA max)330nF X2 capacitor33μF smoothing capacitor (13mA min 23.5mA max)50μF smoothing capacitor (14.5mA min 22mA max)The circuit from LTspice and the graph is attached.Now my question part for the more experienced here. In the past 2 months I had 2 of them I gave to friends as gifts failing. It's a night lamp made of concrete and acylic and as everything is safely enclosed in concrete and acrilyc, its also a pain in the ass to repair))))Inspecting the failing circuits I found in both of them a failed electrolytic capacitor and a burned LEDAs the LED's are in series one dead and everything stops working. As I wrote in the beggining that I love this circuit because of its simplicity and durability. I have some of them running for years 24/7 with no problems whatsoever.So my next step is use the oscilloscope to see if the LTspice simulation actually makes sense in real life.But as I treat the whole circuit as potentially live, I want to be sensible and safe in my approach. I don't have a differential probe but Im in the process of isolating my USB osciloscope and I always use a hands off approach. I setup everything before a turn the circuit on take the measurment and then off again.In my bench I can be sure which wire is the Hot in the circuit and I attach the probe there, as it is a high impendence path. I also use AC coupling. But what stopped me from testing was that I could measure 60-70VAC between the aligator on the probe and the DC negative on my circuit. Not being able to explain it I turned for your helpMy 3 thoughts of how to approach this issue are.a) finish isolating the USB and powersupply of the oscilloscopeb) build a lamp in series on the hot wire for extra securityc) build a small isolation transformer using two 30Watt transformers I have around back to back.

author: OwO
author_rank: Super Contributor
timestamp: February 05, 2019, 02:13:05 pm
content: Because you have a full bridge rectifier AC ground is not DC ground. There is some AC potential difference between the two. Try grounding the AC supply in your simulation.

author: Cliff Matthews
author_rank: Unknown
timestamp: February 05, 2019, 02:20:47 pm
content: Nice guide. I don't usually go much above 50V but it'd be nice to see handy numbers for 120V people.

author: waste
author_rank: Contributor
timestamp: February 05, 2019, 03:03:49 pm
content: Quote from: Cliff Matthews on February 05, 2019, 02:20:47 pmI also don't usually go over 50V , the 6LEDs that are in my circuit total around 20V, and my biggest nightlam has 11LEDs in series which is around 33VQuote from: OwO on February 05, 2019, 02:13:05 pmIt's not in my simulation I see the potential, it's on the circuit in my multimeter when checking between the - of the LEDs and the aligator of the probeThat's why I haven't tried using the probe yet

author: soldar
author_rank: Super Contributor
timestamp: February 05, 2019, 07:57:21 pm
content: The only way I see for that damage to happen is that there was a spike in voltage and current and for that to happen R2 and C1 are suspect. Are they OK? How about the four diodes of the bridge? It may be that a high voltage transient caused a spike in voltage.R2 is not strictly necessary and may be a cause of failure so you might consider removing itC1 should be of adequate voltage. for 230 volt circuits I like to put 630 volt caps.After the bridge you could place a zener as extra protection.I cannot think how else it could have failed.In any case, I like to make things easily repairable for this very reason.

author: mariush
author_rank: Super Contributor
timestamp: February 05, 2019, 08:14:32 pm
content: You should check out DesignNote 001c : Transformerless Power Supply DesignLink :http://www.designercircuits.com/DesignNote1c.pdfStarting from page 6, you have formulas you can use to determine the values for all parts.For something more basic, even though the formulas are not quite 100% correct, you may want to check out Microchip's appnote :AN954 : Transformerless Power Supplies: Resistive and CapacitiveLink :http://ww1.microchip.com/downloads/en/appnotes/00954a.pdfLots of formulas and explanations ... here's a "cheat sheet" :Note that the example and data is for 110v AC , so with 230v you'd use a C1 capacitor rated for more than 250vA AC. And the example uses only half wave rectification.Also, output capacitance... depends on how much ripple you want... a good approximation can be done with formula C (farads) = Current (Amps ) / [2 x Mains Frequency x (Vdc peak - Vdc minimum desired) ]

author: Benta
author_rank: Super Contributor
timestamp: February 05, 2019, 08:40:06 pm
content: I've also built a lot of these capacitor-drop supplies, and a couple of points stand out.For 470 nF X2 drop-caps I use 330 ohmswirewoundfor R1 These are very robust when it comes to current surges, which you'll certainly have here when switching on. I never had any problems.R2 needs to be a high voltage type, I normally use Vishay VR37, 470 kohms.I also always use a 1 W Zener after the bridge to have a somewhat constant DC voltage.Now to your failure mode: what happens is, that one of your LEDs fails (probably due to a high current spike when switching on). When this happens, you have no voltage regulation any more, and the voltage over your filter cap rises until destruction.BTW: where's the current limiting for your LEDs? I see no resistor.To the 120 V, 60 Hz people: resize the cap as: (230/120) / (50/60) * CLeave the rest as it is.

author: AnalogSteph
author_rank: Newbie
timestamp: February 06, 2019, 12:35:13 am
content: Quote from: Benta on February 05, 2019, 08:40:06 pmI concur.The crux with dropper supplies is that they are inherently a highpass. Any voltage spikes will be attenuated much less than the 50/60 Hz mains and may cause damage. Worst case, turning on or off exactly when line voltage peaks.And yes, running LEDs on what's still mostly a voltage source isn't exactly recommended. I would consider implementing a shunt current limiter with one extra resistor and transistor. The resistor would be in series with the LEDs and sized such that R ~= 0.65 V / I_led,max, and the transistor quite arguably should be medium power with plenty of Vceo to spare. This should also work as a current regulator, but obviously dumping part of your current is not going to help efficiency for obvious reasons, and I would tweak the circuit for a decent balance.

author: not1xor1
author_rank: Frequent Contributor
timestamp: February 06, 2019, 08:19:01 am
content: a couple of notes:-1) it is better to use 2-3 resistors in series for discharging the input capacitor, you do not need a power resistor and low power ones have a limited range for the maximum voltage-2) for high current PSUs (i.e. 100mA or more) an active circuit for limiting input surge current allows to get a more efficient PSU

author: StillTrying
author_rank: Super Contributor
timestamp: February 06, 2019, 08:52:56 am
content: Quote from: waste on February 05, 2019, 01:59:45 pmStart the Vin Sine source with a delay of 90 Deg. to check for start up surges.On the odd occasion when you get an intermittent switch on or switch off, I think the peaks could be over 1A, mostly going into the 33u cap.

author: soldar
author_rank: Super Contributor
timestamp: February 06, 2019, 09:23:21 am
content: Max forward voltage for the LEDs is about 4.0 V. You could put a 5V zener in parallel with each LED and that way if one LED dies the rest will keep working.That circuit is putting about 20~22 mA through the LEDs which is a bit too close to the absolute max of 25 mA, especially if it is enclosed and cannot dissipate heat well. I would feel more comfortable bringing the current down to about 13~15 mA by decreasing C1 to about .22~.25 uF. That is the first thing I would do. Decrease current and increase refrigeration.As has been said, when one LED fails, there goes the capacitor (which is not really needed).Contrary to what has been said, this type of power supply approximates an AC current source, not voltage. Short the LEDs and you get a certain current through the short. Now place the LEDs and the current is almost the same while the voltage rises. Open the circuit and the voltage keeps rising.

author: waste
author_rank: Contributor
timestamp: February 06, 2019, 11:40:00 am
content: Thanks for all the interesting comments, I will try to adress and keep asking if you mayQuote from: Benta on February 05, 2019, 08:40:06 pmCan you elaborate in what way the wirewound is more robust? It attenuates the surge better for the rest of the elements, or it just more robust for itself. I never got a failing resistor. I think the failure mode you described is what most people agree onYou don't need a resistor for the LEDs, as the X2 Capacitor (C1) acts as the current limiting factor. Capacitive droppers to my understanding are current limiting devices. You can add up as many LED's as you want in series, it will still give the same amperage.Quote from: not1xor1 on February 06, 2019, 08:19:01 am1) about the low powered resistors (ex 1/4watt) . What do you mean they have a limited range for maximum voltage? that they fail easier (acting as fuse) or attenuating the surges better?Quote from: StillTrying on February 06, 2019, 08:52:56 amWould be using 5-6μF ceramic caps, or higher voltage rated electrolytic caps help prevent this problem??Quote from: soldar on February 06, 2019, 09:23:21 amputing a zener diode in parallel with each LED kind of defeats the simplicity of this project. Most of the times I use 3825LED's in 12V strips which are already connected in parallel and then you can connect them in series of 3s together (see attached pictures).Using lower current is a solid and good idea, I usually don't go over .22nF and the smoothing capacitor decreases the max current even more apart from minimizing flickering. Maybe even that is too much though and should have gone with 150nF X2 Capacitor.Quote from: soldar on February 05, 2019, 07:57:21 pmadding a zener in parallel I think it's not going to work with LED's so well as the zener should be really precise to the Vf of the LEDs . 1-2 volts higher and the LED s are toast anyhowEverything else apart from the smoothing capacitor is working nicely. R2 is "needed" if you dont want to get a little sting every time you take the plug out and touch the metal, I dont want to scare my friends with my presentDo you have any suggestions about how to probe correctly?Thanks again a bunch for all the help and ideas

author: not1xor1
author_rank: Frequent Contributor
timestamp: February 06, 2019, 01:19:48 pm
content: Quote from: waste on February 06, 2019, 11:40:00 amThe datasheet specifies the maximum working voltage.With higher voltage there is loss of insulation so you risk to burn all your leds.Probably that is affected by environmental conditions (temperature/pressure/humidity) too.

author: Zero999
author_rank: Super Contributor
timestamp: February 06, 2019, 01:54:42 pm
content: A transformerless power supply is a current source if the LED forward voltage is low, compared to the mains.My advice is to avoid them where at all possible. Use a switched mode power supply instead. The only reason to use a transformerless PSU is for cost, which perhaps makes sense at low power levels, but at more than about 50mA, a switched mode becomes more attractive, because decent, large capacitors aren't cheap.

author: Benta
author_rank: Super Contributor
timestamp: February 06, 2019, 03:00:34 pm
content: "Can you elaborate in what way the wirewound is more robust? It attenuates the surge better for the rest of the elements, or it just more robust for itself."They are much more robust when it comes to surge overloads.Think about it: if the circuit is switched on at max. AC voltage (~320 V), we're talking about almost 1 A in 330 ohms, as all caps are discharged.This works out as a peak power surge (very short, admittedly) of ~300 W. A wirewound will withstand this, a film resistor will not in the long run.If the resistor is 680 ohms, we're still talking ~150 W.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: February 06, 2019, 03:06:06 pm
content: If going for higher powers, check out the Power integrations Linkswitch series devices - costs may be comparable to larger capacitive dropppers and certainly smaller

author: waste
author_rank: Contributor
timestamp: February 06, 2019, 06:39:07 pm
content: Quote from: Zero999 on February 06, 2019, 01:54:42 pmI agree with you that for higher wattage, there are more attractive alternatives, but it's not only the cost that makes them attractive compared to the alternatives.If you go for a 5V switching power supply then you will have to either use a transistor to current limit your leds, or something like the AMC7235 chip, which usually comes in 350mA increments. Don't get me wrong I love how cheap and simple is the AMC7235, but it's not exactly efficient in 5V (it's mostly designed for li-ion batteries) and then you are constrained to 350mA which for many applications where you want ambient light, is too much.Then you can go for a switching current limited board like the chinese ones built around the BP2836 and it's many siblings that go around. They are cheap and give okeish stable output, but even the smallest ones are quite powerfull for ambient light and they are not exactly reliable .Additionally both solutions are quite bulky compared to a capacitive dropper and not so versatile. With the capacitive dropper you just add LED's in series and you are done.To sum it up, I agree that for higher wattage/current needs, other solutions are better and more suitable, but I came to love those capacitive droppers when I started using them 2 years ago (before I was kind of timid going around the 220V), that's why I want to make sure they will stay as reliable as my first designs that go on and on and onQuote from: not1xor1 on February 06, 2019, 01:19:48 pmSo using a 1/2watt or a 1watt resistor makes sense as it can take more abuse from higher voltages, the issue can be with the 1/4 1MΩ resistor that discharges the capacitor. Did I get it correctly?

author: StillTrying
author_rank: Super Contributor
timestamp: February 06, 2019, 07:22:37 pm
content: I doubt applying some 320V square waves is a very accurate way to simulate a bouncing or arcing switch, but I've simulated it that way anyway,using the values as in the 1st post.Greenand Grey is with the 33u smoothing cap disconnected,PurpleandYellowis with it connected.At least in this simulation a way to protect the LEDs from switch-on current spikesYellow, is to double the 33u value to 68uBlue.YMMV.

author: Benta
author_rank: Super Contributor
timestamp: February 06, 2019, 07:35:50 pm
content: "So using a 1/2watt or a 1watt resistor makes sense as it can take more abuse from higher voltages, the issue can be with the 1/4 1MΩ resistor that discharges the capacitor. Did I get it correctly?"No. The correct way is reading the resistor data sheet. That's responsible design methodology.Example: the Vishay VR37 high voltage resistors I mentioned previously are metal glaze high voltage resistors that will withstand pulse voltages up to 3.5 kV. Just to demonstrate: the tolerance colour band is yellow instead of gold to achieve this.Standard metal film resistors will accept 300 V peak, 75 V continuous voltage. Not what you want.EDIT: the resistors I use are actually VR25, apologies.

author: not1xor1
author_rank: Frequent Contributor
timestamp: February 07, 2019, 06:32:55 am
content: Quote from: Zero999 on February 06, 2019, 01:54:42 pma 1µF 275VAC X2 capacitor is around 25-30 euro cents (a few months ago I bought 10 for 2.51€ from TME)the main drawback is that unless you use some active circuit (e.g. a high voltage mosfet current limit) the surge current limitresistanceresistorwould add to the overall power loss and greatly affect efficiency

author: not1xor1
author_rank: Frequent Contributor
timestamp: February 07, 2019, 06:39:37 am
content: Quote from: waste on February 06, 2019, 06:39:07 pmthat was just an example...other manufacturers may produce resistors able to withstand higher or lower voltagesanyway in most cases a 1W resistor might work

author: mariush
author_rank: Super Contributor
timestamp: February 07, 2019, 11:43:23 am
content: As long as we're at the subject of non-isolated power supplies it's worth mentioning that there are also linear regulators that can work with up to 440v input voltage.For example LR8K4 can output up to 20mA, provided you don't exceed the power dissipation:https://uk.farnell.com/microchip/lr8k4-g/linear-volt-reg-0-02a-440v-to/dp/2448524So for example, let's say for a micro that uses only 1-2mA, you could simply have a diode for half wave rectification and let's say a 1uF capacitor, or the minimum to keep the input voltage above around 17v (the regulator needs 12v above output voltage for regulation)

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: February 07, 2019, 12:08:53 pm
content: Quote from: mariush on February 07, 2019, 11:43:23 amNot sure I can see much benefit of a HV regulator over a simple zener.

author: Gyro
author_rank: Super Contributor
timestamp: February 07, 2019, 12:32:56 pm
content: Quote from: Benta on February 06, 2019, 03:00:34 pmI would go the other way and use an appropriately rated fusible resistor. This sort of circuit tends to be difficult to fuse due to the low current - you don't want a very hot resistor for any significant time. Decent commercial circuits use flameproof fusible resistors to prevent the fire risk.

author: waste
author_rank: Contributor
timestamp: February 07, 2019, 10:30:20 pm
content: Quote from: StillTrying on February 06, 2019, 07:22:37 pmthanks for the graphs, so bigger capacitors with higher voltage rating are actually quite helpful. I'm actually building a small isolation transformer using 2 transformers back2back so I can test the circuit live and measure the transient volts (not the amperage though my clamp meter doesn't have a max function).how did you simulate the spikes? Do I get it correctly that square wave is kind of a worse scenario than sine wave? (Ive read that somewhere about generators)Quote from: not1xor1 on February 07, 2019, 06:39:37 amthat was just an example...other manufacturers may produce resistors able to withstand higher or lower voltagesanyway in most cases a 1W resistor might workThe same goes for higher rated resistorsQuote from: mariush on February 07, 2019, 11:43:23 amThat would be nice for voltage regulated applications (like the micro). Capacitive droppers are current regulated, which is exactly why I find them so sexy for the LEDs.Quote from: mikeselectricstuff on February 07, 2019, 12:08:53 pmGiven the fact that LEDs are quite constrained in the Voltage category a zener would have to be very close to their top rating (for the 6 LEDs example around 19-20Volts), to actually protect them from the surges. Am I interpreting you correctly?Quote from: Gyro on February 07, 2019, 12:32:56 pmThe flameproofness of my design is in the enclosure. No air and concrete all around the circuitMy main concern wasn't the resistor, but also the X2 capacitor which can fail open or closed if I am not mistaken.using higher rated resistors will make them also run cooler, isn't that true? I usually go for at least double the rating, so instead of 1/4 on the R1 I use 1watt resistorsagain thanks for all the input

author: StillTrying
author_rank: Super Contributor
timestamp: February 08, 2019, 12:25:27 pm
content: Quote from: waste on February 07, 2019, 10:30:20 pmI've added the .asc to the graphs post, it's very rough!"Capacitive droppers are current regulated, which is exactly why I find them so sexy for the LEDs."The cap drops the smooth sine wave, but any fast edges go straight through the cap, leaving the 470R and 33u cap/LEDs to do nearly all of the spike's dissipation.

author: Cliff Matthews
author_rank: Unknown
timestamp: February 08, 2019, 02:26:07 pm
content: Quote from: StillTrying on February 08, 2019, 12:25:27 pmMight this be the prime reason why so many "guaranteed for 20-years" LED bulbs last for approximately 2-days after the average bloke throws out his proof of purchase receipt?

author: StillTrying
author_rank: Super Contributor
timestamp: February 08, 2019, 07:22:26 pm
content: "Might this be the prime reason why so many "guaranteed for 20-years" LED bulbs last for approximately 2-days"I don't know. I bought some coloured GU10 1W or 3W LED bulbs about 11 years ago, a lot of the time I was switching them on and off by twisting them in the sockets, so quite a bit of flickering and arcing.Red, Green and Yellow are still OK, White has been on for about 7 years and is now very dim.Blue only lasted about 2 months before going VERY dim, but I kept it - just in case! I can't really see the few components in the glass neck, so I'll squash it in a vise.Squashed.

author: waste
author_rank: Contributor
timestamp: February 10, 2019, 09:54:18 am
content: Quote from: StillTrying on February 08, 2019, 12:25:27 pmAha! gotcha. So a an appropriate zener diode even if it's higher rated than the Vf of the LED's will help ease the stress on the capacitorThe problem with my live circuit is I have to create spikes myself (using a switch probably) as the 2 transformers will act as filters for the circuitQuote from: Cliff Matthews on February 08, 2019, 02:26:07 pmThere are many reasons LED die so quickly . First off the 20.000 hours rating goes for those red/green 3-5mm LEDs with top 20mA, on the others your milage may varyThen you have issues with the power supplies failing, but mostly with what I have seen the problem lies into bad heat management. Not only because of smaller spaces and smaller heatsinks, but also because the manufacturer wants to push as many watts as they can into the same amount of LED's, and that way they overdrive them creating even more heat in the process.Like StillTrying said, lower rated LED's tend to survive more. I had a 8watt GU10 failing after a month (I was sure it was going to end that way), but his 3watt siblings still go on with no problems.To my experience these new "filament " LEDs in sensible Wattages (4-6watts) tend to be quite sturdy

author: StillTrying
author_rank: Super Contributor
timestamp: February 10, 2019, 12:09:32 pm
content: "The problem with my live circuit is I have to create spikes myself (using a switch probably) as the 2 transformers will act as filters for the circuit"Having another switch between the transformers and cap dropper will probably do.Are you going for maximum LEDs protection, minimum components, or maximum efficiency.Using a 2N3904 as a constant current generator provides quite a bit of switch on and off current protection for the LEDs,Green.Blueis the mW dissipation in the 2N3904.It would still need some HV ~50V clamping across the 33u to survive very bad switch offs.In my endless flashing LEDs experiments I've put 500-800mA through 5mm LEDs for a fewusat a time, unfortunately I don't know how well they survive 200-300mA for a fewmsat a time.

author: waste
author_rank: Contributor
timestamp: February 11, 2019, 10:36:28 am
content: Quote from: StillTrying on February 10, 2019, 12:09:32 pmI did just that (added a switch), but the results were not spectacularThe spikes (after the cap) were very short and even though I couldnt measure current, I can't really see the LEDs being damaged by it.My aim is a) led protection (as they are not replaceable if they burn encased in concrete) b) low parts count. (consumption is pretty low anyhow less or close to a watt)In my test circuit I went for an X2 of .22μF (so around 22mA peak to peak with no capacitor) and a 100μF/100V smoothing capacitor I had around. For extra protection I added a 20V 0.5W zener I also had around (the 6LEDs I used are a bit lower voltage than on LTspice, all together they run at 17.6V for 15mA) and a 1watt in rush resistor of 1K. This created a quite a minuscule ripple of around 700mV and an average of 14mA. So in normal conditions this circuit will run for ever.After 30 minutes of use I checked the temperature of the components with the scientific method of the back of my finger (after powering off) and none was over body temperature.So to sum it up, bigger capacitors help with inrush currents, but not with spikes from other devices during operation. For that, a zener (better 1Watt) or a MOV you used in your own circuits is a better solution.Zeners are also quite nice for troubleshooting. If I have another failure and the LED dies first (that's the most accepted mode of failure from the people here), the zener will clamp the voltage to 20V and the capacitor won't blow.. I'm really troubled by the failure because at home I have 3-4 of these circuits running for years 24/7 no problems, and have given another 3-4 as presents in the last 2 years with no problems. Maybe my friend with the 2 dead ones lives in a particularly (electrically) noisy houseI'm really touched by your transistor idea, I remember reading about it in talking electronics and still use it from time to time when I need a specific amperage value from an LED. It was actually this type of circuit that made me understand that transistors are current regulating devices (before that I was treating them like Mosfets ie amplifiers/ switches)http://www.talkingelectronics.com/projects/200TrCcts/200TrCcts.htmlBut I always thought of it as a current limiter solution for batteries and other voltage limited devices (like 5V power supplies). So your idea is to use a bigger X2 capacitor (like a .33μF) and then current limit the LED's with the transistor. This way you can actually get away with a smaller capacitor.extra bonus, the transistor circuit can also be used with low voltage power supplies.I will play with ltspice a bit and report back, but for my current construction phase (I have promised 5 of these concrete cubes lol and want two for myself too) I will go without the transistor as most of the concrete cubes are ready (and have limited space for electronics) and I want to declutter my "lab" (i'm sure you have also experienced this urge)thanks again for all the input.

author: StillTrying
author_rank: Super Contributor
timestamp: February 11, 2019, 02:27:27 pm
content: The MOV circuit is not mine, it's an 11 year old 20 blue LED GU10 I 'opened.', I'll photo it if you want to see its simple construction.I don't think voltage clamping gives all that much protection with only a small number of LEDs in series, because a small increase in the LED voltage gives a much larger increase in the LED current.This is the best max. protection and min. components so far, - still using a transistor I'm afraid.It limits the now400V1kV spikes to peaks of40mA55mA through the5LEDs. R4 (10R to 22R) is not essential, it just spreads the spike's dissipation around itself, the 33u and TR a little bit.For long life I'd think you have to consider C1 and C2 losing about half of their capacitance, and the solder joints on TH LEDs seem to have a very high failure rate.I don't think any of these simple circuits would survive a continuously arcing switch, even a MOV would eventually give up.

author: waste
author_rank: Contributor
timestamp: March 13, 2019, 01:49:06 pm
content: I ve found the perfect candidate for a test. I want to install nightlights for our common workshop, a place with so much noise from switches and motors etc, that it will be a perfect test bed .On the one night light I will use the "classic" circuit improved with a zener for clamping and a high voltage capacitor.on the other one i will try your last circuit with the transistor. I have a question though. In the diagram you posted as also in the talking electronics page,http://www.talkingelectronics.com/projects/200TrCcts/200TrCcts.html#15the LEDs are placed in the collector side of the transistor, while in your LTspice file you have put the LEDs on the base side of the transistor.So in the LTspice file, if I get it correctly, the transistor doesn't regulate the LED current, just the overshoot current from the spikes.For added protection I will also add a 1watt zener on your circuit, after thee capacitorI will build both, hang them on the ceiling and see which one gives in first in this brutal environment (I designed them that way, that they will be easily replacable if/when fail occurs.

author: StillTrying
author_rank: Super Contributor
timestamp: March 13, 2019, 04:29:35 pm
content: "while in your LTspice file you have put the LEDs on the base side of the transistor.""if I get it correctly, the transistor doesn't regulate the LED current, just the overshoot current from the spikes."Yes, in theory.When the current through the LEDs and 22R reaches ~27mA the transistor starts to turn on and draw the extra current through its collector. In the plot added to post#31 I've increased the simulated mains spikes to 1kV causing the transistor to clamp 600mA.Once you get up to about 20 LEDs in series the voltage change between running current and over current becomes larger so a simple zener or MOV voltage clamp works well enough. Good luck.