Mains Ac to Reg DC Cheep Chinese Way - Page 1
Forum section: electronics / projects

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 12:48:01 am
content: Cheep plug in the wall chinese and other devices eg. Timers, radio remote mains switches etc seem to use this circuit to drive micros,relays etc.Is there a name for this type of circuit and or a formula to decide the parts required?I would assume input AC voltage, hz and outpout voltage and and amps you would need for the formula.I am aware this is not isolated, that's fine for what i want to do with it and they require a constant ish load to operate. However I would like it to blow a fuse if it gets out of hand.Like many, I want to get away from AC mains as quick and cheep as possible without mucking around with switch mode modules etc nor a bulky tranny.I have also noticed that these "psu's" fail quite often, what the pro's and cons of these? BTW creads for the image go to circuits today

author: Psi
author_rank: Super Contributor
timestamp: October 20, 2013, 12:49:12 am
content: Transfomerless power supply, or capacitor mains powersupplyThere's nothing dodgy about them. They are very useful for systems that need to be small and have limited inputs/outputs. (Since they are not mains isolated you have to isolate the i/o)But obviously they can be designed badly/unsafe, just like any circuit.They work by current limiting the AC mains, usually in the 1-50mA range, then shorting it with a zener to clip the waveformCurrent always flows through the zener, weather you're using it or not, so they're not efficient but they are very small.The current limit can be calculated by working out the Capacitive reactance (Xc)(basically the resistance of a capacitor at a specific frequency)Xc = 1/ (2 x pi x F x C)F=frequency, so 50hz or 60hzC=value of the capacitor in farrdseg, for a 0.3uF cap and 50hz mains Xc= 10615 ohmscurrent = V/I so 230/10615 = 22mANote: For safety reasons the capacitor has to be X rated to be used like this.

author: niflheimer
author_rank: Contributor
timestamp: October 20, 2013, 12:54:45 am
content: There's only one pro to it - it's cheap as dirt. The cons ... well the most important one is that if the clamp zenner fails open instead of shorted you'll get ~ 150v through your load. Also it will be noisy as hell since there's pretty much no filtering on it - that capacitor is not big enough to suppress the 100/120hz ripple.

author: c4757p
author_rank: Super Contributor
timestamp: October 20, 2013, 01:01:31 am
content: Quote from: niflheimer on October 20, 2013, 12:54:45 amUse a backup Zener at a higher voltage. If your load has the capability (for example, a microcontroller with an ADC/comparator and an internal voltage reference), you could even detect the switch to a higher voltage and shut off the circuit. That way, the user knows it's broken and likely disconnects it before the second Zener blows.If you use a good capacitor, there's not much in this circuit that is under high stress. If they're failing left and right, it's only because of the extremely cheap parts used. That Zener is no more likely to blow than the one my Fluke 45 uses as a voltage reference...

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 01:02:08 am
content: Quote from: niflheimer on October 20, 2013, 12:54:45 amYup, the zener worrys me, I would like some fail safe to kill a fuse.The Filter cap would be part of the formula so ripple would be reduced.there must be som elegant yet cheep way for this to work. You just have to open your mind to the fact that if it fails, then the components die, just without causing a fire.

author: Psi
author_rank: Super Contributor
timestamp: October 20, 2013, 01:09:14 am
content: If the zener fails you don't necessarily get full mains on your circuit.Remember it's still current limited and your circuit will continue to load this down.But if your load changes, say between 1mA to 50mA dynamically, like a mcu+relay, then yes, when you're drawing 1mA with a 50mA current limit the voltage will shoot way up.Since I is constant the voltage is always I*R where R is the resistance of your load.(RMS current of course)

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 01:20:51 am
content: Thanks Psi,That helps loads. I assume the dropping resistor has to handle some heat.You seem uber maths on this, so Given Vac Hac Vo Ao, could you make a one hit formula for the circuit to give values?I do all my maths in excel so I'm a bit thick reading normal math expresions however I am learning lol

author: dannyf
author_rank: Super Contributor
timestamp: October 20, 2013, 01:24:15 am
content: R1/C1 acts as the limiting "resistance" / impedance.Not as unusual as you may think.

