pic.programmer
Advanced Member level 3
- Joined
- Aug 19, 2015
- Messages
- 773
- Helped
- 141
- Reputation
- 284
- Reaction score
- 140
- Trophy points
- 43
- Activity points
- 7,531
Hi,
No.
My preferred solution is to feed both AC signals I and U directely without rectifier and without filtering to the ADC. Nothing else. No XOR.
Inbetween i thought the digital pulse witdh measurement caused problems..and just remembered this alternatively could be done with an ADC.
...many ways...many solutions..maybe causes confusion...sorry.
Klaus
Adcin 1,current
ADC_READ(1)
y = 0 //this is a single type variable
icounter = 10 //this is a variable used as a counter
main: //main program loop
While icounter > 10
Adcin 1,current
WaitMs 600
y = y + current
icounter = icounter - 1
current = 0
Wend
y = y / 10 //since 10 accumulated results of ADC input value has taken place
y = y * 5 / 1024 //this is to return the input voltage, referred to current, to its analog value
According to your circuit, the analog value (y = y * 5 / 1024) must be for the 200W incandescent lamp, a 0.075 as seen on a DVM, but on the LCD it shows random value like:
adc_result = ADC_Read(0) * 5.0 / 1024.0;
adc_result = ADC_Read(0) * 5.0 / 1023.0;
adc_result = ADC_Read(0) * 5.0 / 1023.0;
Yes. I respect your decision not to go my way.So the CT circuit you've posted is following betwixt method not yours.
From my experience and simulations the output voltage of my circuit should be very stable as long as the input is stable. It is well filtered, so there is no need to average multiple values.No good results were on LCD, and even when load is disconnected, there still a "random" value that appears for I
1024 is the correct value. But 1023 will introduce a minimal error, not of interest.Some people say we have to do like this
Ok, so my anticipated load is of 8Amps as a maximum load.
from CT ratio: output current is 8/2000 = 0.004
For a burden of 10Kohms the output resultant voltage is 40V. This 40V can easily be voltage divided.
What are the values of the Resistor (other than the ground voltage dividing one) that helps protecting with help of Zener diode, that helps in protecting the ADC input in case of overloading?
I didn´t know.. From other microcontrollers they say 10k to cause an error less than 1LSB at full sampling speed. This is my error not to read the datasheet.The ADC inputs should see an impedance of no more than about 5K
No. My preferred solution is:The method Klaus suggested a while ago was to do this, it is more accurate but more software intensive:
* Measure: True RMS U, true RMS I, true P_eff
* multiply true_RMS_U x true_RMS_I to get P_app
* divide P_eff / P_app to get cos(phi). finished.
The XOR circuit looks fine but you can omit one of the resistors at the 'A' input to the gate. The reason I suggested two was to increase their combined voltage rating when measuring diectly from the incoming AC line. With the transformer dropping the voltage you can replace them with a single 100K resistor.
For the output filter, the XOR frequency is also 100Hz so use the same values as the I and V connections.
The measurment method depends on whether you use the analog or digital method. Use one or the other, the result should be the same.
Digital:
You need to measure the duration of the pulse at the XOR output, the easiest way is to make it trigger an interrupt, start a timer, swap to monitoring the opposite edge trigger then stop the timer at the next interrupt. Essentially you are finding the leading and trailing edge of the pulse and counting 'ticks' between them. As the 'ticks' are at a constant rate (decided by the timer prescaler) you can convert the result directly to time.
Analog:
You measure the analog voltage from the filter. The voltage is proportional to the phase difference. Note that the highest voltage will be when the inputs are 90 degrees out of phase at which time the XOR output will be a square wave (see the XOR truth table) so it will average at 2.5V. If you want to, you can use a x2 voltage amplifier to utilize the full 5V range of of the ADC input or just accept it will be always be a little less accurate. You still get 512 steps of measurement for 90 degrees shift so the result should still be more than adequate.
You will probably have to add/subtract a small 'fudge factor' to the phase result, use a resistive load and find the difference from zero then use it to fix the result. This is quite legitimate and due to the phase shift introduced by the transformers themselves. Their shift will be constant so all you have to do is compensate for it in your results.
Klaus, the circuit is to find the average voltage of a unipolar waveform, 22uF will slow the resonse time to changes but shouldn't have any other adverse effects. The series resistor in the XOR output will protect it from overcurrent.
Brian.
I should have described it more clearly: I meant the two 22uF in the voltage and current measurement path, not the 22uF at the XOR output. My concern is that residual DC voltage from the 22uF may affect the XOR inputs.Klaus, the circuit is to find the average voltage of a unipolar waveform, 22uF will slow the resonse time to changes but shouldn't have any other adverse effects. The series resistor in the XOR output will protect it from overcurrent.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?