LabVIEW Electrical Power Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

using arduino with electrical power suite

I am using an arduino to measure voltage and current and eventually get the power readings . But however when i am getting  the readings from the analog input  and connect it to my power VI the  power factor remains 1or -1 . I am measuring single phace power. I am using an SCT- 013 -000 current transformer for the current . and apower transformer for the voltage 240 - 6V . below is my vi and screenshots . Can you help me troubleshoot why my powerfactor isonly flickering between 1and -1 . for all loads including resistive , capacitive and inductive loads . 

Download All
0 Kudos
Message 1 of 11
(11,945 Views)

It is beacuse you are only feeding one data point (for voltage and one for current) to RMS.vi and Power.vi on each iteration of the loop.  Those VIs appear to expect waveforms which include an array of data points covering at least one full cycle of the power line frequency signal.  I do not have those VIs to verify that assumption.

 

To fix this you need to do two things. First make sure that the arduino is sampling fast enough and at a steady rate so that the Nyquist criterion is met for the signals.  Sampling rate must be greater than twice the power line frequency. If your loads have switching power supplies or SCR speed controls, much higher sampling rates will be required.  You also need to know the time between a voltage sample and the corresponding current sample.

 

Second you must accumulate the data (via a shift register) until you have at least the minimum amount required for the analysis VIs.  I cannot tell you how much that is. Read the detailed help files for those VIs.

 

Finally, do you understand how the measurements you are trying to make work? You cannot get power factor from rms measurements because all the phase information is lost.

 

Lynn

0 Kudos
Message 2 of 11
(11,912 Views)

thank you for the reply . Based on what you told me  i came  up with this VI . i was sampling the data then only reading the sample . But still somehow i do not get the value I need , Still the same result . The only reason i used the RMS value was for me to see a power value . because my power factor was flickering between 1 and -1 hence i was getting some negative power readings which made no sense . Maybe you can demonstrate what you mean by showing me with a random number generator as the output from the arduino so i can get a rough idea how to tackle this . 

Download All
0 Kudos
Message 3 of 11
(11,900 Views)

I just realized that you have a more serious problem - the sampling rate. In your VI you have set the waveforms to indicate dt = 0.02. This represents a sampling rate of 50 Hz. Assuming you are in a part of the world where the power mains frequency is 50 Hz, your sampling rate is much too small to get meaningful results. The Nyquist criterion requires sampling at greater than 100 Hz. To get good amplitude and phase information the sampling rate should be at least 1000 Hz.

 

And then there is the communications problem. I do not have the LINX VIs but the LIFA VIs transfer a 15-byte packet for each data point. At 9600 baud that translates to approximately 64 samples per second, which is well below the Nyquist minimum. Because you are sampling two channels the effective rate is half of that or less. Even if you only transmit two bytes per sample, that results in a maximum possible rate of 240 samples per second on each of the two channels.  That is 4.8 samples per cycle at 50 Hz. While this meets the Nyqiust criterion, the phase resolution will be on the order of 75 degrees which is very poor for power factor.

 

Start from the requirements. Do the math. Then if it is even feasible to make the measurements you want, try to figure out how to do it.

 

Lynn

0 Kudos
Message 4 of 11
(11,893 Views)

Hey there again , i have been cracking my head for sometime regarding with what you told me. and since arduino gives me single data array , i though of using modifying the power vi to be taking arduin single data arrays . So i came up with the folllowing VI. i measured my phone power input and i got a variation between 9 W and 11.5 W. but mostly negative .i dont know if its a fluke or its real . Below is my vi and how i assembled it Can you verify with me whether this is a logical pursuit 

Download All
0 Kudos
Message 5 of 11
(11,860 Views)

Let's get to the fundamental problem.  FORGET YOUR LabVIEW CODE UNTIL THIS ISSUE IS RESOLVED!

 

1. What is the frequency and waveform of the signals you want to measure?

 

2. What is the desired resolution on phase angle or power factor?

 

3. What is the required sampling rate to do 1 and 2?

 

4. What is the effective sampling rate of your system?

 

Lynn

0 Kudos
Message 6 of 11
(11,852 Views)
It is a single phase 50hz. AC signal at 240VAC. As for the resolution I don't understand what you mean... Well I use the arduino linx software. So it sends data packages to and from the arduino at a 120hz If I am not mistaken.
0 Kudos
Message 7 of 11
(11,849 Views)

OK. Let's try to define some terms.

 

Phase resolution: The smallest difference in phase angle between the voltage and current waveforms that can be measured. 

Example: At 50 Hz one period is 20 ms. If you take a sample every millisecond (1 kHz), you will get 20 samples per cycle of the 50 Hz signal. That is equvalent to 18 degrees between samples. Since power factor is proprtional to the cosine of the phase difference you would get possible power factor values of 1, 0.95, 0.81, and 0.59 for phase differences of 0, 18, 36, and 54 degrees or time differences of 0, 1, 2, 3, and 4 milliseconds.

 

If the sampling rate is 120 Hz, the period is 8.333 ms and the phase resolution is 150 degrees. That is meaningless for power factor measurements.

 

Next, the Arduino LINX software cannot achieve anywhere near 120 Hz as you have the VI set up.  Open up the LINX VIs and look at what they are doing. It sends an 8-byte packet to define a channel. Then it waits for 2 bytes to return. One of those bytes tells the next VI how many data bytes are coming. It appears that you get 2 bytes of data from each read. That is a total of 24 bytes for two channels. The digital write also sends 8 bytes although that runs in parallel with the reads. With the standard settings doing two one-channel analog reads takes at least 25 ms. That is equivalent to a sampling rate of 40 Hz. The Nyquist criterion specifies that the sampling rate must be greater than twice the frequency of the signal you want to measure. So your sampling rate needs to be >100 Hz.

 

If you use the N Channel version of Analog Read for two channels (as opposed to the two separate Reads you have now), it sends a 9-byte packet and receives 6 bytes. The maximum rate it could achieve is ~64 Hz, which is still far too slow.

 

Lynn

0 Kudos
Message 8 of 11
(11,842 Views)

so as is, in short the arduino with linx is not capable of measuring the power factor of the system . 

0 Kudos
Message 9 of 11
(11,830 Views)

That is correct.

 

Unless you can find a way to sample at >= 1000 samples per second and transfer the data to the LV program, you cannot measure power factor.

 

Lynn

0 Kudos
Message 10 of 11
(11,827 Views)