author: Psi
author_rank: Super Contributor
timestamp: October 20, 2013, 01:30:43 am
content: Quote from: Sirus on October 20, 2013, 01:20:51 amI've seen a few versions of this sort of circuit. Usually the resistors is like 150ohms and there just to keep inrush current low and for safety reasons.I'm not sure why they have gone for 10k in your circuit but i guess its safer if the cap shorts, not that X rated caps ever do short.Vac doesn't really matter, since the current is based on frequency and capacitor size.The formulas you need are in my first post, along with an example.

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 02:23:41 am
content: Its not my circuit, I grabed it of the net. However let me have a look at two examples I have pulled open. Both one has a the first has a micro and basic radio receiver, the other two pics are from a door bell receiver i think but has a radio board to do all that. anyhows thems the power resisitors and mains caps. they both use the same circuit and both have failed without burning the house down, both have a zener. 240v 50hz UK. Do these math your formulars?

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 02:34:33 am
content: eg1

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 02:35:29 am
content: eg 1a

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 02:36:23 am
content: eg 1b

author: Sirus
author_rank: Contributor
timestamp: October 20, 2013, 02:42:21 am
content: Sorry I had looking at stuff lag. I forgot how quick a forum can be. Thanks for you help

author: Psi
author_rank: Super Contributor
timestamp: October 20, 2013, 02:49:39 am
content: Quote from: Sirus on October 20, 2013, 02:23:41 amQuote from: Sirus on October 20, 2013, 02:34:33 amThat red one is 0.47U, so 1/(2 * 3.14 * 50 * 0.00000047F) = Xc = 6776 ohmsCurrent = V/Rso 240V / 6776 = 0.0354192 = max current of 35mAOutput voltage is set by the zener voltage.

author: amyk
author_rank: Super Contributor
timestamp: October 20, 2013, 05:28:24 am
content: Microchip even has an appnote about them:http://ww1.microchip.com/downloads/en/appnotes/00954a.pdf

author: Whuffo
author_rank: Regular Contributor
timestamp: October 20, 2013, 06:41:51 am
content: This kind of power supply has been used for decades - and if well designed, it's very reliable. Only useful where the current draw is small and relatively constant; not very efficient, but it's dirt cheap. A transformer would be much more expensive, and a small SMPS would also cost much more.

author: Niklas
author_rank: Frequent Contributor
timestamp: October 20, 2013, 08:10:40 am
content: In an electrically noisy environment the cap's impedance, at least temporarily, will be lower than calculated. This can increase the voltage over the load and the series resistor causing failure due to breakdown or overheating. Even shorter, recurring transients can accumulate extra heat in the series resistor.If you have several loads, you can also try to optimize the overall system performance by lowering down the voltage in steps. We did a project with a micro, a 12 V rated sensor and a relay a couple of years ago. A 12 V rated relay draws a lot of current so we looked at getting a 48 V relay with a sensitive coil instead. The first voltage step was set to 50 Volts and that was dropped down to 12 V to the sensor using a resistor and Zener combination. The 3.3 V micro got its power from a low current linear regulator that was supplied from the 12 V rail.

author: SeanB
author_rank: Super Contributor
timestamp: October 20, 2013, 09:46:10 am
content: Major failures on those is the series resistor going open circuit from noise on the supply line and harmonics, and the capacitor going open circuit for the same reasons. Better ones have a low value fuse ( o.1A or so) in series, and a 275V MOV to clamp spikes to a safe level, along with a higher power resistor to handle the spikes and harmonics. As well the Zener diodes tend to go short circuit as they get over run by the harmonic current ( almost invariably short, only open if the capacitor goes dead short and allows a current to flow that burns traces off the board) and damaged by the poorer quality capacitors self healing. the electrolytics as well tend to go open circuit as well as they are the cheapest ones barely capable of handling the ripple current and running right at the maximum voltage across them ( often past both levels as I have seen 10V units used on a 15V zener) so they fail just outside the warranty period.

