Interfacing PIC microcontroller to a TRIAC for AC load control

BobaMosfet

Joined Jul 1, 2009
2,113
Hello,

You have only 4.5 mA going through the optocoupler, but is asks for 15 mA, according the datasheet.

You might want to look at this appnote for the zero crossing detection:
http://sound.westhost.com/appnotes/an005.htm

Bertus
I'm looking at the datasheet for the MOC3020, and it's listing -30mA- as the necessary trigger current @ 3VDC , under Transfer Characteristics. However, I think Figure 4 is more useful because the necessary current required for the LED is tied to pulse width. For any ZCD, it's useful to output a symmetrical pulse around the actual ZC, and I suppose at this point the question to ask first is whether or not they are registering a ZC into their micro? If they aren't seeing that, then nothing else (yet) matters. In other words, are they registering ZC and then generating a wide enough pulse at proper voltage & current?
 

BobaMosfet

Joined Jul 1, 2009
2,113
I tried to place 150Ohm at the collector of that transistor controlling the MOC3020 but even when the PIC is not in the board the motor turns at maximum speed,so the PIC is no longer controlling the motor.Even with 180ohms the motor turns at maximum speed even when the PIC is not in the board.

Please help!!
And are you shutting the triac off, ever? If you trigger the gate, it's going to stay on unless you remove power from A, K, and G.
 

joeyd999

Joined Jun 6, 2011
5,287
I designed a soft start circuit for an amplifier.
I just used a 390K resistor into a PIC input for mains zero crossing detection, worked great.
To drive the triac I used an opto coupler.
I certainly hope you do this on the safe side of an isolation transformer. Otherwise, you are asking for trouble.
 

Thread Starter

jean120

