I am designing a circuit that measures the energy consumed from 50Hz AC supply (error must be < 1%), by measuring the voltage through potential divider; and current from shunt resistor. Then these two signals go to ADC inputs of microcontroller PIC18F46K80 to be multiplied and get the power.
The voltage signal enters a potential divider and an amplifier with DC offset and goes to the ADC input. In the current measurement circuit, the difference between shunt terminals is amplified and then an amplifier with two feedback resistors (NMOS used to select between them to modify the gain) amplify its again. Then go to a DC offset stage after that to the ADC input.
The problem is when the phase change between current and voltage, the energy measurement error changed by 0.8% if the power factor of measured energy changed from 1 to 0.8L.
During my work in this circuit I had come with these notes:
1- Capacitive coupled noise (in the OPAMP negative input) could affect the measurement if the power factor is changed. But in this case, I am sure it is not because I measure the RMS value in the ADC to check if there is a capacitive coupled noise or not.
2- The OPAMP is not 100% inverting, it has some parasitic effects on the phase of the signal that comes to it. It depends on the gain and other stuff.
3- I had some DC blocking capacitor that will make a phase shift (time delay), between voltage and current signal, this phase is very small but it affects the measurement accuracy.
The points 2&3, I have solved it by making small software delay between acquiring the signal of the voltage and the current to compensate for that phase shift/delay.
I have two circuits: The old one works perfectly when the power factor change from 1 to 0.5L. But it suffered from aging of a capacitor as described here (Ceramic Capacitor Aging Stack Exchange). The accuracy had dropped after 2 months of operation. So I have modified the circuit (NEW ONE) by increasing the capacitors and some resistors to minimize the effect of the capacitor aging. But now I couldn’t even have an acceptable result, though I have tried adding variable delays between reading the voltage and current from the ADC.
The Code:
//================== voltage measurement ==================== //
set_adc_channel(VOLT_CHANNEL); //voltage reading channel
delay_us(3); //wait for ADC channel capacitor to charge
voltage_binary = read_adc();
delay_us(10);
//================== current measurement =====================//
set_adc_channel(Current_Channel); //current reading channel
delay_us(3); //wait for ADC channel capacitor to charge
current_binary = read_adc();
Differences between the two designs:
Item New Design/Old Design
C16 10uF/4.7uF
C7 100uF/47uF
OPAMP TL064ID/TL064INSR
D9 BAS70/BAV99S
Resistor Case Code 1608/2012
R38 100K/18.2K
R35 470K/82K
Sampling rate (Sample/Second) 3400/2700
The Question is: What else could affect the operation of the measurement when the power factor change?