Monday, 17 September 2012

PWM with microcontroller 8051 for SCR or triac power control


The project "PWM with microcontroller 8051 for SCR or triac power control" can be used for two applications.
1. To control AC load's power with SCR or triac by controlling the firing angle or duty cycle for two channels.
2. The project as it is can be used as digital to analog converter "DAC" for two channels.

This project is currently output two PWM signals but can be extended to many PWM signals very easy. The input to the microcontroller is 100HZ pulses as zero crossing.

The project can be used to control the heating of AC heater also.
currently it is build for two channel DAC, the input at port1 and port2 of microcontroller is converted to 0 - 5v accordingly. But if it is desired to control the SCR, then OP-AMP circuit will be removed and optocoupler moc3020 will be used for interfacing SCR or triac.

The circuit diagram of PWM with microcontroller 8051 for SCR or triac power control is as under:







The code of program for PWM with microcontroller 8051 for SCR or triac power control is written c lanuage using keil compiler. The c-code for PWM is as follows.
/* This project is develop to generate two seperate channel PWM signals at 50HZ frequency
The duty cycle of the pulses is variable subject to the input on Port1 and port2.
The output PWM signal can be used to drive SCR or triacs to control the phase angle and power of any load with suitable hardware interface.
Please not that in this project the OPAMP are used to convert the pulses to 0 - 5 V, means you can use it in as two channel DAC also.
But for triac or SCR interface the OPAMP circuit will be re-placed with proper optocoupler like moc3020 and scrs.89c51 as pwm controller
*/

#include<at89x52.h>
unsigned char ch_count[2];// two channel counts array
unsigned char ch_duty_level[2];// level of the duty cycle
bit int_10ms;// this is a flag wich is set every 10msec time period
sbit PWM1 = P3^6;
sbit PWM2 = P3^7;
sbit indicator = P3^5;
void external_interrupt (void) interrupt 0
// external interrupt for zero crossing dectection
{
ch_count[0]=ch_duty_level[0];
// on zero crossing detection, counts are updated for both PWM channels
ch_count[1]=ch_duty_level[1];
PWM1=0; // the output is active low
PWM2 =0;//89c51 as pwm controller
int_10ms = 1; // 10msec flag is set
}
void timer_interrupt (void) interrupt 1
// The timer 0 is used for the duty cycle adjustement of two channel PWM
{
TL0 = 0XE2; //reset timer LSB

if(--ch_count[0]==0) PWM1 = 1;
// each time the timer interrupt occur the counts are decreased by one and on reaching zero
if(--ch_count[1]==0) PWM2 = 1;
// the outputs are turned off, as the out put is active low

}
void main (void)
{

ET0 = 1; // enables the Timer 0 interrupt of 8051
TMOD = 0x02;
// timer mode register, timer 0 is used in mode 2
TL0 = 0XE2; // Initialize timer0 LSB
TR0 = 1; // timer 0 is activated
EX0 = 1; // external inturpt is activated
IT0 = 1;
EA = 1;
ch_duty_level[0] = 30; // dummy value for duty cycle for PWM 1
ch_duty_level[1] = 60; // dummy value for duty cycle for PWM 2
while (1) // endless loop
{
if( int_10ms){
int_10ms = 0;
ch_duty_level[0] = P1;
// take the input value of duty cycle for PWM 1 fromport1 of the 8051
ch_duty_level[1] = P2;
// take the input value of duty cycle for PWM 2 fromport1 of the 8051
indicator =~ indicator;
}
}
}




solenoid valve atmel dc control triac,dimmer bt138,uln2003 microcontroleur interfacing a microprocessor to a power thyristor microcontrol based level mesurement 89c51 as pwm controller,at89c2051 sine wave pwm

4 comments:

Zabie said...

Maybe you still have proteus design? (for triac or scr) Would be really helpful. Great work anyway!

Anonymous said...

hello Raj!please can u send me the code on firing angle control of three phase thyristor(SCR) control converter if you have one.
e-mail: adurojasamuel@yahoo.com
phone: +237062327605
A final year student in one of Nigerian's university

Anonymous said...

Howdy! I could have sworn I've been to this blog before but after browsing through some of the post
I realized it's new to me. Anyhow, I'm definitely glad I found
it and I'll be bookmarking and checking back often!


Also visit my blog post :: blackbox rdp vps

Anonymous said...

If you want to take a great deal from this paragraph then you have
to apply such methods to your won weblog.



Have a look at my homepage ... รับจำนองบ้าน