author: Psi
author_rank: Super Contributor
timestamp: October 20, 2013, 11:18:29 am
content: Quote from: Niklas on October 20, 2013, 08:10:40 amI've seen designs that use 24V zeners with 7805 for 5V mcu power and a 12V relay directly on the 24V line.The 24V stored in the DC filter cap provides an initial high current push to get the relay energized.The relay current draw pulls the 24V rail down to 9V pretty quick but 9V is enough to hold the relay in.This approach allows you to reduce the value/size of your mains capacitor.Also, no matter how you design it the load always pulls the voltage down a bit, even when you're within the current limit, and the above method gets around this issue too.

author: Whuffo
author_rank: Regular Contributor
timestamp: October 20, 2013, 11:49:08 am
content: X10 modules use this kind of power supply and they're very reliable and long lasting. Their circuit is a bit odd; you can find the schematics for many of their modules on Ido Bartana's page athttp://www.idobartana.com/hakb/. They use it to run the MCU (usually a PIC) and the PLCC transmitter. Line transients / harmonics are a problem long solved.Applications for this kind of supply are limited; low power, no human contact with the circuitry or wiring, fixed load. You could run an Arduino board from this supply, but you wouldn't be able to connect it to any external peripherals. For running LED lights and things like that, they're great. Some Chinese manufacturers cut corners and leave important components out, but don't take their results as typical of the transformerless power supply.It's a valuable tool for engineers. If what you're designing is suitable for this kind of power supply, it's the very least expensive option.

author: DutchGert
author_rank: Frequent Contributor
timestamp: October 20, 2013, 12:25:42 pm
content: Quote from: amyk on October 20, 2013, 05:28:24 amI was just about to post this as well. Very compact en nice appnote

author: Kjelt
author_rank: Super Contributor
timestamp: October 20, 2013, 12:34:53 pm
content: Perhaps you can protect the output after the zener with a crowbar circuit.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 21, 2013, 08:19:45 pm
content: I've built one somewhat recently for driving a relay and it worked fine, but the large quiescent current draw irked me. I ended up using a more sophisticated solution.I did reference the Microchip application note.I used some surplus X2 rated capacitors, a PCB fuse, a few MOVs, and whatnot. I built a full-wave rectified version because they're more efficient. The voltage went to absolute hell in a handbasket when the relay was energized, but as long as the current was high enough to keep it reliably latched, I cared not. It ended up being fairly small, but not small enough to make me happy. As I said before, the current draw bothered me. 50mA all the time... 50mA is a lot when you're talking about mains voltage. Still ... the thing was cheap, easy to build, and most of all, it worked.I covered mine entirely in heatshrink, by the way!EDIT: If you want to build one but lack properly-rated components, hit me up. I love an excuse to offload some components to someone else who will use them.EDIT #2: Are X2 capacitor ratings for capacitors I might have (in the US) even qualify in regions that use 220VAC/50Hz mains power? X2 capacitors seem to be typically rated for 250VAC or 275VAC. That's plenty of headroom when it comes to the range of 110VAC to 130VAC typically seen in The States, but surely not in areas with native 200VAC+ mains. I also have capacitors rated for 400V+, but not X-rated (heh...) ones.

author: Psi
author_rank: Super Contributor
timestamp: October 21, 2013, 11:12:14 pm
content: I believe the voltage rating on X caps is "working voltage" meaning you can safely use them all the way up to that point.So 250VAC or 275VAC caps are intended for mains up to 250V.But yeah, you would probably pick the 275V cap for the international market and only use the 250V cap for 220/230v specific countries, since some people in 240V areas may actually have 250V at the wall.Pretty sure X rated caps are self healing, so any overvoltage/overload just blows away a small area of the plate, reducing capacity a little but protecting the device. I would imagine you could unofficially put 300VAC on a 250VAC X rated cap and it would probably never fail, they under-rate them quite a lot as part of the X classification.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 22, 2013, 12:07:27 am
content: I think you're right, PSI. They test them at thousands of volts apparently!

author: SeanB
author_rank: Super Contributor
timestamp: October 22, 2013, 06:18:15 pm
content: Just remember that with time X2 capacitors degrade, and they can fail as a short circuit as well ( allowed as the spec calls for them to be used across the lines, not between line and PE) so they need to have a fuse in the line to them. I have seen many fail after a few years of use.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 22, 2013, 07:35:03 pm
content: Suppression capacitors are supposed to last quite a while. It should last longer if you protect the input with something other than the capacitor itself. A MOV or TVS may prevent surges from hitting the capacitor full-force, increasing the lifetime. Definitely include a thoughtfully-chosen fuse in the circuit.EDIT: Here's a couple of pictures of random stuff I have laying around.Picked the big gray one below up at the MIT Swap Fest (flea market) on Sunday. Got like 12 for a buck.

