AC Power Control with Thyristor: Pulse Skipping using triac with PIC16F877A

Pulse Skipping Modulation
Green - Input AC
Yellow - Output AC after Pulse Skipping Modulation
Pink - Gate Drive Signal

Pulse skipping modulation (PSM) or cycle control or burst fire is a method of power control where whole cycles of voltage are applied to the load. Here I’ll talk about PSM involving a thyristor, specifically a triac. The triac connects the AC supply to the load for a given number of cycles and then disconnects the AC supply for another given number of cycles. It has of course become quite obvious from the title that the purpose of PSM is to control or limit power to the load.

We know that the thyristor is a latching device – when the thyristor is turned on by a gating signal and the current is higher than the holding current and the latching current, the thyristor stays on, until the current through it becomes sufficiently low (very close to zero). The thyristor turns off when current through it becomes zero, as happens at the AC mains zero crossing. This is the natural line commutation. (Another method of turning the thyristor off is by forced commutation. I won’t go into that now.) The assumption here is that the load is resistive and has little to no inductance. Of course, this is not always the case, as inductive loads are often used. However, I’ll work with this assumption for now.

Now, with that covered, you should read this article first before proceeding to the rest of this article:

Zero crossing detection with PIC16F877A

I’ve added the circuit, code and simulation of an example later in this article. And that uses a triac as the power device. So, from now on, I’ll just refer to the triac instead of talking about a thyristor in general.

So, in pulse skipping modulation (PSM) or cycle control, the load receives power for a number of cycles, during which time the triac is on, and does not receive power for another number of cycles, during which time the triac is off. When the triac is to be turned on, the gating signal to the triac is given right after zero-crossing. The triac then stays on until the current through it becomes zero (natural line commutation). This is at the next zero crossing. For simplicity’s sake and as usually should be, assume that the current through the triac (when on) is larger than the latching current and the holding current. If you didn’t already know this, the latching current is the current that must pass through the triac right after it is turned on to ensure that it latches. The holding current is the current level through the triac below which the triac will turn off. So, the assumption that current through the triac is higher than the latching current and the holding current means that the triac stays on once it is fired on. It stays on until the current through it is zero.


Let’s say that we are going to control over 5 complete cycles, that is, 10 half-cycles. My AC input voltage is 220V RMS, is sinusoidal in shape and has 50Hz frequency.

So, the principle is that we are going to supply voltage to the load for a certain number of cycles. Let’s say we’ll supply voltage for 3 cycles and will shut supply to the load off for 2 cycles. This is a duty cycle of 60%. The duty cycle is defined as the ratio (expressed in percentage) of the number of on cycles to the total number of cycles we are controlling.

The output RMS voltage is related to the supply voltage by the relationship:
where   Vout = Output RMS voltage
                Vs = Supply RMS Voltage
                k = duty cycle

The output is related to the voltage by the relationship P = V2/R. So, assuming a constant resistance, power is directly proportional to the square of the voltage. So, if you half the voltage, the power is not halved, but is reduced to one-fourth the original power! One-fourth power with half the voltage! But the general idea is that, by controlling the output voltage, you can control the output power.

So, using the previous values, where we have a duty cycle of 60% and a 220V RMS input voltage, the RMS output voltage is:

Now let’s consider the ratio of the powers. P = V2/R. Therefore, by using pulse skipping modulation, the power changed by changing the voltage is related by:


This means that if you had a resistance R as load, and if the power was P when the voltage supplied was Vs, using PSM with a duty cycle of 0.6 decreased the power to 0.6P – using PSM we changed the output voltage and thus output power.

Now let’s now go on to the design part – how we’re actually going to do this.

For the microcontroller, I’ve chosen the extremely popular PIC 16F877A. However, since this application requires only a few pins, you can easily use any other small microcontroller for this purpose, such as PIC 12F675.

The zero-crossing is done using the bridge-optocoupler method as I had previously shown. For details regarding the zero-crossing, please go through the article:
Zero crossing detection with PIC16F877A

Now, let’s take a look at the code:
//---------------------------------------------------------------------------------------------------------
//Programmer: Syed Tahmid Mahbub
//Compiler: mikroC PRO for PIC v4.60
//Target PIC: PIC16F877A
//Program for pulse skipping modulation or cycle control
//---------------------------------------------------------------------------------------------------------
unsigned char FlagReg;
unsigned char Count;
unsigned char TotalCount;
unsigned char nCount;
unsigned char nTotalCount;
sbit ZC at FlagReg.B0;

void interrupt(){
     if (INTCON.INTF){          //INTF flag raised, so external interrupt occured
        ZC = 1;
        INTCON.INTF = 0;
     }
}

void main() {
     PORTB = 0;
     TRISB = 0x01;              //RB0 input for interrupt
     PORTA = 0;
     ADCON1 = 7;
     TRISA = 0xFF;
     PORTD = 0;
     TRISD = 0;                 //PORTD all output
     OPTION_REG.INTEDG = 0;      //interrupt on falling edge
     INTCON.INTF = 0;           //clear interrupt flag
     INTCON.INTE = 1;           //enable external interrupt
     INTCON.GIE = 1;            //enable global interrupt
    
     Count = 6;                 //number of half-cycles to be on
     TotalCount = 10;           //total number of half-cycles control
     nCount = Count;
     nTotalCount = TotalCount;

     while (1){
           if (ZC){ //zero crossing occurred
              if (nCount > 0){
                 PORTD.B0 = 1;
                 delay_us(250);
                 PORTD.B0 = 0;
                 nCount--;
              }
              nTotalCount--;
              if (nTotalCount == 0){ //number of required half-cycles elapsed
                 nTotalCount = TotalCount;
                 nCount = Count;
              }
              ZC = 0;
           }
     }
}

