Set Firing Angle TRIAC using optocoupler with PWM

Good afternoon.... I decide to control TRIAC with PWM signal via opto coupler

so.. I watched this video... Firing angle TRIAC control

Look like very simple, but when I did that... the result not like we have expected.

|500x322

the cutted voltage not cleared to zero

my circuit : |500x362

to create the trigger pulse, I just use simple "blink" program which that I can manage pulse delay freely.

why this happen? What I suppose to do?

Pwm doesn't work well it's like a hit and miss kind of thing without reading the zero cross that's not to say it can't be done but to work well you need to not fire the triac till it shifts from zero so you still need to no where zero is and delay the firing.

Well I would say you can't do it with PWM because it is not synchronised with the zero crossing.

So did you use the push button to adjust the firing angle ?

Also in that blurred out part you have a direct connection to one side of the mains!

That could be fatal, don't do it.

Ninonic:
Good afternoon…
I decide to control TRIAC with PWM signal via opto coupler

so… I watched this video…
Firing angle TRIAC control

Look like very simple,
but when I did that…
the result not like we have expected.

the cutted voltage not cleared to zero

my circuit :

to create the trigger pulse, I just use simple “blink” program which that I can manage pulse delay freely.

why this happen?
What I suppose to do?

Hello there,

First off it looks like you dont have the triac connected properly. The triac two main terminals need to be connected in SERIES with the load, and i dont even see a load anywhere in that schematic. I see a snubber, but no load. The way the triac is connected in the schematic is such that when it turns on it shorts out the mains supply, which is not good and not the way it should be connected because after all you want to control the power in the LOAD, not short out the mains supply.
Also, that 10k resistor for R2 may be too high depending on what triac you are using.

So start by connecting a load in series with the triac, as that would be what you are turning on and off anyway. It looks like you have some sort of sync, but make sure it is in the right place in time relative to the sine wave.

Hi,

I have build a Arduino based and controllable dimmer.

And yes, you do need a (Opto isolated) trigger at zero-crossing into the Arduino, and again opto-isolated, a duration changed firing pulse to the Triac.

Attached you find my code and schematic’s. (Arduino IDE and TinyCad format)
I control the amount of power going into our water-heater to avoid feeding our surplus Solar energy back into the grid.

In short: We have a Wattson (They are out of business now) wireless solar power-meter.
This unit show by means of a green LED if there is surplus or not.

I use this LED-signal to (wireless) to control an Arduino based ‘dimmer’ to step-up or step-down so all the surplus energy is used in our waterheater.

So, the Wattson is connected with my ‘transmitter’.
And the ‘receiver’ is also the dimmer controller.

I did put a lot of comments in the code, so maybe it is helpfull.

Un saludo,

Satbeginner

OptiplugByCastellCorunasmet1optiplugV41i_final.ino (31.6 KB)

Wattson HighRes Loadcontroller Transmitter V1.1.zip (15.1 KB)

OptiplugByCastellCorunasTransmitterV15.ino (20.1 KB)

http://incredulist.blogspot.com/2012/11/ac-phase-control-triacs.html

I so glad for many people come here
First of all, Thanks everyone

be80be:
Pwm doesn’t work well it’s like a hit and miss kind of thing without reading the zero cross that’s not to say it can’t be done but to work well you need to not fire the triac till it shifts from zero so you still need to no where zero is and delay the firing.

Grumpy_Mike:
Well I would say you can’t do it with PWM because it is not synchronised with the zero crossing.

did you watch the video? Is it PWM? right?

As far I know PWM can’t trigger directly, thats why we use MOC optocoupler, and ya I know. I need manage delay so then TRIAC’s gate pulse sync with the main voltage phase & frequency.
my plan is using osciloscope, read signal, generate delay and sync manually. ya too conventional, and too hard too. Do you have better idea? Thanks :smiley:

Grumpy_Mike:
Also in that blurred out part you have a direct connection to one side of the mains!

That could be fatal, don’t do it.

Actually blurred area are my another experiment(previous), lets say it LCD to display time/div or volt/div… and reading pulse In to arduino, but still in use. I want focus to control firing TRIAC, so thats why
Is it still fatal ?

MrAl:
Hello there,

