phase angle dimmer problem - Page 1
Forum section: electronics / projects

author: djacobow
author_rank: Super Contributor
timestamp: October 08, 2013, 09:52:46 pm
content: Hi guys. Long time reader, first time poster here.I've been wanting to make an uC controlled phase angle dimmer circuit for awhile. My kids like to fall asleep with the light on. I thought it would be fun to make something that will dim the light slowly over a 20 or 30 minute period until it's off.Seems like a simple, small project and others have done similar.I'm using an H11AA1 that will pull a pin on the uC and serve has zero crossing reference. It works fine.To dim the light I'm using a MOC3023 random phase opto triac driver driving a generic triac (I think I'm using BT08 right now).Problem is the triac circuit does not work, and I can't figure out why. The voltage I measure between pins 4 and 6 of the triac driver is about ~20Vac when I'm not triggering it, and 0V when I am, so the driver seems to work. The triac itself does not seem to fire.Can someone help me understand what is wrong with this circuit?Sorry for the cheesy graphics. I thought I'd try Fritzing to see how it works on something simple like this.The AC connections are on top. In order from left to right are the load hot and load neutral, then the source neutral and source hot. Only difference between source hot and load hot is the fuse. When the triac is 'on' the load neutral should be pulled down to the source neutral.Optoisolated DC connections are on the bottom.Regards,Dave J

author: Andy Watson
author_rank: Super Contributor
timestamp: October 08, 2013, 10:11:14 pm
content: You have A1 and A2 reversed on the triac. The gate drive should be relative to A1, at the moment A1 is at the same potential as load, which is at the same potential as the opto-triac drive.I assume you've protected the zero-crossing detector with a reverse diode?

author: djacobow
author_rank: Super Contributor
timestamp: October 08, 2013, 10:20:04 pm
content: Ah, thanks, Andy. I'll give that a try when I get home.I'm not sure I understand the suggestion about reverse diode protection. The AC waveform can go either way. The H11AA1 has two LEDs wired up both ways.PS -- This whole circuit is arranged with so as to have 'hot' live at the load and pull down neutral when it's on. Would it be safer to rearrange so that neutral is fixed and hot gets pulled up when the triac is on?Thanks again!

author: Andy Watson
author_rank: Super Contributor
timestamp: October 08, 2013, 10:29:18 pm
content: Quote from: djacobow on October 08, 2013, 10:20:04 pmFair-enough.I was looking at the 4N35 in the circuit rather than reading your text.QuoteI don't think it makes much difference, but I would say, if possible - switch the live. That way, when the lamp is off the wiring is not unexpectedly live. Although you should never rely on non-physical switches for circuit isolation.

author: djacobow
author_rank: Super Contributor
timestamp: October 08, 2013, 10:37:26 pm
content: Ah, yeah, Fritzing didn't have the right part, this was close. :-)

author: geraldjhg
author_rank: Regular Contributor
timestamp: October 11, 2013, 11:26:18 pm
content: hisorry i cant help,because i detect zero crossing from the power supply secondary (with a 50 hz transf)this goes to an interrupt pin, then i wait between 1 and 9 ms to fire the crossconected SCRs with apulse transformer--- all this because i got tired of optotriacs etc driving triacslately i have had luck with 1 amp t092 triacs fired directly from a micro ( thou live and connected betweengnd and -5) . you have to learn a bit about 2nd and 3rd cuadrant firing, but it works directly from a pin atless than 5 masaludos

author: djacobow
author_rank: Super Contributor
timestamp: October 12, 2013, 03:56:06 pm
content: wilfred, geraldjhg,Interesting idea to drop the opto stuff. I had not considered that for safety reasons, but it certainly can save cost! As it turns out, someone has already made a board essentially the same as what I am designing:http://www.inmojo.com/store/inmojo-market/item/digital-ac-dimmer-module-lite-v.2/For ZC, he uses a 4N25 driven by a full wave rectifier rather than the H11AA1. Not sure why. Anyway, I have done the ZC before. I made a simple project with an Arduino Ethernet that monitors line frequency and makes it available as a SOAP service on the web. Then htm/javascript that shows plots of frequency over time. No real point to it, but it is interesting to see that the frequency of the power grid does in fact waver.For the opto-triac and triac, his ckt is the same as mine as I have re-drawn it.I'm bummed that "my" module is out there for sale, but I'm going to fab it anyway. Looking forward to writing the software. I think I should be able to get the pulse generation entirely in interrupts so that the main loop of the uC is free to do whatever else, UI, network, etc. If it were possible to get the PWM perfectly synchronized with the incoming ZC pulses it might even be possible to use it to generate the control pulses. Then the uC would be totally loafing while still managing the output as desired. But I think there is no way to get the PWM frequency to exactly match the AC line -- though it may be possible to get it close and fix it up occasionally.

author: djacobow
author_rank: Super Contributor
timestamp: October 12, 2013, 04:00:27 pm
content: Here's another question. Dave is always going on about notching boards and providing sufficient clearances, but with these optos or the triac for that matter, the clearance can't be greater than the pin spacing, which seems minimal. Also, with the parts so small, how could you carve a real notch between the AC and DC sides? Even with the DIP packages that'd be a thin notch and with SMD, it probably could not be done at all.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 12, 2013, 04:02:13 pm
content: The notch is still meaningful when DIP parts are involved. Just make sure that the board area under and around the optotriac is clean.I only basically skimmed the messages here, but why are you talking about zero-crossing detection when you want a dimmer? I was under the impression that that was one of the main purposes of random-phase drivers.

author: djacobow
author_rank: Super Contributor
timestamp: October 12, 2013, 04:10:59 pm
content: minime,The triac will turn off by itself when the current waveform crosses zero. If you turn it on just after that, it will be on for a almost a full cycle. If you turn it on just before then, it will be almost off never on. Regardless, if you want smooth operation, you need to time your pulses in sync with the line voltage.If you don't sync, say by drive with a PWM that has no relation to the AC line voltage, you will get odd, flickery operation. The turn on point will be driven by the PWM output going high, but the turn off point will still be driven by the line current. So you'll get a bunch of random 'runt' outputs, etc.Random phase just means it will turn on whenever you say. ZC detection means the device cannot be used for dimming, it will only turn on for whole cycles.PS -- if you were controlling a heating element or something else whose output only matters to you on the order of many cycles, then you could skip the ZC altogether and just slow your PWM down so that it operates over many cycles. But even then you'd probably want the ZC detecting opto-driver as the partial cycles are of no benefit to you and they cause noise.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 12, 2013, 04:16:08 pm
content: Quote from: djacobow on October 12, 2013, 04:10:59 pmI get what you're saying --- I'm actually dealing with triacs and opto-triac circuits right now for a little project. I thought he wanted to dim the output, and I agree, as you said, you can't use ZC for dimming. That's why I questioned why it was being discussed.

author: djacobow
author_rank: Super Contributor
timestamp: October 12, 2013, 04:27:02 pm
content: Yup, one way to think of it is that you usually want ZC detection regardless of what you're doing with a triac.If you are not going to dim, then you can let the triac driver do it for you. (ZC detecting driver). IF you want to dim, then you have to deal with it yourself.By the way, I was incorrect when I said that not detecting ZC will get your random runt pulses. If you drive with an unsynchronized signal of fixed frequency, you'd get regular beating. If the driving frequency was close to the line frequency that beating could occur over seconds or minutes and potentially make very weird pulsating lights indeed.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 12, 2013, 04:38:07 pm
content: I suppose, for dimming, you'd want to turn on the lamp at a zero-cross, but you wouldn't want to then turn it off at the next zero-cross unless that coincided with your dim setting. My understanding is that you turn the TRIAC on at a zero cross and then off again a fixed time later based on what you want the dimness to be. You can't do this with an actual zero-cross optotriac driver because it will only trigger on or off at zero-crossing points.Heh... dimming out of phase with the line voltage does sound like it would screw with your head quite a bit over time.I've never seen a discrete zero-cross detection circuit, but I can't imagine it being too complicated.

author: djacobow
author_rank: Super Contributor
timestamp: October 12, 2013, 04:44:11 pm
content: > My understanding is that you turn the TRIAC on at a zero cross and then off again a fixed time later based on what you want the dimness to be.This is the right concept, but exactly backwards. You can't turn a triac off from the gate, only on. They turn themselves off when the current ZCs again. So what you do is wait for a ZC, then wait some amount of time as desired, then fire. The triac turns off at the next ZC.

author: minime72706
author_rank: Frequent Contributor
timestamp: October 12, 2013, 04:48:53 pm
content: Right... I thought I had it backwards. I actually just read it last night when I was deciding what the best optotriac/triac combination circuit was best for my "unknown load power factor" problem in a power switching circuit.So where does this leave the original poster?

author: djacobow
author_rank: Super Contributor
timestamp: October 12, 2013, 05:11:02 pm
content: Ha! I am the original poster. Basically, I had A2 and A1 reversed in my circuit. I thought it didn't matter, but it does.I am actually an EE and I have a pretty firm grasp of electronics theory, but A) like many EEs, lack good practical knowledge of building real ckts B) it's been a long time since I worked as an EE, and when I did I was in VLSI design -- a long way from triacs. ;-)

author: minime72706
author_rank: Frequent Contributor
timestamp: October 12, 2013, 05:39:47 pm
content: Heh I guess I could call myself an EE, though I'm young. I worked on VLSI until losing my job due to the budget sequester. I also have a hobby, which enables me to learn practical stuff.

author: miceuz
author_rank: Frequent Contributor
timestamp: October 12, 2013, 09:37:19 pm
content: Does anyone has an opinion about mosfet based soft dimmers?I've prototyped one, but disregarded it when started to look for parts in digikey -- it seems to be much more expensive to build a soft dimmer with the same specs as triac based one. Nevertheless, i've heard arguments that trac based dimming is "old".

author: minime72706
author_rank: Frequent Contributor
timestamp: October 13, 2013, 03:44:12 am
content: I've never heard much about it, but as long as it's done in somewhat of a synchronous manner, it probably isn't bad. You get more control, for sure. This is effectively how the first stage of AC/DC off-line converters work, though actually I think it's rectified first.