The total number of half-cycles I want to control is stored in the register TotalCount. Count holds the number of half-cycles I want voltage supplied to the load. So, the ratio of Count to TotalCount equals the duty cycle.

Each time the triac is fired, the value of nCount is decremented, until it reaches zero. When nCount equals zero, the triac is no longer fired. At the same time, the register nTotalCount is decremented each zero-crossing. So it keeps track of the number of half-cycles elapsed. Initially nTotalCount is loaded with the value of TotalCount so that nTotalCount keeps track of the number of half-cycles we want to control. After that number of half-cycles elapses, nTotalCount is reloaded with the value of TotalCount and nCount is reloaded with the value of Count. Pulse skipping modulation starts over again.

In our code, we want to control 10 half-cycles, which means 5 cycles. We want voltage to be supplied to the load for 3 cycles and off for 2 cycles. This is done, as nCount counts down from 6 to 0 while firing the triac, firing the triac 6 consecutive half-cycles. For the next 4 half-cycles, while nTotalCount is still counting down to zero, the triac is off. So, voltage is not supplied to the load. The duty cycle is 60%.

The triac is fired right after zero-crossing occurs. One advantage of this is that very little radio frequency interference is produced. However, care must be taken that an unequal number of positive and negative half-cycles must not be present. This will introduce a DC component that can damage motors and other devices. Cycle control also cannot be used with incandescent bulbs because of high unacceptable flickering.

This problem with the DC component is avoided by ensuring that equal numbers of positive and negative half-cycles are present. This is done by ensuring that the Count and TotalCount (in the code above) are both even numbers.

Now let’s take a look at my circuit setup and then the output waveform using this code:

Fig. 1 - Circuit Diagram (Click on image to enlarge)


You should choose R1 depending on the gate current requirements of the triac. It must also have a sufficiently high power dissipation rating. Usually, the instantaneous power may be very high. But since current flows through the resistor for only 250us (1/40 of a 50Hz half cycle), the average power is small enough. Usually, 2W resistors should suffice.

Let’s assume we’re using a BT139-600 triac. The maximum required trigger current is 35mA. Although the typical trigger current is lower, we should consider the maximum required trigger current. This is 35mA for quadrants I, II and III. We will only be firing in quadrants I and III. So, that is ok for us – we need to consider 35mA current.

If you aren’t sure what quadrants are, here’s a short description. First take a look at this diagram:

Fig. 2 - Triac Triggering Quadrants

If you look back again at the diagram, you’ll see that we’re driving gate from MT2. So, we can say that, with respect to MT1, when MT2 is positive, so is the gate. With respect to MT1, when MT2 is negative, so is the gate. From the diagram above, you can see that these two cases are in quadrants I and III. This is what I meant when I mentioned that we’re driving only in quadrants I and III.

The driver in the circuit is the MOC3021. This is a random phase optically isolated triac driver output. When the LED is turned on, the triac in the MOC3021 turns on and drives the main triac in the circuit. It is a “random phase” driver meaning that it can be driven on at any time during the drive signal. There are other drivers that only allow drive at the zero-crossing. These can also be used for PSM as the triac is only driven at zero-crossing. For guaranteeing that the triac is latched, the LED side of the MOC3021 must be driven with at least 15mA current. The maximum current rating for the LED is 60mA. The peak current rating for the triac is 1A. You should find that we have stayed within these limits in the design.

Here’s the output waveform:

Fig. 3 - PSM - 3 cycles on out of 5 complete cycles

Green: Input AC
Yellow: AC Output after pulse skipping modulation
Pink: Gate Drive signal




You can clearly see that out of every 5 complete cycles, the output consists of 3 complete cycles and 2 are missing – these are when the triac is off. Notice that the triac is fired 6 times in every 5 complete cycles – the triac is on for 6 half-cycles and off for the next 4 half-cycles.

Now, let’s look at a few other cases.

Here’s the output with 3 complete cycles on out of every 4 complete cycles:

 Fig. 4 - PSM - 3 cycles on out of 4 complete cycles

Green: Input AC
Yellow: AC Output after pulse skipping modulation
Pink: Gate Drive signal



Here’s the output with 5 complete cycles on out of every 7 complete cycles:

Fig. 5 - PSM - 5 cycles on out of 7 complete cycles

Green: Input AC
Yellow: AC Output after pulse skipping modulation
Pink: Gate Drive signal



Here’s the output with 1 complete cycle on out of every 3 complete cycles:

Fig. 6 - PSM - 1 cycle on out of 3 complete cycles

Green: Input AC
Yellow: AC Output after pulse skipping modulation
Pink: Gate Drive signal



Here’s the output with all complete cycles on:

 Fig. 7 - PSM - all cycles on

Green: Input AC
Yellow: AC Output after pulse skipping modulation
Pink: Gate Drive signal




Here in this article, I’ve talked about pulse skipping modulation – also known as cycle control or burst fire – with some background information on triacs. I’ve shown how to implement pulse skipping modulation / cycle control / burst fire with a PIC and also how to calculate the RMS voltage of the output. I hope I’ve been able to explain this important topic to you clearly and hope that you can now successfully build your own power control circuits using pulse skipping modulation (or cycle control or burst fire) with triacs.

Comments

Popular posts from this blog

Using the TLP250 Isolated MOSFET Driver - Explanation and Example Circuits

N-Channel MOSFET High-Side Drive: When, Why and How?

Using the high-low side driver IR2110 - explanation and plenty of example circuits