First off it looks like you dont have the triac connected properly. The triac two main terminals need to be connected in SERIES with the load, and i dont even see a load anywhere in that schematic. I see a snubber, but no load. The way the triac is connected in the schematic is such that when it turns on it shorts out the mains supply, which is not good and not the way it should be connected because after all you want to control the power in the LOAD, not short out the mains supply.
Also, that 10k resistor for R2 may be too high depending on what triac you are using.

So start by connecting a load in series with the triac, as that would be what you are turning on and off anyway. It looks like you have some sort of sync, but make sure it is in the right place in time relative to the sine wave.

SHARP !!!
I just replace 10k with 150. then I connect lamp series next to TRIAC. and look like I cut all positive cycle. Just negative half wave come out, I tried to vary the delay, but still not work. need to sync it !!!

Satbeginner:
Hi,

I have build a Arduino based and controllable dimmer.

And yes, you do need a (Opto isolated) trigger at zero-crossing into the Arduino, and again opto-isolated, a duration changed firing pulse to the Triac.

Attached you find my code and schematic’s. (Arduino IDE and TinyCad format)
I control the amount of power going into our water-heater to avoid feeding our surplus Solar energy back into the grid.

In short: We have a Wattson (They are out of business now) wireless solar power-meter.
This unit show by means of a green LED if there is surplus or not.

So, the Wattson is connected with my ‘transmitter’.
And the ‘receiver’ is also the dimmer controller.

I did put a lot of comments in the code, so maybe it is helpfull.

Un saludo,

Satbeginner

WOW, Thanks You :smiley:
I will look and learn for that, Salute :smiley:

Thanks, that so kind

Thanks Sir. I will read it carefully :slight_smile:

did you watch the video? Is it PWM? right?

I did watch the video. It is NOT a PWM signal.

Actually blurred area are my another experiment(previous), lets say it LCD to display time/div or volt/div... and reading pulse In to arduino, but still in use. I want focus to control firing TRIAC, so thats why Is it still fatal ?

It is hard to say because it is blurred and you can not see where it is going. Do not post schematics that are not what you have or are not true. Yes if you have connected mains directly to outside the isolated area it is fatal.

I did watch the video. It is NOT a PWM signal.

No, it is not. It is a triac gate trigger pulse and the width of that pulse is not important. It is the moment in time that it occurs that matters.

Pwm is not necessary to control the triac and wouldn't do any good anyway.

Hi again,

Actually the width of the trigger pulse is important in some respects and so has to be payed attention to also.

First, if the pulse is too narrow it will not get the triac to actually latch 'on'. This will vary for different triacs but there will be a minimum pulse width for reliable operation.

Second, if the pulse is too wide then it will cause a retriggering for low conduction angles so the entire half wave for that half cycle will appear on the output rather than just a tiny portion of the end of the last half cycle. To avoid this there has to be a maximum 'delay' time that is equal to the half cycle time minus the pulse width time, minus a little more for safety. So for example if the half cycle time was 10ms and the pulse width was 1ms, then the max delay should be 9ms minus a little more to cover slight variations in the line frequency half cycle period.

Also yes, the pulses must be synced to the line zero crossing or else it will be random and probably disruptive to the device being powered but there is also a second mode of operation that is not as critical. This second mode is where several full cycles are allowed to pass unchanged, and then several full cycles are not allowed to pass at all. This mode of operation does not regulate based on sub cycle switching but rather multiple cycle switching. This does not always work but for some applications it seems very natural. For example, many soldering iron stations use multiple cycle switching instead of sub cycle switching in order to regulate the temperature of the soldering iron.

Grumpy_Mike: I did watch the video. It is NOT a PWM signal.

raschemmel: No, it is not. It is a triac gate trigger pulse and the width of that pulse is not important. It is the moment in time that it occurs that matters.

Pwm is not necessary to control the triac and wouldn't do any good anyway.

Seems like I miss understood about PWM. PWM (pulse Width Modulator) which in arduino consist of 0 - 1024 that for generate voltage around 0 - 5.

Ok, actually I using TRIAC trigger pulse(not PWM, I miss understood the name about it) in my program like

