Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Designing Automatic Voltage Stabilizers

Status
Not open for further replies.
Re: Voltage Stabilizer using microcontrollers.

under over voltage setting is fix in hex file.
you don't need to set under over voltage setting according to that hex file.
 

Re: Voltage Stabilizer using microcontrollers.

Hi

I think you will find all the information if you study below all the post. Further we will help you more, when you described your details.

Thanks
 

Re: Voltage Stabilizer using microcontrollers.

How can I change the delay 5Min and 3Sec. Thanks Alotzzzz,

- - - Updated - - -

How can I change timmer to 5Min and 3Sec; Thankzzzzz
 

Re: Voltage Stabilizer using microcontrollers.

do you have static voltage regulator design (SVR) ??
static-stab-principle.jpg
 
Re: Designing Automatic Voltage Stabilizer

Mr. irfan ahmad
I liked the circuit developed by you using pic16f676
But why when Brutus tried to operate at low voltage stop all
relays????
I ask you to help me.
Thank you my friend
 

Re: Designing Automatic Voltage Stabilizer

sorry irfan.
proteus 8 professional.

look at this my friend
**broken link removed**
all relays Works at 2.3v

and look at this
**broken link removed**
all relays off Except 9 at 1.6v
 

Re: Designing Automatic Voltage Stabilizer

this software is basically PID controller.
software read output voltage and check if these are less or grater then set points .
after checking decide either on any relay or off.
*********************************************
for checking of this software you should require a variable transformer to change input voltage.
proteus does still not have variable AC voltage source or maybe i don't know about it .
if anybody can solve this matter then simulation will possible.
 

Re: Designing Automatic Voltage Stabilizer

Do you have mikro C code irfan Please

- - - Updated - - -

Thank you jayanth.devarayanadurga
 
Re: Designing Automatic Voltage Stabilizer

Can you post the Source code for the Circuit
 

Re: Designing Automatic Voltage Stabilizer

Add my voice to srenjis
Thanks for your help irfan
 

Re: Designing Automatic Voltage Stabilizer

This is source code.
compiler is ccs pic c . THIS COMPANY https://www.ccsinfo.com/content.php?page=compilers


Code:
//////////////////////////////////////////////////
/*
              ----v----
       +B < 1 |       | 14 > -B
       A5 < 2 |       | 13 > A0 > AN0     adc input
       A4 < 3 |       | 12 > A1 > AN1     relay1
       A3 < 4 |       | 11 > A2 > AN2     relay2
       C5 < 5 |       | 10 > C0 > AN4     relay3
       C4 < 6 |       |  9 > C1 > AN5     relay4
 AN7 < C3 < 7 |       |  8 > C2 > AN6     led
              ---------
*/
/////////////////initialization/////////////////////
   #include	<16f676.h>
   #device     adc=10
   #use        delay(clock=4000000)
   #fuses      intrc_io
   #fuses	   NOWDT,PUT,NOPROTECT,BROWNOUT,NOMCLR

/////////////////////pins  lables///////////////////

   #define     relay1   pin_a1      //main   change
   #define     relay2   pin_a2      //main   change
   #define     relay3   pin_c0      //outputchange
   #define     relay4   pin_c1      //output on off
   #define     led      pin_c4      //
   #define     sw       pin_a3      //active low



   #define     low_limit      1550  // limit for low  voltage
   #define     high_limit     2450  // limit for high voltage
   #define     low_ok         2100  // value for main low  function compleate
   #define     high_ok        2440  // value for main high function compleate
   

///////////////////labling of syntex////////////////

   #define  on       output_high
   #define  off      output_low
   

////////////////////////////////////////////////////
   unsigned int32 main_v=1000,count;

   unsigned int8  step=1,time=0,x;
   int1           fault=0;
   unsigned int8  delay=30;

////////////////////////////////////////////////////
   void adc_read  (void);

   void relay_Set (void);

   void main_high (void);

   void main_low  (void);  
   
   void initialize(void);
   
   void  start_up (void);


/////////////////////timer1 isr//////////////////////
   #int_timer1

   void  timer1_subrutine(void)
{
   set_timer1(65536-62500);         // after 0.5S interrupt will rise

        time++;

         output_toggle(led);

            if (((time>delay)||(input(sw)==0))  &&  (fault==0)) 
   {
   
                  time=0;                          // for next round

                     on(led);

                        on(relay4);
   
                        disable_interrupts(int_timer1);

                            disable_interrupts(global);}
}

