LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to ?: x = degrees of rotation, y = voltage in chart or graph.

Hello all, I’m brand new at this.

 

The system so far:

 

A BEI encoder puts out 9000 pulses per revolution. I’m sending it’s A and B outputs to an NI USB-6210. In LabVIEW, I used the “Counter – Read Encoder.vi” from Help/Find Examples/Hardware Input and Output/DAQmx/Counter Input. This looks good to me as the front panel reports the degrees of rotation going up when going clockwise and degrees of rotation going down when turning counter clockwise.

 

A potentiometer mechanically coupled to the input shaft of the encoder attenuates voltage. The attenuated voltage goes to the same NI USB-6210. In LabVIEW, I used the “Voltage – Continuous Input.vi” from Help/Find Examples/Hardware Input and Output/DAQmx/Analog Input. This also looks good to me as the Front Panel graphically reports the correct voltage (y-axis) over time (x-axis).

 

But what I want to accomplish on a single graph or chart (displaying in real time) is a plot of Y = Voltage and X = Degrees of Rotation.

 

I’ve worked and worked at this part of it and can’t get it to happen. What should connect to what? How? I’m really stuck. Thanks in advance.

0 Kudos
Message 1 of 8
(2,717 Views)

Hi Tinsnips,

 

to plot XY data you should use a XYGraph…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 8
(2,698 Views)

To expand slightly on Gerd's excellent (but terse) response, LabVIEW (being a Laboratory Virtual Instrument Engineering Workbench) often deals with acquired measurments (such as angles of rotation, or voltages) that are acquired as a function of time (i.e. "sampled"), hence many "visualization of data" schemes involve plotting values representing Y data gathered at equally-spaced Time intervals (dt).  LabVIEW has a data type to represent such sampled Waveform data (called, appropriately, a Waveform), and a custom plot/display type called a Chart, designed for visualizing such data-as-a-function of time.  It even has several modes that mimic other instruments, such as a Strip Chart Recorder (the data moves from right-to-left, new data appearing at the right edge, or Scope mode, where the data "sweeps" from left to right like an Oscilloscope).

 

On the other hand, if you are acquiring two channels of sampled data, and want to plot them, not as a function of time, but against each other, you need to use a 2D Graph, which is designed just for this situation.  What if you have three channels and want to plot a 3D Graph -- there's even support for this.  4D -- you are on your own!

 

Bob Schor

0 Kudos
Message 3 of 8
(2,689 Views)

Do you mean a Find Example XY Graph or one from the palette? And what gets connected to what? I think I my problem may be with dissimilar data types.

0 Kudos
Message 4 of 8
(2,688 Views)

Thanks Bob, I'll pursue the 2D graph and see if I can make it work.

0 Kudos
Message 5 of 8
(2,686 Views)

@Tinsnips wrote:

 

But what I want to accomplish on a single graph or chart (displaying in real time) is a plot of Y = Voltage and X = Degrees of Rotation..


XY graphs understand complex data and will graph IM vs RE, so all you needs to do is form a complex array (one point) using the correct tools. If there is only one point on the graph, make sure to use a plot style that contains points. Alternatively, draw a second point at the center (0+0i) and you'll see a spoke instead of a point. Also resize the plot area to be square and fix the axes accordingly.

 

complexXY.png

0 Kudos
Message 6 of 8
(2,672 Views)

Of course it is not entirely clear how you want to graph it. You could also just use a chart with two traces, charting voltage and angle vs time. Use two Y axis because the scaling might be quite different.

0 Kudos
Message 7 of 8
(2,670 Views)

@Tinsnips wrote:

 

But what I want to accomplish on a single graph or chart (displaying in real time) is a plot of Y = Voltage and X = Degrees of Rotation.

 


 

.

This is definitely done with a Graph.  Here's the basic idea:

  • Create a Graph. 
  • Set up a "sampling system" that gives you pairs of values (or a 2D point) every so often (note that the time intervals do not need to be equally spaced, though they likely will be).
  • As each sample is generated, put a point on the Graph corresponding to that Sample.  Alternatively, instead of a Point, you could draw a line from the previous point to the current point.

Now, the problem with this is that you are going to have a plot that has 1, then 2, then 3, then "a lot" of points, with more to come -- how can you make sense of this?  How can you "see movement" of the current point if the whole screen is covered with dots?  

 

Do you know about Lissajous figures, when you have an oscilloscope that lets you "drive" the horizontal (time) axis as well as the vertical axis, and you put sinusoids on both X and Y?  You get circles, figure 8s, and you can see the "moving dot" (unless you are using a storage scope).  A Graph tends to be "persistent", but you can erase the plot every so often and start over, which will let you "see movement".

 

Something I did once was similar -- I kept the last N points in a circular buffer (I actually used a finite lossy queue) and each time a new point arrived, I generated a new Graph of the N points.  It was easy to see the "moving trajectory", and if I plotted dots, I could even "see speed" as the dot spacing changed, increasing for faster movements.

 

Bob Schor

0 Kudos
Message 8 of 8
(2,643 Views)