delay(2);
digitalWrite(13,HIGH);
delay(1);
digitalWrite(13,LOW);
delay(9);

I using 50 Hz main, so it around 0.02 s or 20 ms per cycle, so I triggered in 10 ms per pulse, next need to sync the pulse to main. could be research for default delay (early delay) by looking wave in osciloscope.

MrAl: Hi again,

Actually the width of the trigger pulse is important in some respects and so has to be payed attention to also.

First, if the pulse is too narrow it will not get the triac to actually latch 'on'. This will vary for different triacs but there will be a minimum pulse width for reliable operation.

Second, if the pulse is too wide then it will cause a retriggering for low conduction angles so the entire half wave for that half cycle will appear on the output rather than just a tiny portion of the end of the last half cycle.

I looked TRIAC BT 136 datasheet, it need 0,3 ms to trigger TRIAC. So if I make 1ms pulse, I think that good enough for that.

then second, ya... its around 10ms per pulse. but need sync it first the I can configure delay for firing, is it?

OK next point, Is about the result I can't cut clear when firing a TRIAC like video did. like pic in osciloscope before, I tried fix the circuit, but still not work. any better idea?

Ninonic: Seems like I miss understood about PWM. PWM (pulse Width Modulator) which in arduino consist of 0 - 1024 that for generate voltage around 0 - 5.

Ok, actually I using TRIAC trigger pulse(not PWM, I miss understood the name about it) in my program like

delay(2);
digitalWrite(13,HIGH);
delay(1);
digitalWrite(13,LOW);
delay(9);

I using 50 Hz main, so it around 0.02 s or 20 ms per cycle, so I triggered in 10 ms per pulse, next need to sync the pulse to main. could be research for default delay (early delay) by looking wave in osciloscope.

I looked TRIAC BT 136 datasheet, it need 0,3 ms to trigger TRIAC. So if I make 1ms pulse, I think that good enough for that.

then second, ya... its around 10ms per pulse. but need sync it first the I can configure delay for firing, is it?

OK next point, Is about the result I can't cut clear when firing a TRIAC like video did. like pic in osciloscope before, I tried fix the circuit, but still not work. any better idea?

Hi,

I am not sure what you are saying here.

If you use a 1ms pulse width that is probably ok. However, if you do that then you can not use a 10ms delay you must use less than 9ms.

So typically you would use a very small delay like 10us up to the max of 9ms. A delay of 10us would turn on almost fully, while 9ms would be almost completely off. A delay of 5ms would give you roughly a 1/4 cycle, where the wave would jump up suddenly to the peak, then curve down like the second 1/4 cycle of a sine wave.

So try a delay of 5ms and see if you can get that 1/4 cycle to show up. You should get that 1/4 cycle twice per full cycle of the 50Hz line.

The power into a resistive load will be about 1/2 of the full power when triggering for 1/4 cycle on both positive and negative half cycles. The power will go up if triggering sooner (less delay) and go down if triggering later (more delay).

If the triac does not seem to be able to be turned off at all, then test the triac to make sure it is working properly.

but need sync it first the I can configure delay for firing, is it?

Not the best sentence ever produced in English.

You are wasting your time doing anything without synchronising the whole thing with the zero crossing.

Do not try and look at mains voltage on an oscilloscope unless you know what you are doing otherwise the whole thing will explode as it will short out the mains.

So write code to synchronise the delay with the zero crossing and post all of it. Update the schematic to one that shows what you actually have, no more no less.

analogWrite accepts values from 0 to 255. ( not 1024)

Grumpy_Mike:
Not the best sentence ever produced in English.

Pardon me Sir, for Bad English

Grumpy_Mike:
You are wasting your time doing anything without synchronising the whole thing with the zero crossing.

Do not try and look at mains voltage on an oscilloscope unless you know what you are doing otherwise the whole thing will explode as it will short out the mains.

I see your point. Zero cross is used to set the time when arduino generate pulse in the right time, isn’t it ?

Grumpy_Mike:
Update the schematic to one that shows what you actually have, no more no less.

I would if I could, Sir
but my design not quite ready,

I try to build power factor correction, Sir
so…
to ask whole system are so complex, maybe some people easy to explain their knowledge about that.
but in the end, even for myself is too much to understand for single Topic
so I try to learn step by step.
I hope you still help me because next are many question to answer.

