Capacitive transformerless supply with zero cross detect - Page 1
Forum section: electronics / beginners

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: March 11, 2016, 09:09:05 am
content: In one of application, I need a capacitive power supply with zero cross detect & output of +5Vdc & 50mA.I am reading AN954(attached) based on which I have derived the values. I have calaculated compononet values based on formula given in this AN.Voltage range is 180Vac-260Vac & 50hz1. I have selected fuse for 2A. Since R2 is 470ohm. SO max current can goI = (sqrt(2) * 260Vac) / (470 * 0.9) = 0.87A (Assuming max voltage is 260vac & 470ohm is +-10%)2. Varistor I still have to select.3. C1= 0.15uF, 400V & R1=1M,1/4W. It is not in AN for capacitive supply. But I had some board which had placed it. Don't know why these values.4. Page 3 of AN calculates the max & min current values by equation 4 given on page 2 of AN.5. Imin:Vrms=180Vac (min)Vz=5.7V (max)f = 49.5Hz (min)C2 = 2uF x 0.8 = 1.6uF min(+-20% cap)R2 = 470 x 1.1 = 517 max (+-10%)Imin = 50mA (equation 4 on page 2)6. Imax:Vrms=260Vac (max)Vz=5.5V (min)f = 50.1Hz (max)C2 = 2uF x 1.2 = 2.4uF max(+-20% cap)R2 = 470 x 0.9 = 423 min (+-10%)Imax = 104mA (equation 4 on page 2)7. C2 = 2Uf for 50ma on load & 400V i.e double the voltage of 220Vac rms8. D1 = 5.6V since I need 5V at input &Vout = Vd1-Vd2 = 5.6-.7 = 4.99. On equation 6 on page 5 how they come up 21.3mA current?10. Another problem I found is R2 resisor wattage. Since entire 104mA(Imax) can flow from it so its wattage comes out to be 5.08Watts min.11. Another is zero cross point. I need zero cross detection also in this circuit. Is it ok to place it like this?

author: orolo
author_rank: Frequent Contributor
timestamp: March 11, 2016, 06:33:36 pm
content: When I experimented with, and built, several power supplies like yours, which are very dangerous, I found this reference really helpful:http://sound.westhost.com/articles/power-supplies2.htm#s6. Sections 6 and 7 are a must read. I don't think this kind of power supply is worth the effort, and risk, given their danger, low power and very limited versatility. Have you considered some kind of simple, low power switcher, like aLNK302?In point 3. C1 is in fact the current and voltage limiting component, and its value is critical. Also its rating, safely over the mains peak. The parallel big resistor protects and discharges the cap. In point 4. the equation includes the imaginary unit I, so you are working with complex numbers: you can't just add resistance and reactance as real numbers, as I think you did in points 5. and 6.Remeber that reactance is imaginary, so you cannot simply add it to the real resistance in formula 4. You must compute the complex module to get the RMS current. The correct computation, for V(rms) = 180V and f = 49.5Hz, (point 5.) is:Your 1.6u cap has a reactance of 1 / (6.2832*49.5*1.6e-6) = 2009.52 Ohm. Adding your resistor, that means a complex impedance Z = 517 - 2009.52I Ohms. Your input voltage has a peak of 180*sqrt(2) V, that is, 254.56V. Assuming the Zener takes 5.7 volts from that peak, the formula predicts an intensity RMS value of (254.56 - 5.7) / (2*sqrt(517^2 + 2009.52^2)) = 59.96mA.If we repeat the calculation in point 6. we get 130mA intensity RMS.Where does the 21.3mA in point 9. come from? If V(rms) = 120V, C = 0.47u, f=60Hz, then I(rms) = V(rms)/Xc = 120 * 6.2832 * 60 * 0.47e-6 = 0.02126 A approx. 21.3mA.Other things:Looking at your schematic, there is not distinction between active and neutral: I'd make sure that the fuse goes in the live wire, and that they can't be accidentally reversed.If you want to use a zener that is not rated for a lot of power, it would be a good idea not to use it as a rectifier: look at the Westhost link, where two power diodes are used for rectification, and the zener sits behind them, just doing its work of regulation.About quick and dirty zero crossing, this reference from Atmel,http://www.atmel.com/Images/doc2508.pdfworked wonderfully for me. But I used external diodes, one of them a zener. Be careful with the big resistors, they could get quite hot if you reduce them to improve accuracy.Please be careful with mains voltage, and only experiment when you are sure you understand every component, its value and its function. Don't trust formulas unless you know where they come from.