author: Sirus
author_rank: Contributor
timestamp: November 02, 2013, 11:39:11 pm
content: Thanks for all your help guys, I have gained a lot from this. Now I know what these PSU's are called Ihave been doing a bit of research.After a google of capacitive reactance, I found a free usefull and small program/calculator that doesthis and some other handy stuff, sorry if you all know about it. Electronics Assistant v4.31.Sorry not noting anyones name, I am using notepad to type this out as forums usualy drop out on me whenI submitIt just so happens, that one of the failed units was a radio controled mains switch with a manual buttonon the plug pack. I have 4 of them. They have loads of room for my custom boards in my simple projectsbelow. I looked a little bit deeper on the board and found that they are using the 2 stage method someone mentioned, They are using a double drop type of zener regulation, at first I thought they whereusing a half wave rectifier, but it is full wave, but 2 diodes are 24v zeners.I thought that was quitesmart as that should double your power rating also, then for the logic a 5v Zener after that.I striped the dead one for parts and tested them against a working one. I couldn't test the 24v Zenersin reverse as my power supply only goes up to 20v but they test good forward. I also checked the mainscap esr's, they where quite close. so I just swapped the mains cap and 24v zeners on the working one, andit worked fine. So I baged up the PSU parts, labeled it Tranformerless kit 240ac to 24v, 35ma and put itin the new draw in the part bin.I think the fail must have, as some one mentioned, transients ripping the logic or a transistor on theboard.As these are going to be usefull as project cases I didn't dig any further, I am using one for my desklight, but I may kill it as its a nice case, lol.The projects I was hoping to build from this type of psu are..Timed once only Mains switch--This is to turn my 5 & 7 year old daughters bed blankets off after 30mins, so I don't cook them. Iforget to set my alarm 50% of the time, don't worry, waterproof sheets just to be on the safe side. Theyhaven't done that since they where 3. Might even make another 2 for our bed, as we often forget due todrifting orf to nodland.Plug in the wall Power failure lighting--We have had a dodgy mains feed to our street for around 2 years now. So if the power goes, we areplunged into darkness, my youngest get quite distraught because of that bang of silence and suddendarkness. And I get really peeved while finding the ladder in the dark. Using some rechargeables andbright leds in one wallwart type box, I might even get flash and do it all with diodes, resistors andthe mains and smoothing cap. I am making a heavier duty 12v backup system for the fridge and freezer, Iwas also thinking of rerouting the house lighting circuit through a UPS, anyhow that's all another story.DIY suse vide controller--My only concern on this would be the temperature sensor, it is waterproof but I was thinking of earthgrounding the metal tube it is epoxyed in for belt and braces.Using an arduino, been trying to make one for 2 years now. In the beginning I was trying to figure outthermal mass and the delays involved to make some kinda formula, then around a 3 months after I foundout about PID control, HALLELUIAH, learned all of that then discovered adafruit do a kit based onsome bodys library's 3 months later, using a long timebase PWM. I am already to go on this using just thelibrary's the fella made, my program and hardware.TTFN

author: Sirus
author_rank: Contributor
timestamp: November 03, 2013, 12:29:04 am
content: Here is a few pics of the "new" project boxes. Now I have figured out photobucket again.http://s245.photobucket.com/user/Mr_Sirus/media/Wallprojectbox1_zps8de9c3e4.jpg.htmlhttp://s245.photobucket.com/user/Mr_Sirus/media/Wallprojectbox2_zpsc3bb82f8.jpg.htmlThere's lots of room in them and if you don't need to control the socket you can just jump it, so you don't lose the use of the wall socket. The in built push button directly hits the board to a pcb micro switch.Does anyone know where this type of case could be purchased? I think this is a custom package.IRC I bought 4 of these 12 years ago at £15 a pop. they also had a 4 button remote with each one to control up to 4 of the plug packs.For £15 you couldn't buy such a versitile case in my opinion, even back then.TTFN