Hello,
I am working on a project which measures the ac line voltage(normally 230v) and the ac current measurement. For that I am using the microchip microcontroller having 10 bit adc. For the voltage measurement I am using the voltage divider circuit and the program detects the peak of the signal. By this method I am getting the proper output from the adc. Now my questions are,
1. To measure the ac voltage, the peak voltage in the adc is,being measured. is this a proper method? Considering that the system can tolerate 2% error.
2. The relay is also interfaced with the system. When the relay is turned on, the input adc voltage,drops down. Considering that the relay has a separate filtering section and the optocoupler is also used in relay interfacing circuit
1) Do the math. If you have a maximum allowable error of 2%, that means you have to sample fast enough so that you will always get a sample within 2% of the peak. For a (presumably) 50Hz sine wave:
arcsin(.98)= 78.5 degrees
360/78.5=4.6
Thus, you will need to sample at least 5 times per cycle, or every 4 milliseconds.
2) Relay? what relay? Optocoupler? WHAT??? That isn't even a question!!!
1) Do the math. If you have a maximum allowable error of 2%, that means you have to sample fast enough so that you will always get a sample within 2% of the peak. For a (presumably) 50Hz sine wave:
arcsin(.98)= 78.5 degrees
360/78.5=4.6
Thus, you will need to sample at least 5 times per cycle, or every 4 milliseconds.
2) Relay? what relay? Optocoupler? WHAT??? That isn't even a question!!!
Hello Barry,
Thanks for the reply.
1. I did the calculations and and also got the output but the question is, to detect the peak voltage and from the peak we are getting the rms value by the math, is it a reliablemethod??
2. The electromechanical relay is also connected with the same system and when the relay turns on or off, the ac voltage in the adc of the microcontroller drops down by some mw. And it gets larger effect, when we convert into digital. Need to fix this issue.
The sampling rate calculation by barry has obviously the presumption of a sine waveform.
If you require 2% accuracy, deviations from sine waveform that are observed in any supply network with electronical loads must be considered. You should also become clear, which voltage quantity (RMS, average rectified value, peak value) you want to measure. Most cheap voltage meters measure average rectified value, calculated as rms by a scaling factor. Peak value calculated as rms is the least accurate method and most sensitive to waveform variations.
It's unlikely that a small relay load is already affecting the mains waveform (presumed you are not switching a large load). So you are most likely observing crosstalk or similar unwanted circuit effects. To discuss it in detail, your measurement circuit most be known.
Or if its happens through ADC ref voltage deviation due to switching the relay with same power source. The best and easy method is averaged measurement (connecting a cap in pot output).
by having peak voltage as Vpeak
Vrms = Vpeak / √2 :bsdetector:
for a sine wave. so any method without calculating the rms is applicable for only a single wave form.
so that you can make a calibration directly for the given waveform most preferably sine voltage on the line.