author: orolo
author_rank: Frequent Contributor
timestamp: March 11, 2016, 06:59:50 pm
content: Quote from: orolo on March 11, 2016, 06:33:36 pmSorry, I confused C1 and C2. C1 should be typically be a X2 capacitor and is there to filter EMI and to protect from fast mains pulses. 0.15uF is a standard value for this kind of application.

author: uncle_bob
author_rank: Unknown
timestamp: March 12, 2016, 03:16:37 am
content: Quote from: Vindhyachal.takniki on March 11, 2016, 09:09:05 amHiI tried something like this back when I was 14 years old. My only excuse is that I (almost) didn't know better. Fortunately a friend pointed out the issues associated with doing this before the process got very far.Unless you have a very unusual situation, ( = "double insulated") this is not a good idea at all.Bob

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: March 12, 2016, 09:25:16 am
content: Hi,I have modified a circuit as in attached png file(ckt pdf format).I have to drive a triac as shown in circuit.AC input=185V to 265vacCurrent = 50mA, MCU has 7 segment & additional circuit. (excluding Rload current through triac)Calculations are in attached pdf file. It has values calauclated by me by using microchip app note. Also here is snapshot of calculator which shows values calculated by website:http://www.daycounter.com/Circuits/Transformerless-Power-Supplies/Transformerless-Power-Supplies.phtmlAs you can see there is variation in values. Though website says it uses same microchip app note to calculate values. I am assuming worst case values of two.1. Now resistance values comes out to be 500ohm & 15W around. So I have taken two 1K of 15W each. Since AN says double power rating should be used. I have take this resisor from digikey:http://www.digikey.com/product-detail/en/vishay-bc-components/G27094731001JLA000/BC2987-ND/55923622. For calaculated current, capacitor value comes out to be 2uF. Though I didn't find single 2uF. So I have placed two 1uF capacitor in parallel. I have selected below capacitor. It is rated for 305Vac. Can I use it? Although AN says use voltage rating twice the value.http://www.digikey.com/product-detail/en/epcos-tdk/B32923C3105M/495-2324-ND/7789863. Zener wattage comes out to be 1W around. So I haev selcetd this 5W zener:http://www.digikey.com/product-detail/en/on-semiconductor/1N5339BRLG/1N5339BRLGOSCT-ND/8228114. Diode will be normal 1/4W 1N4007.5. Input cap C1 is 0.15Uf/400V.6. Two unknown components are: varaistor & 1M for 220Vac rating or i will two 500K in series for this.7. One thing, rating of Resistor comes out to be 15W. Will it keep on dissipating 15W of heat everytime?+5V circuit will draw 20-50mA always.(I know & understand the risk of this power supply. Usually I place a lamp while tesing & check it until 250Vac)