Joined Jan 24, 2016
75
Hello Dear,unfortunately it is not easy for me to use an isolating transformer which I can`t even found;could you advise using what I have?
Regards,
 
PS: For all intents and purposes you are using an isolation transformer per terms of service.

In any event, triac control for motors is a bit different than resistive loads, because the triac can turn off at zero voltage AND zero current. A light bulb is non-linear, but it's still resistive, With a motor, the voltage and current will be out of phase, so you have to figure out when to turn it back on. 0 voltage and 0 current is not co-incident.

With that out of the way, let;s look at a resistive load. Your dealing with zero crossing and a half-cycle.
Once you have a good zero crossing detection, you can think about when to turn the gate on. Your timing might be based on the RMS value of V or the RMS value of V^2. So, if your trying to control V, your 100% to 0% should be based on the RMS of the timing of the phase angle. If you turn it on immediately, you will end up with 100%.

0% is a special case. You have to make sure you don't go over the next zero cross, so you may have to tweak the timing slightly. You might take a period and divide it up into whatever fits base don turn on time, timer resolution etc. You could end up with 0 to 100% in steps of 1% say.

So, this would work for a light bulb.

For a motor, you would also have to monitor 0 current and you may have to turn it on again. Now, you can also keep the gate continuously on.
 
the key os the first sentence here:

http://www.simulation-research.com/help/userguide/drives_phaseanglecontrol.html

Phase Angle control uses a low frequency switch to chop an AC sine wave. The firing angle of the switch is varied. The average voltage will be proportional the area under the sine wave. Thus, the average voltage is the integral from the firing angle to the zero crossing, the cosine of the firing angle.
As I said, you can use V or V^2

You need a decent zero cross detector.

You need a decent table.

The power line frequency isn't exactly 60 Hz. See: http://www.leapsecond.com/pages/mains/
Frequency is pretty good. https://en.wikipedia.org/wiki/Utility_frequency Long term is excellent.

but first, you need a good zero crossing detector and the ability to fire reliably.

This http://www.oocities.org/ve2olm/avr422.pdf app note shows the basic idea of continuously generating a firing pulse, so your essentially gating it. So at zero current+, it will turn on again.

So, if you were looking at 50/60 Hz you would have code to detect that too.

Some controllers and I haven't yet figured out how they accomplish it would be to incorporate RMS voltage feedback and current limiting.

e.g. current limit could instantly remove the gate pulse, but that may not be as effective, I THINK systems use back to back SCR's for better performance, but I haven't dug into how to accomplish this. it's good for inductive loads to have current limiting.

As I said, some good systems will do line voltage compensation as well. The systems I used had trigger transformers for the SCR's in the triac module. Some design issues arise because of the quadrants of operation.

An over-rated Triac and correctly designed snubber generally works. I worked with systems that used a phase angle firing module that drove a Variac to provide essentially a 30 V heater at about 10-20 Amp max. on the secondary side. 300-600 W or so. We did good using 25 Amp Thyrister units and the semiconductor fuse with current limit. Since the system was "exposed" in a vacuum chamber, I also suggested that we use a normal blow fuse in series. So, occasional shorts would blow the $1.00 USD normal fuse and leave the $25-$30 semiconductor fuse intact.

Later I changed the entire system to use DC power supplies.
 

BobaMosfet

Joined Jul 1, 2009
2,113
ZCD isn't difficult. simply rectify the AC to DC, say to 10VDC, and then use a voltage divider comprised of a diode and a capacitor to create a symmetric pulse to an opto-coupler (could also be a thyristor/SCR). W1 & W2 are the rectified DC. W3 is the open-collector output pulse. Frequency and thermal independant. Set component values accordingly to achieve your results.

zcd-heart.gif
 
here's an analysis of a similar circuit: http://www.rogerclark.net/ltspice-model-of-ac-mains-zero-crossing-detector/

and here: http://dextrel.net/diyzerocrosser.htm

So, basically note, that accurate zero crossings are required and they are not exactly easy to create.

Here's http://tesla.zabotavdome.ru/zero/zc.pdf a decent paper that explains some of the carious methods. Note the two optocoupler method.

You get a centered pulse, but you actually need the center, so the event you need is mid-way between the two pulses.

here's another: http://www.nxp.com/documents/application_note/AN467.pdf

and another: http://www.onsemi.com/pub_link/Collateral/AND9282-D.PDF

Here http://www.onsemi.com/pub_link/Collateral/AND9282-D.PDF is an interesting circuit.

and especially here: https://ac-dc.power.com/design-supp...der-320-lossless-generation-ac-zero-crossing/


I helped someone on ETO to design a phase angle fired AC motor controller.
 
Last edited:

Thread Starter

jean120

Joined Jan 24, 2016
75
here's an analysis of a similar circuit: http://www.rogerclark.net/ltspice-model-of-ac-mains-zero-crossing-detector/

and here: http://dextrel.net/diyzerocrosser.htm

So, basically note, that accurate zero crossings are required and they are not exactly easy to create.

Here's http://tesla.zabotavdome.ru/zero/zc.pdf a decent paper that explains some of the carious methods. Note the two optocoupler method.

You get a centered pulse, but you actually need the center, so the event you need is mid-way between the two pulses.

here's another: http://www.nxp.com/documents/application_note/AN467.pdf

and another: http://www.onsemi.com/pub_link/Collateral/AND9282-D.PDF

Here http://www.onsemi.com/pub_link/Collateral/AND9282-D.PDF is an interesting circuit.

and especially here: https://ac-dc.power.com/design-supp...der-320-lossless-generation-ac-zero-crossing/


I helped someone on ETO to design a phase angle fired AC motor controller.
Sir,did you check my circuit?I have a problem of using MOC3020 which requires 30mA for turning on and that current is not provided by the PIC so I added a BJT which may first amplify that current but with that transistor the load is going on without PIC pulse,even when the PIC is removed from the board the load turn on and it can`t be controlled.

For zero cross detector I used a BJT transistor supplied with a full bridge rectifier without a filtering capacitor.

could you please advise?

Kind regards,
 

Kermit2

Joined Feb 5, 2010
4,162
230 volt @ 1 amp is 1/3 (at best) and likely closer to 1/4 horsepower in reality.
It is known as a fractional horsepower AC induction motor.
One of the most unresponsive types of AC motor for speed control.
Period.

Good luck Sir. You might actually get something close to full range speed control, eventually. I can promise as well that you will not like the ridiculously fast reduction in torque that happens as soon as speed begins to decrease.

Pick a different motor if you plan on using it for doing something other than just playing around with.
 
Top