Modified PWM for Triac Gating ?
CounterRotatingProps
Posts: 1,132
Hi All,
Application: AC lamp dimmer.
Circuit: old-school wave chopping via triac.
Please before you say this won't work, hear me out ...
I'm familiar with many of the quirks of triacs used in dimmers, i.e. they need zero-crossing detection, they lock on, etc.
Because most MC libs do PWM out of the box, and triac gating is basically an on/off deal, I've been wondering if modifying the PWM code might work to drive the gate, switching the device on and off at the appropriate point in the half cycles.
Modified here means Pulse on = Gate on, Pulse off = Gate off. (Or is that a dumb idea?)
I'm trying to step back, and need more eyes, to make sure I'm not making this more complicated than it needs to be.
I'd use this simple circuit: a zero crossing detector, opto-isolated, fed in into the MC. The code, in turn, triggers the modified PWM output, via another opti-iso into a level setter to get the right gating current.
Maybe there is an easier way, using the same circuit but different code? For instance, have just a simple timer, triggered by the zero crossing. Timer on/off length = Gate on/off time. (Notice how similar that is to PWM ? ) In this approach, there'd need to be a lookup table --- something like Percentage of desired Brightness -> Timer Length. Off the cuff, it seems like moding the PWM or coding a lookup is about the same amount of effort. (?)
I'm thinking of using the the BTA41-600BRG triac (BTA41-600BRG). It has enough headroom to handle my need of a constant max 10amps at 120VAC.
thoughts, comments, ideas most welcome.
Thanks!
Application: AC lamp dimmer.
Circuit: old-school wave chopping via triac.
Please before you say this won't work, hear me out ...
I'm familiar with many of the quirks of triacs used in dimmers, i.e. they need zero-crossing detection, they lock on, etc.
Because most MC libs do PWM out of the box, and triac gating is basically an on/off deal, I've been wondering if modifying the PWM code might work to drive the gate, switching the device on and off at the appropriate point in the half cycles.
Modified here means Pulse on = Gate on, Pulse off = Gate off. (Or is that a dumb idea?)
I'm trying to step back, and need more eyes, to make sure I'm not making this more complicated than it needs to be.
I'd use this simple circuit: a zero crossing detector, opto-isolated, fed in into the MC. The code, in turn, triggers the modified PWM output, via another opti-iso into a level setter to get the right gating current.
Maybe there is an easier way, using the same circuit but different code? For instance, have just a simple timer, triggered by the zero crossing. Timer on/off length = Gate on/off time. (Notice how similar that is to PWM ? ) In this approach, there'd need to be a lookup table --- something like Percentage of desired Brightness -> Timer Length. Off the cuff, it seems like moding the PWM or coding a lookup is about the same amount of effort. (?)
I'm thinking of using the the BTA41-600BRG triac (BTA41-600BRG). It has enough headroom to handle my need of a constant max 10amps at 120VAC.
thoughts, comments, ideas most welcome.
Thanks!
Comments
Even for a small device, 32 table entries is a small memory footprint. Do you think 64 transitions would be too fine grained?
Not sure about newer LED dimming curves, so this may need to be switchable.
I would fit even more, as the eye is very sensitive to flicker, and a control on any boundary will be prone to flickering between two values.
It's not really quite PWM you want, as you do not want a repeating signal.
You need a variable delay from ZCD to Gate leading edge, and then need care to terminate that gate pulse comfortably before the next ZCD.
Some designs burst fire the gates to save a little energy.
You also need to watch for phase variances in inductive loads (halogen ballasts etc), and better designs check for Triac-off with a ZCD across the Triac, (effectively current zero cross) and you need to control pairs of half cycles identically, to avoid unbalanced loads.
Impressive. What do those monsters cost ?
Do you manage as one-pair per COG, or more ?
But, still, pretty easy!
-Phil
Unfortunately the light output is not directly proportional to the the area under the sine curve. Both intensity and color spectrum are non linear. Best to see if you can find a table on the internet if you can.
I do not think a 64 entry table is too fine grained, but even a 32 entry table is adequate and you can always extrapolate between two entries.
Yes - that's what we normally do for phase control but I must have been thinking about what I do with the SCRs as I don't need nor desire phase control in this application. In fact I prearm the opposing SCR of the pair so that the very moment the voltage and current are right it will conduct. This avoids needing an accurate ZCD too.
btw, this current is only being used as an injection current, so the actual load current is very high. In fact I had a faulty half of an SCR brick in the chain that failed and shorted out the supply line momentarily. The end result was a very big mess, lots of black smoke from the insulation off several of the 1" diameter copper cables that completely melted away, and to figure out why the breaker for this "control" current didn't trip although the big fuses in the distribution panel ended up blowing.
Each brick is big enough to host its own little Prop module over my ping-pong RS485 network using a 10-way IDC cable but even still there are a couple of tiny PIC chips that the Prop communicates with over a couple of solid-state isolation barriers for the SCR pair. I did post a video showing how I could broadcast to all these Props or chat with them individually as if I had a direct connection, which means I can do this over Telnet from far away too if need be.
Exactly. The cog waits for a zero crossing which then triggers another wait for the time specified in the table, at which time a trigger pulse is sent to the Triac.
While I was writing this, Jon posted a spin obj - great, thanks - I will review it asap and it may well answer several questions I was going to ask.
Both Cool and Yikes! Although that's 100 times what I'd need, would an inverse parallel SCR set provide any benefit at lower switching power over a Triac config? (Load will be incandescent, then down the road LED <- @jmg, yes I do need to research it more.)
Peter, you lost me there. I thought SCRs (and Triacs, etc) were either gated on or off. How do you "prearm" one?
Bulbs blowing, ideally should not kill the dimmer...
As powers push up, SCRs can also spread the hot-spot more, by using two packages.
I think here, Peter means with a SCR you can apply the gate pulse early, and it will then naturally turn on as soon as the voltage reverses.
That assumes you want 100% conduction times, but also want to save gate power.
That would be sweet - in that config, for a ZCD, could I get away with using something a rudimentary as the approriate series resistor and cap on each leg feeding the inverse-parallel LEDS of an opto-iso like an H11AA1 https://fairchildsemi.com/datasheets/H1/H11AA1M.pdf ?
For Phase dimming, you turn off on voltage reversal, and delay the eventual turn-on from there.
Rather than a H11AA1, it is probably simpler to drive a >> 10A Triac, using a Non-ZeroCross Triac Trigger opto, like MOC3052S (1kV/µs), or more $, but better specs, FOD4218S (10kV/µs, < 1.3mA trig)
FOD4218S shows Triac and SCR use circuits.
https://www.fairchildsemi.com/products/optoelectronics/triac-driver-optocouplers/random-phase-triac-driver/
OK good too that you say Peter's approach wouldn't do phase control - I just assumed inverse-parallel SCRs could be set up to trigger that way.
Best one-line description yet.
Which explains why really cheap dimmers zonk out after one or two bulbs go. (Caveat Emptor )
(I think that FOD4218S is actually built using 2xSCRs, which is how they get the high dV/dT, and also why the price bumps a little )
The hardware of back-to-back pair of inverse parallel SCRs is capable of Phase control, and that is how soft start systems work. Brief phase control, then run at 100% ON.
I'll just add a clarify that if you go for the clean simplicity of Opto-Triac triggering, pre-arm has less meaning anyway, as the Opto-Triac is itself a triggered drive.
There needs to be some small voltage build up, across Opto-Triac + surge-rated gate resistor + Main Triac/SCR gate, enough to get above the Main Triac/SCR trigger threshold.
Monsters like the ones Peter drives, likely have their own local floating gate power supplies, avoiding that gate resistor - Anode path.
Looks like 2V / 100mA is a common trigger for bigger SCRs, & < 5V Reverse.
Does this mean you run multiple SCRs in some time-sequence manner, to spread the thermal load over many banks ?
Sounds like even more of a monster..!
I use the H11AA1 in my dimmer circuit.
Series caps need care, as that shifts the 'zero' in the zero crossing, but you can fix that in a P1 with another shift, once you've decided the line frequency.
Optos have poor gain tolerance, and drift, so you may want to add more smarts to centre timing between the two ZCD edges. (assumes matched diodes, and symmetric sine AC)
This also allows lower currents into the opto, and tolerates CTR and drift.
Lower current optos like SFH6286-4 also ease the design.
The output waveform is virtually symmetrical. On my bench, the duty cycle was 49.55%.
-Phil
good, thanks, that confirms I'm on the right track here.
appreciate that. ok, good too, I was mulling over using two optos in inverse parallel like that, instead of the AC input in the H11AA1.
Aside from operating voltage, is there any specific (crucial) reason to select the H11D3 over others in the family, or similar ones from other vendors? It's (relatively) pricey.
* If you do not use the base, best to buy an opto with base not connected.
* For Mains ZCD, series resistor power is significant, so lowest current spec'd optos are better; 10mA is ancient, good ones spec at 1mA
* Channel matching will be better on AC input opto, as the TRX is common, just LEDs can vary.
Possibly two optos in one package, might get closer to AC matching.
* Phil's circuit has a nifty series connection of the optos.
That gives a tri-state region, so has very low static current, and high sensitivity (pluses), but it only has one edge per crossing, so you lose the ability to interpolate the two edges for a near perfect zero point.
Ah, and chopping sine wave using the "leading edge" method creates a lot of noise. A small network of inductors and resistors can suppress the noise.
Make sure the triacs are also isolated with drivers. I've seen the ones without isolations, but I do not recommend them due to the safety issues on it.
I have seen special resistors like the ex Philips VR68 series, used without isolation, they are rated to 10kV, and many-megs keeps the ground current to well below safe levels. 10M~33M or even their top end 68M could be considered with modern sub uA leakage MCU pins.