16F676 BASED 90-290 VAC 5 STEP AUTOMATIC DIGITAL STABLIZER

Status
Not open for further replies.
For the voltage sensing part, I have two options:
1) Scale down the AC. Convert it to DC. Measure the voltage with microcontroller. This is the peak voltage. So dividing by 1.414 gives me AC RMS voltage. I can do without dividing by just considering the corresponding peak values.
2) Use the microcontroller to calculate the RMS voltage by sensing zero crossing, sampling multiples times and finding the square root of the average of the squares of the samples.

The first method is easier, and since, I'm pretty sure input waveform will always be sine, then I think that should be okay.
 

If you have a nonvolatile memory inside the uC or outside of it then you can put the uC in the setting mode (by shorting a pin for example) then you can let the uC save the trip points (for up and down) by using an autotransformer and by shorting some pins (like a keypad) to let it know which trip point needs to be saved.

If your external components are of very good quality then the saved numbers (of the trip points) can be copied into the software with no need for the setting process when producing more boards.
 
Last edited:

This is just a drawing for Vout versus Vin (mains); one for upward Vin and the other for downward.
 

Attachments

  • Vout-Vmains_up.pdf
    5.5 KB · Views: 414
  • Vout-Vmains_down.pdf
    5.5 KB · Views: 323
this is a part of a progran that i have use for mesure AC voltage (190->260v)
i use a 230v -> 9v trafo for mesure, the output is via a diode bridge connected on a resistor divider (bridge 9V ---> 8k -->pin A0<-- 1k --> gnd)
A1 pin is connected to the zero crossing measurement optocopler (bridge 540ohm--> LedDod --> gnd)(out--> A1)

Code:
#define UComp 3
#define UComp1 0.04
#define UCompMin 190
#define UCompMax 240


#define Led0_on			output_bit(PIN_E0,0)
#define Led0_off		output_bit(PIN_E0,1)
#define rel_Ry0_on      output_bit(PIN_E1,1)
#define rel_Ry0_off     output_bit(PIN_E1,0)
#define rel_Ry1_on      output_bit(PIN_E2,1)
#define rel_Ry1_off     output_bit(PIN_E2,0)
#define U_nul           input(PIN_A1)


void Rel_0_on()
 {
		while (U_nul); 
		while (!U_nul); 
		delay_us(4300);
		Rel_Ry0_on;
		delay_ms(20);
 }

void Rel_1_on()
	  {
		while (U_nul); 
		while (!U_nul); 
		delay_us(4300);
		Rel_Ry1_on;
		delay_ms(20);
	  }

void Rel_0_off()
 {
	RelFlg0=0;
	while (U_nul); 
	while (!U_nul); 
	delay_us(6500);
	Rel_Ry0_off;
	delay_ms(20);
 }

void Rel_1_off()
 {
	RelFlg1=0;
	while (U_nul); 
	while (!U_nul); 
	delay_us(6500);
	Rel_Ry1_off;
	delay_ms(20);
 }

float read_voltage()
 {
	float	Ut,U1,U2,U3,U4,U5,U6,U7;
	float	U8,U9,U10,U11,U12,U13,U14;
	while (U_nul); 
	while (!U_nul); 
    delay_us(4000);
    output_bit(PIN_B2,0);
    U1 = Read_ADC();
	delay_us(250);
    U2 = Read_ADC();
	delay_us(250);
    U3 = Read_ADC();
	delay_us(250);
    U4 = Read_ADC();
	delay_us(250);
    U5 = Read_ADC();
	delay_us(250);
    U6 = Read_ADC();
	delay_us(250);
    U7 = Read_ADC();
	delay_us(250);
    U8 = Read_ADC();
	delay_us(250);
    U9 = Read_ADC();
	delay_us(250);
    U10 = Read_ADC();
	delay_us(250);
    U11 = Read_ADC();
	delay_us(250);
    U12 = Read_ADC();
	delay_us(250);
    U13 = Read_ADC();
	delay_us(250);
    U14 = Read_ADC();
    output_bit(PIN_B2,1);
	Ut=(U1+U2+U3+U4+U5+U6+U7+U8+U8+U9);
	Ut=(Ut+U10+U11+U12+U13+U14)/15;
	Ut=Ut*AdcConst/Utrim;
    return(Ut);
 }

float read_voltage_80ms()
 {
	float  Ut,U1,U2,U3,U4;
	U1=read_voltage();
	U2=read_voltage();
	U3=read_voltage();
	U4=read_voltage();
	Ut=(U1+U2+U3+U4)/4;
// mesuretrafo compensation
	Utval=Ut;
	if (Ut<=UCompMin)
		Ut=Ut+UComp;
	else
		if ((Ut>UCompMin)&&(Ut<UCompMax))
			{
			Ut=Ut+((UCompMax-Ut)*UComp1);
			}
	Utcompval=Ut;
	if (Ut > NetUmax)
	 {
		NetUmax=Ut;
		write_float_eeprom(NetUmax_p,Ut);
	 }
	if (Ut < NetUmin)
	 {
		NetUmin=Ut;
		write_float_eeprom(NetUmin_p,Ut);
	 }
    return(Ut);
 
reply about this sch. it is for 16F676 BASED 95 V-290 V AC 5 STEP AUTOMATIC DIGITAL STABILIZERView attachment 58406

As you know, it is ok... from here the serious work will begin :grin:
By the way, the idea of the project is rather simple but its implementation in designing every part of it may not be as easy as one expects :wink:
Let us start with:
May I ask you what is the maximum load at the regulated output (say @220Vac)?
 
I was going through a few stuff and came across this:


Description given there:

What are your thoughts on the part bolded? How much does this affect performance? Does the arch really destroy the contacts?
 



ok ,o\p between 200 v to 245 v.
i\p between 95 v to 290 v
 

I was going through a few stuff and came across this:
What are your thoughts on the part bolded? How much does this affect performance? Does the arch really destroy the contacts?

He is right, but adding a snubber reduces to a great extent this arch. And if I remember well, I flip the relay near zero crossing at which the current is minimal.
 

Do you remember the values of the resistor and capacitor you used for the snubber?
 

Do you remember the values of the resistor and capacitor you used for the snubber?

As I remember, their values depend on the power. Some where 1uF and others 2u2 (rated for high AC voltage... not less than 250Vac)
 

Okay, so I'll do that. Thanks.

With the hope that the relay response time stays the same at different loads and also be the same for all relays :wink:
But in any case, this will be better than let the flip occur at random.
And if you can test the finished product... you can play with the time offset to get the smoother transition.

OT:
Just curious... isn't too early in India now :smile:
 
Reactions: Tahmid

    Tahmid

    Points: 2
    Helpful Answer Positive Rating
Sorry, I confused you with Sahu... but isn't Bangladesh not far from India?
I mean you are online ... too late at night or too early in the morning... as if you don't like to sleep at night
In my case, I go to sleep when I feel tired... no matter what would be the time :grin:
 
Last edited:
No problem. Yea, Bangladesh is beside India. Right now it's precisely 3:00 AM. Too late at night or too early in the morning - depends on how you view it. Reminds me of the half-full/half-empty glass thing. :smile:

---------- Post added at 03:05 ---------- Previous post was at 03:03 ----------

In my case, I go to sleep when I feel tired... no matter what would be the time

Similar in my case though not exactly the same. So, I'm not tired now. Anyways, I WILL go to sleep in a few minutes. Too late.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…