////////////////////////////////////////////////////////
   void  main()
{
   initialize();
   
   WHILE(1)
{
       start_up();
////////////////////normal loop///////////////////////////////

   do
{
   for(x=0; x<20; x++)                               //loop to perform voltage stabalization function
                                                     // if gap is larg then  only one step can not stabal voltage
{
  
      adc_read();

         if(main_v>2410)

               {step--;  if(step<1)step=1; relay_set();}     //239V

                   else if(main_v<1630)                      //200V

                     {step++; if(step>6)step=6;relay_set();}

                        else;
}
}
   while((main_v<high_limit)&&(main_v>low_limit));  // check  the limits

/////////////////////under over section///////////////////////

   fault=1;

         time=0;                                          // reset timer if it was running

         if(main_v>=high_limit)         main_high();      // call  relevent function

            else if(main_v<=low_limit)     main_low();    // call  relevent function

               disable_interrupts(int_timer1);            // reset timer and interrupt

                  disable_interrupts(global);

                           fault=0;
}

                     
}

///////////////////////////////////////////////////////////////
   void main_low  (void)
{
   enable_interrupts(int_timer1);
       enable_interrupts(global);

         off(relay4);

            off(relay3);

               off(relay2);

                off(relay1);

                  delay_ms(500);


                  while(main_v<low_ok)
{

                        time=0;

                           adc_read();

}
}
///////////////////////////////////////////////////////////////
   void main_high (void)
{
   enable_interrupts(int_timer1);

      enable_interrupts(global);

         off(relay4);

            on(relay1);

               on(relay2);

                on(relay3);

                  delay_ms(500);

                     while(main_v>= high_ok)
{

                         time=0;

                               adc_read();

}
}

///////////////////////////////////////////////////////////
   void adc_read  (void)

{
   delay_ms(20);

      main_v =read_adc();

         main_v=main_v*5000/1023;
}

 ////////////////////////////////////////////////////////////////////////////////
 void    initialize  (void)
{
   off(relay4);

      on(relay1);

         on(relay2);

            on(relay3);
/////////////input output setting////////////////////
   set_tris_a(0b11110001);

      set_tris_c(0b11111000);

         output_float(pin_a0);

            setup_adc(adc_clock_div_64);

               SETUP_ADC_PORTS(sAN0 ) ;

}
///////////////////////////////////////////////////////////////////////////////////
void     start_up    (void)
{
   delay_ms(100);

      adc_read();

         setup_timer_1(t1_internal | t1_div_by_8);

            enable_interrupts(int_timer1);

               set_timer1(65536-62500);                  //initialize for correct time

                  enable_interrupts(global);                //unmasked interrupts enable

}

///////////////////////////////////////////////////////////
  void   relay_set   (void)
  {

if(step==1)

 { on(relay1);
   on(relay2);
   on(relay3);}

   else if(step==2)
        {on(relay1);
         on(relay2);
         off(relay3);}

      else if (step==3)
           {on(relay1);
            off(relay2);
            on(relay3);}

          else if (step==4)
               {on(relay1);
                off(relay2);
                off(relay3);}

             else if (step==5)
                  {off(relay1);
                   off(relay2);
                   on(relay3);}

                else if (step==6)
                     {off(relay1);
                      off(relay2);
                      off(relay3);}

                     else;
                      }
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
 
Re: Designing Automatic Voltage Stabilizer

This is source code.
compiler is ccs pic c . THIS COMPANY https://www.ccsinfo.com/content.php?page=compilers


Code:
//////////////////////////////////////////////////


/*
              ----v----
       +B < 1 |       | 14 > -B
       A5 < 2 |       | 13 > A0 > AN0     adc input
       A4 < 3 |       | 12 > A1 > AN1     relay1
       A3 < 4 |       | 11 > A2 > AN2     relay2
       C5 < 5 |       | 10 > C0 > AN4     relay3
       C4 < 6 |       |  9 > C1 > AN5     relay4
 AN7 < C3 < 7 |       |  8 > C2 > AN6     led
              ---------
*/
/////////////////initialization/////////////////////
   #include	<16f676.h>
   #device     adc=10
   #use        delay(clock=4000000)
   #fuses      intrc_io
   #fuses	   NOWDT,PUT,NOPROTECT,BROWNOUT,NOMCLR

/////////////////////pins  lables///////////////////

   #define     relay1   pin_a1      //main   change
   #define     relay2   pin_a2      //main   change
   #define     relay3   pin_c0      //outputchange
   #define     relay4   pin_c1      //output on off
   #define     led      pin_c4      //
   #define     sw       pin_a3      //active low



   #define     low_limit      1550  // limit for low  voltage
   #define     high_limit     2450  // limit for high voltage
   #define     low_ok         2100  // value for main low  function compleate
   #define     high_ok        2440  // value for main high function compleate
   

///////////////////labling of syntex////////////////

   #define  on       output_high
   #define  off      output_low
   

////////////////////////////////////////////////////
   unsigned int32 main_v=1000,count;

   unsigned int8  step=1,time=0,x;
   int1           fault=0;
   unsigned int8  delay=30;

////////////////////////////////////////////////////
   void adc_read  (void);

   void relay_Set (void);

   void main_high (void);

   void main_low  (void);  
   
   void initialize(void);
   
   void  start_up (void);