author: orolo
author_rank: Frequent Contributor
timestamp: March 12, 2016, 12:32:14 pm
content: Okay, if you are set in trying this kind of regulator, I would consider the following:1. Take you zero crossing signal directly from the live wire, and not from inside the regulator circuit. Remember that the capacitor introduces a phase shift, and the diodes cause nonlinearities and distortion. And note that your regulator is floating above ground.2. This kind of el cheapo regulator only works for small currents, and is very wasteful if you try to push it. If you want 50mA, youmustconsider full wave rectification. Otherwise, you will have to take very big caps (which are quite expensive at these ratings, unless you are using dubious quality caps, which you shouldn't, considering how dangerous the scheme is.) And the ripple with half-wave rectification will be worse, even with big caps. Not to mention the waste at the resistor: double current means four times more waste of power.3. A 1N4007 is way cheaper than a powerful zener. Don't rectify with zeners.4. If you put the 1N4007 above, and not below, the zener, your half-wave rectifier will not be floating, which is perhaps the only good thing that can be said about a half-wave rectifier of this kind. Look the Westhost link.5. All things considered, if you want to implement this thing right at 50mA, you will come to the conclusion that other schemes, like switching, are both more efficient and cheaper.6. Compute by hand, then simulate, then implement. Trial and error is specially not advisable with this kind of circuit. I don't think trial and error is good engineering in any case.Okay, let's simulate your circuit (first attachment below). You get 50mA peak current, with more than 5mA ripple. The RMS current across the resistor is 141mA, for a power of 9.34W. High ripple, high waste.Now, let's take a full-wave scheme (second attachment below), as suggested by the Westhost link. Note that the cap is halved to 1u. The ripple is about 1mA and the regulated current is uniformly over 50mA. The current through the 470 ohm resistor is now 70.7mA RMS, and the power dissipated 2.35W. Less (relative) ripple, less (relative) waste. The circuit is cheaper (three more 1N4007s vs. one big high rating cap) and performs better, but you lose ground reference (not that you had it in your initial scheme, BTW).These transformerless regulators allure a lot of people, I don't know why. I tried and rejected them some time ago for an isolated plug device a friend was designing. Last year I had to almost forcefully prevent another friend from using it at a training course. I consistently find this kind of supplies in ultra cheap, failure prone, PFC from hell, you know where from, LED bulbs. I think almost everyone else uses small transformers or switchers.

author: Seekonk
author_rank: Super Contributor
timestamp: March 12, 2016, 02:10:39 pm
content: Doesn't anyone build anything anymore before posting on the internet? n my era there were real men. They didn't have spice or even calculators. We made flames and smoke. And learned things. You have more guts than me posting schematics on the internet. If I say it is sunny on the internet, a dozen people will get on and tell me there is a wispy cloud in the west.I've done dozens of these supplies in products I brought through UL. I've followed this from the beginning waiting for someone to give you some good information. This is just from memory as my eyes couldn't stop rolling when I looked.Pretty dinky bleed resistors. Check a data sheet and see what voltage those are rated at. You need two in series at that size. 7.5W resistor, couldn't look further. 47-100 ohms should do. Your cap seems to be about three times the size that is needed. Start with a .47 and breadboard this thing. It will be an education. This isn't rocket science.

author: orolo
author_rank: Frequent Contributor
timestamp: March 12, 2016, 03:07:36 pm
content: Quote from: Seekonk on March 12, 2016, 02:10:39 pmHave breadboarded a few of these supplies as well, as I think I mentioned. Agree with the size of the resistors, 100 Ohms are used in all the examples I linked. I dug one of my prototypes, and I used a 220 Ohm, for a much lesser current supply. Was being overcautious, and knew, thanks to calculations, that the size of the resistor affects very little the resulting current.QuoteReally? 470n at 50Hz is Xc = 6772.5 Ohm. Hell, forget about series resistance, 230V RMS peaks at 325.27V, and that divided by 6772.5 Ohm gives 48mApeak, 33.9mA RMS, discounting: series resistance, diodes, zener and (most importantly) half-wave rectification. Go and breadboard it, tell me if you get 50mA. Ain't no rocket science, eh? Hell, since I'm no real man I spiced it, and got about 16mA of rectified current at a 100 Ohm load, which makes sense, since half-wave takes away quite a bit of the max current and voltage.I wouldn't suggest anyone make flames and smoke when mains voltage is involved. I like burning things as much as everyone else, but in a controlled way.

author: orolo
author_rank: Frequent Contributor
timestamp: March 12, 2016, 05:40:11 pm
content: Ok, this is my last post in this thread. Sorry for the spam. Don't want to annoy anyone. I confess I was trying to orientate the OP instead of solving the problem outright; I perceived a bit of inexperience which could prove dangerous, if only following schematics and equations without deeper understanding. This is my solution to the problem, complete, of course open to critic and flames, and even with circuit diagrams. I have omitted the security components, for the sake of clarity. Refer to attachment 1.The zero cross section is directly from the Atmel datasheet. For the waveform, comparing it with the live voltage (scaled down by a factor of 60), refer to attachment 2. This waveform is computed under load, and seems to work.The circuit has been loaded by 100 ohms, in order to draw 50mA, and shows about 2mA and 0.3V ripple. See attachment 3.The power dissipation at the 100 Ohm resistor is about 333mW, and the voltage across it is under 10V.I have not breadboarded it, but I have breadboarded similar circuits, with similar behavior. I think this circuit would be a good breadboarding starting point, with a view on reducing the cap. I don't think it can be much further reduced, but I'm not in the mood of wasting more time in this.On a subjective note, I don't like this approach to regulation, but this is what I'd try, if I had to.All the best.

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: March 19, 2016, 05:29:17 am
content: I will use this ckt & will see.One issue is in this circuit i cannot control triac directly, I have to use optocoupler & snubber circuit.Is there any way I can control triac direcly from MCU pin without using optocoupler?Edit: I have two pins on MCU which are true open drain. I am using STM8S00F3

author: LukeW
author_rank: Frequent Contributor
timestamp: March 19, 2016, 06:44:39 am
content: You simply can't get that much current from this type of circuit. Full-wave rectification helps give you a bit more power, but even that has its limits.The efficiency is terrible, and as you've already demonstrated, if you're talking about current requirements on the order of 100mA then you start dramatically increasing the size of the capacitor and the heat dissipation and sheer size of the resistor, so you end up with a very bulky, hot, wasteful device.These things are generally only practical and useful where the current budget is really small. 100mA is basically too much, especially for a half-rectified configuration.The lack of galvanic isolation from the mains is not a dealbreaker, but youmustunderstand what the implications of that are and how to handle that safely.There are plenty of consumer appliances out there on the market, for example remote power switching appliances, home automation, PIR sensors, plug-in smart power metering and stuff that use this kind of transformerless power supply - but it's inside a sealed, double-insulated box with no connections out to the outside world, no computer connection or anything like that, and nobody sticking oscilloscopes or prying fingers into it.As somebody else has mentioned above, there are some relatively simple, low-cost non-isolated offline switch chips out there which are a good substitute with more output power, smaller components and better efficiency.

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: March 21, 2016, 08:17:33 am
content: Hi,I have testing the ckt as in post#8 & I am getting around 5Vdc at 10 ohm load.Now i have to connect a triac to control the load, will add an opto & will see the result

author: Vindhyachal.takniki
author_rank: Frequent Contributor
timestamp: March 23, 2016, 07:46:51 pm
content: 1. Attached is the circuit which I had assembled on general purpose PCB & tested with 100 phm load at output. (Microcontroller section as in ckt is not yet conencted, in actual circuit 100ohm load is removed & MCU section will be connected)2. It has a 9.1V zener & then a 7805(TO-92) connected to get clean +5V supply to MCU, since MCU has some analog sensor connected. Also zero cross ckt is shownI had varied input voltage from 185Vac to 265Vac, & see the output voltage across 100ohm load, its always clean +5V. Max laod on +5V dc is around +5V.3. One issue I have is now have to control a triac. Here I have used a bridge rectifier along so now I think that i cannot drive triac directly from MCU pin. I have to conenct a optocoupler in between.Is there any way that I can drive triac without using opto?Any other comment/suggestions on ckt.

author: Jeroen3
author_rank: Super Contributor
timestamp: March 23, 2016, 07:57:33 pm
content: With a specialised triac driver. It will have an opto or isolation barrier internally.

author: mij59
author_rank: Frequent Contributor
timestamp: March 26, 2016, 07:47:04 am
content: Examples how to direct drive a triac can be found application note ST AN2263 and microchip AN958