In this project i have converted old manual type voltage stabilizer into automatic using msp430g2553 ,uln,relays..etc.
CIRCUIT
PROGRAM
//210-235-265 –SELECTED TAPS WHEN INPUT IS AT 210V AC
//210–0.68V -210 — ON HOLD
//210–0.73V ON RELEASE
//210-235-265
//210–0.68V -210 — ON HOLD
//210–0.73V ON RELEASE
#define lowertap P2_3
#define middletap P1_3
#define uppertap P1_4
int f=1,a;
void setup()
{
Serial.begin(9600);
initoutputpins ();
offallrelay();
digitalWrite(lowertap,HIGH);delay(2000);
f=1;
}
void loop()
{
a=analogRead(A0); delay(10); //Serial.println(a); delay(100);
if(a>=211 && a<250 && (f==2 || f==3) ) { offallrelay();delay(2000); digitalWrite(lowertap,HIGH); delay(2000); f=1; }
else if(a>185 && a<=210 &&(f==1 || f==3) ) { offallrelay();delay(2000); digitalWrite(middletap,HIGH); delay(2000); f=2;
while( a<220 && a>186 ){a=analogRead(A0); delay(10);}
}
else if (a<=186 &&( f==1 || f==2) ) { offallrelay(); delay(2000); digitalWrite(uppertap,HIGH); f=3; delay(2000);
while( a<193 ){a=analogRead(A0); delay(10);}
}
}
void initoutputpins (void)
{
pinMode(lowertap,OUTPUT); pinMode(middletap,OUTPUT); pinMode(uppertap,OUTPUT);
}
void offallrelay(void)
{
digitalWrite(lowertap,LOW);digitalWrite(middletap,LOW);digitalWrite(uppertap,LOW);
}
PCB LAYOUT