April 07, 2012

varying scr firing angle with Avr microcontroller(Proteus simulation)

        Hi friends here is the post about changing SCR firing angle control with the help of AVR microcontroller.
        You might be aware of basics of firing angle and its variation.So in a basic Firing angle variation mechanism you will need two things:  
                                                           1)ZERO CROSSING DETECTION  
                                                           2)FIRING SCR  AT DIFFERENT ANGLE
          First stage Zero crossing with AVR is damn easy thing as avr hardware supports zero-crossing detection. that means you can detect zero of 230 VAC with directly avr microcontroller and no additional hardware.
you can refer Avr's official application note to know more about zero crossing by microcontroller itself!!!! (Huh!!!!  QUESTION: How can avr tolerate 230 volts directly?
Answer: 1M resistor limits the current and internal avr diodes are used like clamper circuit.... to convert 230 volts to 5 volts that is accessible by micro-controller.)


zero crossing detection and firing angle control with avr
Zero crossing in avr with internal diodes
             now once you are through with 230v detection and generating an interrupt with the help of zero crossing, you are good to go for varying firing angle of scr.




 


After varying the firing angle you will be able to see the pulses as shown below



proteus scr firing angle
Firing angle


here is the source code to generate scr triggering pulse from microcontroller and varying it with 2 push buttons(i.e. increase or decrease firing angle) push buttons are connected to  PINA.6 and PINA.7 additionally a stop button is also used to stop SCR firing..
Stop button is connected to PINA.3 Here is the source code for that --------------------------------------------------------------------------------------------
#include"avr/io.h"
#include"delay.h" 
unsigned char stop=0;
unsigned long scrangle=0;
ISR(INT0_vect)
{
if (stop==0)
        {
        delayus(scrangle);
        PORTB=PORTB|0x01;
        delayus(1000);
        PORTB=PORTB &0xFE;
        }
}  void main()
   
     SREG=SREG|0x80;        //global interrupt enable  
     PORTA=0xFF;            // configuering the PORTA in pullup mode.
     DDRA=0x00;                // Port A data direction configuration as input port. 
    MCUCR=MCUCR|0x01;        // logic change  in pin generates an interrupt(hardware interrupt 0) 
    GICR=GICR|0x40;            //enable the interrupt 0 
        if((PINA & 0x80)==0x00)  //decrease firing angle
        {
            if(scrangle>0)
            {
                scrangle=scrangle-100;
            }
        }
        if ((PINA & 0x40)==0x00)    //increase firing angle
         {
            if(scrangle<8000)
            {
                scrangle=scrangle+100;
            }
           
         }
        if((PINA & 0x08)==0x00)    //reset pin to stop
            {
            stop=1;
            }
     } 
} 
 ------------------------------------------------------------------------------------------------------
Here is the output waveforms you can see a pulse generated by micro-controller on zero-crossing detection..

zero crossing with micro-controller
Pulse generated by Micro-controller on zero-crossing.


Thats all I have to say.
But remember some points guys...

1)You are playing with Mains power supply so be very very careful.
2)Ground of microcontroller and mains are not good isolated.
3)This is only pulse generation by microcontroller if you need to apply this pulse to SCR you have to put some conditioning circuit.

3 comments:

  1. Hi,
    Can you please send me some some info on program that you have used for your circuit simulation in above pictures.
    My email is amrit_13588@yahoo.com

    ReplyDelete
  2. thanks for great work
    it's really use full
    but small question about the circiut connection

    ReplyDelete
  3. Can u please upload the Hex file.. For this Project Thank You

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...