/////////////////////timer1 isr//////////////////////
   #int_timer1

   void  timer1_subrutine(void)
{
   set_timer1(65536-62500);         // after 0.5S interrupt will rise

        time++;

         output_toggle(led);

            if (((time>delay)||(input(sw)==0))  &&  (fault==0)) 
   {
   
                  time=0;                          // for next round

                     on(led);

                        on(relay4);
   
                        disable_interrupts(int_timer1);

                            disable_interrupts(global);}
}

////////////////////////////////////////////////////////
   void  main()
{
   initialize();
   
   WHILE(1)
{
       start_up();
////////////////////normal loop///////////////////////////////

   do
{
   for(x=0; x<20; x++)                               //loop to perform voltage stabalization function
                                                     // if gap is larg then  only one step can not stabal voltage
{
  
      adc_read();

         if(main_v>2410)

               {step--;  if(step<1)step=1; relay_set();}     //239V

                   else if(main_v<1630)                      //200V

                     {step++; if(step>6)step=6;relay_set();}

                        else;
}
}
   while((main_v<high_limit)&&(main_v>low_limit));  // check  the limits

/////////////////////under over section///////////////////////

   fault=1;

         time=0;                                          // reset timer if it was running

         if(main_v>=high_limit)         main_high();      // call  relevent function

            else if(main_v<=low_limit)     main_low();    // call  relevent function

               disable_interrupts(int_timer1);            // reset timer and interrupt

                  disable_interrupts(global);

                           fault=0;
}

                     
}

///////////////////////////////////////////////////////////////
   void main_low  (void)
{
   enable_interrupts(int_timer1);
       enable_interrupts(global);

         off(relay4);

            off(relay3);

               off(relay2);

                off(relay1);

                  delay_ms(500);


                  while(main_v<low_ok)
{

                        time=0;

                           adc_read();

}
}
///////////////////////////////////////////////////////////////
   void main_high (void)
{
   enable_interrupts(int_timer1);

      enable_interrupts(global);

         off(relay4);

            on(relay1);

               on(relay2);

                on(relay3);

                  delay_ms(500);

                     while(main_v>= high_ok)
{

                         time=0;

                               adc_read();

}
}

///////////////////////////////////////////////////////////
   void adc_read  (void)

{
   delay_ms(20);

      main_v =read_adc();

         main_v=main_v*5000/1023;
}

 ////////////////////////////////////////////////////////////////////////////////
 void    initialize  (void)
{
   off(relay4);

      on(relay1);

         on(relay2);

            on(relay3);
/////////////input output setting////////////////////
   set_tris_a(0b11110001);

      set_tris_c(0b11111000);

         output_float(pin_a0);

            setup_adc(adc_clock_div_64);

               SETUP_ADC_PORTS(sAN0 ) ;

}
///////////////////////////////////////////////////////////////////////////////////
void     start_up    (void)
{
   delay_ms(100);

      adc_read();

         setup_timer_1(t1_internal | t1_div_by_8);

            enable_interrupts(int_timer1);

               set_timer1(65536-62500);                  //initialize for correct time

                  enable_interrupts(global);                //unmasked interrupts enable

}

///////////////////////////////////////////////////////////
  void   relay_set   (void)
  {

if(step==1)

 { on(relay1);
   on(relay2);
   on(relay3);}

   else if(step==2)
        {on(relay1);
         on(relay2);
         off(relay3);}

      else if (step==3)
           {on(relay1);
            off(relay2);
            on(relay3);}

          else if (step==4)
               {on(relay1);
                off(relay2);
                off(relay3);}

             else if (step==5)
                  {off(relay1);
                   off(relay2);
                   on(relay3);}

                else if (step==6)
                     {off(relay1);
                      off(relay2);
                      off(relay3);}

                     else;
                      }
//\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\

i change ur code s my pcb .
those change re s below
PHP:
          O = Output, I = Input
                    _________
              Vdd   | 1  14 |  Vss
  (I) SW1 --> RA5   | 2  13 |  AN0 <-- ADC_Value (I) For O\P feed bauck
  (I) SW2 --> RA4   | 3  12 |  RA2 --> RL1 (O)   
             MCLR   | 4  11 |  N\C
  (O)  L1 <-- RC5   | 5  10 |  RC0 --> RL2 (O)
  (O)  L1 <-- RC4   | 6   9 |  RC1 --> RL3 (O)
  (O) BZR <-- RC3   | 7   8 |  RC2 --> RL4 (O)
                    ---------
but relay doing tik tak tik tak sound .
 
Re: Designing Automatic Voltage Stabilizer

only 1 step work fine
step 6 & when i increas i\p volt . mcu sence step 5.
then relay doing tik tak tik tak sound .
There is only 4 relays. Other is LED (rc4) and it starts blinking when out of range. If you connect a relay to this pin, it will start to do "tic tic".
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top