LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Phase difference measurement

I need assistance measuring the phase difference between two digital signals (0 to 5 volts). The signals are angle outputs of a rotating torque sensor. All of this is for the purpose of tracking the angle of rotation as I measure torque. Normally, I would run first angle to a counter and the second angle through an up/down gate on the DAQ board, however my board has no such up/down gate. The two signals are supposed to be 90 degrees out of phase depending on the direction of rotation. As such, Labview should then differentiate when to count up or count down the degrees of rotation. If I had a way of mathematically determining the phase of the signals, I could write a Labview vi to change the counting from one way to the other. I have already spent hours researching phase difference methods on the forums, however I am using Labview 8 base package, and therefore do not have access to advanced functions such as Hilbert Transforms or AC/DC Estimators. Any ideas? There has to be a way to use trig identities or something and solve out phase difference.
 
Matthew
0 Kudos
Message 1 of 15
(3,625 Views)
Can you post an example of your data?
Randall Pursley
0 Kudos
Message 2 of 15
(3,614 Views)
Randall is the recognized expert in this area, but I'm thinking along these lines.  If your data has delta T (time between samples), and your data crosses the zero line at some point, you could measure the time between zero crossings of both signals.
- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 15
(3,609 Views)
Can you multiply the two signals (which you say are 90 degrees out of phase) at the first edge and see if the product is ~25 (count up) or ~0 (count down).  If this doesn't make sense then I need more detail about what your signals look like.
Randall Pursley
0 Kudos
Message 4 of 15
(3,601 Views)
The signals are 0 to 5 volt square waves. They are +/- 90 degrees out of phase depending on the direction of shaft rotation. I am not sure how I would count when they cross zero.
0 Kudos
Message 5 of 15
(3,593 Views)
Use a threshold of 2.5 V. Then if the signal is above the threshold set a boolean to True, else to False, creating a boolean array. Then use the standard quadrature encoder logic to determine direction and steps. Some DAQ boards have two counters which cna be used directly to measure encoder outputs.

Lynn
0 Kudos
Message 6 of 15
(3,592 Views)

Lynn,

I understand what you mean by the signal threshold and Boolean operation but I am not familiar with the "standard quadrature logic". Could you please explain or give an example. Thanks.

Matthew

0 Kudos
Message 7 of 15
(3,589 Views)
Matthew,

I don't have time to look it up or work out all the details at the moment but it goes something like this: Let the two encoder channels be A and B. At each transition of one channel the level of the other channel defines the direction of rotation. One direction gives {A=(0->1) and B=0; B=(0->1) and A=1; A=(1->0) and B=1; B=(1->0) and A=0}. The opposite direction gives a different set starting with {A=(0->1) and B=1;... Draw a picture of the A and B waveforms and you can see what is happening.

You can generate as many as one pulse per transition or as few as one per full cycle, depending on your needs. The output can be in the form of a direction signal and a count pulse or count up and count down pulses.

Lynn
0 Kudos
Message 8 of 15
(3,583 Views)

Search for "quadrature encoder" on ni.com. Here is an extract from this link.

Quadrature Encoders

The most common type of incremental encoder uses two output channels (A and B) to sense position. Using two code tracks with sectors positioned 90° out of phase, the two output channels of the quadrature encoder indicate both position and direction of rotation. If A leads B, for example, the disk is rotating in a clockwise direction. If B leads A, then the disk is rotating in a counter-clockwise direction. Therefore, by monitoring both the number of pulses and the relative phase of signals A and B, you can track both the position and direction of rotation.

In addition, some quadrature detectors include a third output channel, called a zero or reference signal, which supplies a single pulse per revolution. This single pulse can be used for precise determination of a reference position.

0 Kudos
Message 9 of 15
(3,580 Views)
In other words use the first signal as a trigger and read the value of the second channel.  0 would be one direction and 1 would be the other.

Set up a triggered digital input with your DAQ card.
Randall Pursley
0 Kudos
Message 10 of 15
(3,563 Views)