Continue to Site

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

Status
Not open for further replies.

#### Tahmid

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.

#### KerimF

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:

#### KerimF

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: 298
• Vout-Vmains_down.pdf
5.5 KB · Views: 223

Points: 2

### Tahmid

Points: 2

#### are

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	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);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
delay_us(250);
output_bit(PIN_B2,1);
Ut=(U1+U2+U3+U4+U5+U6+U7+U8+U8+U9);
Ut=(Ut+U10+U11+U12+U13+U14)/15;
return(Ut);
}

{
float  Ut,U1,U2,U3,U4;
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);

Points: 2

Points: 2

Points: 2

aslam javed

### aslam javed

Points: 2

#### KerimF

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:
May I ask you what is the maximum load at the regulated output (say @220Vac)?

Points: 2

### aslam javed

Points: 2

Points: 2

#### Tahmid

I was going through a few stuff and came across this:

Description given there:
Relay Type Voltage StabilizersA relay type voltage stabilizer is one of the most popular types of voltage stabilizers. Circuits of such stabilizers are based on transformer taps commutating with the help of electronic commutators. The maximum output voltage of the stabilizer significantly exceeds that of a power transformer. The required transformer capacity needs to be selected based on the minimum possible voltage within the given power network. For example, if the minimum possible network voltage is at least 180 V, the transformer needs to add an extra 40 V, that is the value 5.5 times lower than the network voltage. This is exactly by how much the output capacity of a stabilizer would exceed the capacity of a power transformer (of course, this is without considering the transformer's efficiency, and the maximum possible current allowed through the switching elements).The voltage at the output of a stabilizer changes stepwise. The number of voltage regulation steps usually doesn't exceed 3-6, which enables sufficient accuracy in maintaining the output voltage. When calculating the number of rings in the transformer's winding for each step the voltage in the power network is assumed as equal to the voltage of triggering the switching element.Usually electromagnetic relays are used as commutators. Then the circuit is rather simple and reproducible. The only drawback is that when the relay switches, there appears an arch, which destroys the contacts.In circuits that are more complex, for example, in those using digital elements, the relay is switched, when the network's halfwave passes through zero, which prevents generation of a spark. But it's either the relay needs to be very quick, or the devices need to be turned on when the previous halfwave declines.The overall advantages of relay-type voltage stabilizers are as follows:Firstly, high stabilization accuracy that is directly proportionate to the number of steps and keys.Secondly, there is no distortion in voltage shape, since the distorting elements are missing.Thirdly, the wide working temperature range.Forthly, high noise immunity, since the relay is not affected by noise, voltage or current shapes.Fifthly, low sensitivity to network frequencies.And, finally, the low price.

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

#### sahu

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:
May I ask you what is the maximum load at the regulated output (say @220Vac)?

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

#### Tahmid

ok ,o\p between 200 v to 245 v.

Isn't an output of 245V too high? I think 200v to 230v would be better. What do you think?

#### sahu

Isn't an output of 245V too high? I think 200v to 230v would be better. What do you think?

yes u are right ..

#### KerimF

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.

#### Tahmid

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

#### KerimF

yes u are right ..

In any case, I meant by the load... Power or Current (maximum).

#### Tahmid

And if I remember well, I flip the relay near zero crossing at which the current is minimal.

Okay, so I'll do that. Thanks.

#### KerimF

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)

#### Tahmid

Ok, I'll calculate the values of the snubber as required.

#### KerimF

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:

Tahmid

### Tahmid

Points: 2

#### KerimF

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:

Points: 2

#### Tahmid

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.