Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to Detect Exceed AC Voltage

Status
Not open for further replies.
Hi after adding hysteresis to the software the outputs works fine.

Now the only problem is the sense voltage (reference) changes.It's changing with a noticeable gap.

As per earlier calculations
230V ref = 2.5V
240V ref = 2.61

But some times its exceeding 2.61V when the AC is 230V.So the relay is getting off even in 230V.

I think must go for a 2nd transformer :(

Can you tell me for a 230VAC/6V transformer what are the values for resistor divider?
 
Last edited:
I still don't know why you want to do this, the voltage tollerance in most 230V countries is +10%-/6% so voltages as high at 253V are perfectly normal and shouldn't do any harm providing the project it designed properly.
 
For Transformer 220Vac/6Vac + bridge +filter :

If old_Rdiv =8,2 and old_Pot = 5K then use Rdiv~3,5K , Pot = 5K

If using AC and the code written by Eric then multiply the values with 10 :
Rdiv~35K . Pot~50K
Schematic.JPG
 
Hi mdorian

I also add a 2nd transformer thing.But still I'm not satisfy its voltage behavior.

I have attached two diagrams.1st one isolated & 2nd is non isolated.

What are the modifications to do to get a smooth DC AD input?

Its ok if it is non isolated I need a good reference detect circuit.

Also note I'm sampling DC not AC.I need a DC input for AD input.(Because I'm not continuously sampling AD & finding the peak,I just sampling AD & checking if its greater or less than the reference so I need a DC input for AD)
 

Attachments

  • Isolated.PNG
    Isolated.PNG
    4.5 KB · Views: 278
  • NonIsolated.PNG
    NonIsolated.PNG
    4.8 KB · Views: 259
Last edited:
The second schematic isn't good , you will have to many errors because the bridge works at low voltage , use something like that instead:
noninsulated.JPG
To approximate the error given by the smoothener use this formula
ΔV ~= V*0,006/(R*C)
Where R is Rdiv+Pot,
V can be ADC-in, or the AC voltage
For example :
ΔV = 2volts (AC )
V = 220volts ( AC- same as ΔV)
R = Rdiv+Pot = 14,2K
Then C = V*0,006/(R*ΔV) = 46uF
ΔV>2volts ==> C>46uf

Check the VDD for PIC if it's stable enough , otherwise it will alter the internal reference.
 
Hi mdorian thanks for your new diagram thats the one I was looking for.

I understood your formula.That means to maintain 2volts AC the smoothener must below 47uF.If smoothener > 47uF then the error will be more than 2volts AC.

Is that formula only for AC?

One more thing!

R is Rdiv+Pot that means 220K + 2.2K = 222.2K isn't it?
 
Last edited:
No , if C > 47uF then the error ΔV is proportional less then 2V. The formula can applied to DC to. Is not a very accurate formula because i approximated the discharge of the capacitor as being linear which is not , ΔV can 3 or 4 times higher, just put a capacitor large enough for the worst case. The bad side of putting a too large capacitor is that when the AC voltage drops from 240 to 220 the the smoothed voltage does not drops as fast as the AC voltage , this means you will have on the ADC-in a delay proportional with the capacitor.
As I told before, another source of errors is the voltage dropping on the bridge , witch falls with 2mV for each celsius degree. This is significant only for low AC voltage.
And again , don't rely on the 7805 that will give the same voltage at any time , use a digital voltmeter to check with and without loads ( like LED relay , etc). The AD conversion is relative to Vdd , so will give different results for Vdd = 5 volts as for Vdd = 5,1 volts.
 
The time for ADC conversion is ~ 150us, for an accurate result (without a bridge and a smothener) you need to take a least 20 samples in a semiperiod (10ms) -> a sample in 500us. You just start AD conversion and do something else for 500us or use ad interrupt and do something else in the main program. If not , use a bridge and a smoothener for the second transformer. The load (a resistor , can be the divider) for a response time can be calculated (approx) like that : time = 0,025ζ, where ζ= RC
for time = 0.5s and C = 220uf -> R = ζ/C = 40*0.5/(220*10^-6) ~ 90Kohm
(including the ADC-in divider)

hello mdorian, i have problem in simular situation. can u help me?. i have measure 230v,50hz ac.i rectified ac with bridge,then use potential divider to dive to below 5v,(without using filter capacitor)then given to the 10bit adc pin of pic16f877a.i take sample on each 1ms(since for 50hz, period is 20ms,using timer 1) add then,average on 10 sample, multiply by form factor(1.1) then display.my problem is display value change between 208-230. i don't think it is because of supply variation
 
There is another way.Detect zero cross (waste another external interrupt pin).When ZX occurs turn on a timer for 5mS.At each mid of semi period you get the peak value.@ 5mS time sample AD & calculate RMS & show on display.

If still display varies then you need to over sample & make the average.
 
Last edited:
The problem is that the samples are not synchronized with zero crossing, let's say you take a sample of 10V before zero crossing and one of 10v after the zero crossing , gives you an average voltage of 10v which obviously is not true. Worse, the samples position is changing in time relative to zero crossing and so your result . If your project requires this solution ( taking 10 samples/ semiperiod) then wait for zero crossing or use an interrupt to detect the zero crossing, start timer interrupts, take 9 samples ( because the first one is zero) stop timer interrupt and wait for zero crossing again. I wouldn't recommend taking only one sample per semiperiod like Soyza says because it's fitted only for perfect sinusoidal voltage, some loads widely used like SMPS are cutting the peak voltage modifying the result.
 
thanks for reply. i agree u said correct reason for drift. but i am using full wave rectifier, my freq is 50 hz, means 20ms period. since using fullwave rectification both negative and positive half cycles are same.so have to take only one. so take 1 sample for every 1ms .so 10*1ms=10ms(half period).then take average for ten. i beleive that i am taking consecutive 10 sample with 1ms interval. i don't have to worry about the zero crossing. sorrry for any mistakes
 
Hi , look at this pictures , the red points are the sampling points , I took only four samples per semiperiod but it applies to ten samples to. Using the samples in the second picture you will obtain a highest average than by using the samples in the first picture with the same signal. That's why you need sincronisation, of course in the rectified voltage there is no "zero cross" it's about the sincronisation with the zeroes in voltage.
 

Attachments

  • Sample1.JPG
    Sample1.JPG
    21.5 KB · Views: 168
  • Sample2.JPG
    Sample2.JPG
    21.7 KB · Views: 157
Last edited:
thanks for reply.but i am taking even number of samples at regular intervel like on this picture. average of 1,2,3,4 is equal to 3,4,5,6 .that is reason why i chose, not to care about zero crossing . sorry for any mistakes. keep replying
 
If you use aritmetic mean U = correction factor * (s1+s2+s3+s4)/4 then certainly your trouble comes from the position of sampling points. If you were sincronized with the zero you would have at least a proportional result with the average voltage.
If you're using quadratic mean U = Umax*√((s1^2+s2^2+s3^2+s4^2)/4), I think it doesn't matter the offset of the samples , for my example the the quadratic mean is the same in both examples U = Umax/√2 = 0.707Umax ,but the aritmetic mean is 0.603Umax and 0.653Umax for the first and the second picture. I hope you have enough resources to perform a quadratic mean in the interrupt.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top