so we can start it from
1st topic : controling triac with delay variation

this a little bit silly, I try to make delay (variable), but that can’t work. It so basic, but too lack of knowledge, I know that. (thats why I come here, but I hope people will nice to me even I lack of knowledege, just hoping)

2nd topic : phase detector using bitwise XOR

This time, I try to read phi angle (sometimes a.k.a alfa) to define power factor value and display on LCD.
I had problem with electronic stuff here,
actually, I have zero crossing circuit here. one for voltage sensor and current for another.
(I think I can get zero crossing from voltage sensor in this circuit, then set delay for TRIAC trigger)

but, still no have clear solution. somepeople say, it hard to make it happen, because arduino (uno) response time too slow… (read&write)

3rd topic : problem generate pulse
I try to generate TRIAC pulse here. (problem solved)

4th topic : is here
this time I want voltage control by TRIAC. but the output wave is too weird.

Thats All Sir

sorry for being bad student, please help me…

Hello again,

You might start with the simplest of all tests, which is to make sure your circuit can turn the triac fully on and fully off by using a very long pulse of say 10 seconds on, then 10 seconds off. If that does not work, then nothing will work so you will have to troubleshoot and fix that first. Once this works you can move on to the more involved timing tests. An issue that may come up is that you need to use the right gate polarity depending on the actual triac being used.

The procedure to test more thoroughly is very simple also. Start by detecting the zero crossing. Then start your delay timer. At the end of the timer period, generate a pulse to the gate of the triac.

The simplest way to start is to first detect the zero cross, then wait 5ms, then generate a pulse of 1ms width to the gate. If you do this you should see a 1/4 wave of the sine wave which will go from 90 degrees to 180 degrees, then another 1/4 wave from 270 degrees to 360 degrees which is the full cycle. You'll see that for every cycle if you did it right.

Once you get that working you can go on to try to vary the delay to values other than 5ms but dont go over 8.9ms to keep it working correctly.

If your circuit is connected properly you should see this result no problem. You can look at the pulse too as you have been doing to make sure it turns on at 90 degrees and 270 degrees.

This is a procedure which if successful will tell you that you are probably doing everything right. If not successful you'll most likely never get it to work with other delays, so troubleshoot the basic circuit first then.

Also note that you need at least some resistive load or else it may appear that the triac does not turn off correctly.

I'd like to see how well you make out with this, so please let me know how it goes.

I see your point. Zero cross is used to set the time when arduino generate pulse in the right time, isn’t it ?

Yes it is.

some people say, it hard to make it happen, because arduino (uno) response time too slow… (read&write)

That is very silly the Arduino is running at 16MHz and half a mains cycle is 100Hz, so in half a mains cycle you can have 160,000 processor instructions. That is plenty fast enough and then some.

To synchronize the program code to the zero crossing, you have to have a loop that waits until the zero crossing occurs. Use a while loop for this. What signal do you get on a zero crossing?

Then once you are at the moment in time when a zero crossing has occurred, you delay by a value that is inversely proportional to the percentage power you want, then generate the triac firing pulse. Then repeat the whole thing over and over.
That small code fragment was fine for the bit after the synchronizing while loop, if you miss out the last delay.

I have zero crossing circuit here. one for voltage sensor and current for another.

If the current and voltage are out of phase then the triac might never turn off. That is why you have power correction to bring them into ( or close to ) in phase with each other. But don’t start with an inductive load. Get your circuit to use first of all a resistive load like an incandescent light bulb.

4th topic : is here
this time I want voltage control by TRIAC. but the output wave is too weird.

No the waveforms look like that because they are not synchronized together and there is no triac firing which would cause the input waveform to collapse once it is conducting. In other words the top waveform is not measured at the correct place.

Grumpy_Mike: Not the best sentence ever produced in English.

Is english your first language ?

Grumpy_Mike: Do not try and look at mains voltage on an oscilloscope unless you know what you are doing otherwise the whole thing will explode as it will short out the mains.

And likely destroy your oscilloscope. 400 V on mine.

Can you provide a link to where you found this diagram ?