From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compact DAQ to XY Chart w/ Dual Y-Axis

Hello, I need a bit of help and maybe a bit of a sanity check at this point. I'm VERY new to LabVIEW and am feeling a tad lost.

 

At work we are attempting to replace our horribly unreliable flat-bed paper chart recorders with a LabView setup. When I say we, I mean I alone was tasked with coming up a replacement which will be used by my labmates. These are used for detecting and recording fractions as they come off a column.

 

The acquisition hardware is:

1) National Instruments cDAQ-9171

2) National Instruments 9205

 

The devices we are interfacing with are:

 

1) Bio-Rad Econo EM1 UV monitor

2) Gilson FC203B Fraction Collector

 

The UV detector outputs a signal from 0-1V (though typical range of a fraction is 0-150mV). This signal was VERY noisy with around 40mV of high frequency noise on top of the real signal. A simple pi-filter between the DAQ and the UV detector killed almost all of this noise (other than a periodic oscilation with a frequency of less than 1 Hz.

 

The fraction collector has two pins on the back which short for 100ms each time it moves to a new tube. So I wrote a simple arduino program which alternates between logic LOW and HIGH each time a new tube is detected.

 

So in summary we have two inputs which must be overlayed. Initially Intially, I used the DAC assistant to input to a waveform graph and acheived this output:

Image1.PNG

 

This is OK but I want to be able to annotate tube numbers (attach them to data points on the red trace and have them stay attached to that data point). Also I want to autoscale the sizes because as you can see in the following image, its much easier to read with the graphs scaled to be similar heights.

 

Image2.PNG

 

As you can see, this chart was collected over almost 3h time (some charts will be up to 24h long).

 

I read that inorder to have two Y-axis as well as annotation I can't use the waveform chart. That instead I must use one of the XY graphs. This is where things start getting murky for me. I read at one place that I need to jetison the DAQAssistant so I began learning about manually creating the DAC channels using the DAQmx stuff. I was able to get two separate channels but now am feeling a bit lost. I am having a hard time figuring out how to break out the time axis for the XY chart, additionally, I'm a bit lost on how to combine the channels into one graph.

 

Sorry for such a noob question and I have a feeling I'll get a few STFU noob RTFM comments which maybe are fully warranted. I'm just drowning a bit in information overload and was hoping for a bit of a sanity check and any pointers you may have to push this forward. I am trying to learn this myself as I have several other stretch goals (HDD logging, logging resume, automated tube labeling, etc.) which I will eventually be tackling so taking shortcuts doesn't help me in the long run.

 

Thanks anyone who helps!

0 Kudos
Message 1 of 13
(3,340 Views)

Let me ask a couple of questions.  How fast are you sampling data?  I'm trying to figure out how much data you are talking about here.  The XY graph is the right choice.  You can add the second Y scale by right clicking on the Y axis and selecting duplicate scale.

 

I think you can still use the DAQ assistant, but you will have to make an array of time values to use to plot the data values against, hence an XY plot.  As far as how to combine the data points, press control-H and open up the context help window.  Hover over the XY Graph terminal in the block diagram and it will show you how it expects the data. 

 

The biggest difference between the chart and the graph is the graph does not have the built in data history like the chart.  Where as you've been sending 1 point at a time to the chart, with the graph you will have to maintain your own data buffer with XY information for each plot and pass all of the data to the plot at one time.

 

Would you be willing to post any code you have now just so I can get a better idea of what you have and what you need?

 

-Jeremy

LabVIEW Champion
Certified LabVIEW Architect
Certified Professional Instructor
Message 2 of 13
(3,317 Views)

As Jeremy said, please post up your code (the VI itself, not a picture of it - you can just attach the VI file to your post at the bottom), so we can make reasonable suggestions.

 

But one suggestion comes to mind now from your pictures. It gets hard to count all those tubes from the full-scale jumps. To make it easier to choose the tube(s) you want to collect, I'd make your red trace a stairstep (you don't need a real input, you can actually just put in program-calculated numbers if you want), with the number of steps the number of tubes in one row of tubes, then reset to zero and go up again.

 

There are several ways to record time data for your X-axis, check the LabVIEW Help files on your computer (yep, you got the RTFM, but gently). As for combining two graphs onto one plot, the Context Help (ctrl-H) for the graph icon on the Block Diagram tells you just how to do it (using the Help files just generally made things murkier for me, there's so much on this topic, you can get lost real easily).

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
Message 3 of 13
(3,273 Views)

Hey guys, thanks a bunch for the sanity check! You have no idea how much of a relief it is. There is no one at my company that has ever used labview so I'm entirely on my own. I'm not a programmer by nature so this takes a lot of banging my head against the wall to understand it.

 

@Jeremy - the final rate is undecided but its between 0.5-2 samples per second. I have a feeling we could go even slower without resolution issues (and use the time to oversample instead) to be honest. I will have to learn how to create a data buffer but having a specific concept to learn makes it much easier than flailing around a bit aimlessly.

 

 

@Cameron. Those look links look really great. I will sit down with them over the weekend and start learning. The structured format is VERY VERY helpful!

 

 

I'll try and post the VIs on Monday. Today the CEO decided to visit my lab and of course guess which PC he commondeered.Smiley Tongue

 

Once again, thanks you guys!

 

-jeff

 

0 Kudos
Message 4 of 13
(3,256 Views)

OK here is the VI, I have used a sub-VI (XY Graph as Chart.vi) I found on here. I don't fully understand how it is doing what its doing. Getting closer though. Right now I can figure out how to record two channels but not how to get their data into the right formats. Right now its outputting a 2-D array. Which is not the format I want. So I guess, next is to figure out how to split a 2D-array into two 1-D arrays that I can then convert into two signals for the graph. Getting much closer now!

0 Kudos
Message 5 of 13
(3,214 Views)

OK they only way I can find to link things up on the DAQmx is in the attached VI. Any other way, such as identical read chains results in an error being thrown. Unfortunately, I can't figure out how to get the data to output in a format that I can use on the XY charts. If I have a single output it works just fine. Double output though seems to mess everything up. I have a sneaky suspicion it is something simple but I'm banging my head since noon yesterday on this one.

0 Kudos
Message 6 of 13
(3,180 Views)

Hey Pedro 

 

Take a look at this link that will help with going from a 2D array to two 1D arrays.  It should help you use for your XY chart.

 

Convert 2D Array of Data to 1D Array of Waveforms

https://decibel.ni.com/content/docs/DOC-10712

Taylor
0 Kudos
Message 7 of 13
(3,161 Views)

It does kind of. I guess what I am trying to do is: I have signals from what we will call Channels 1 and 2. I am trying to figure out how to split them apart so that I can introduce them into a buffer and then on to an XY graph. I seem to be failing at some fundamental point.

0 Kudos
Message 8 of 13
(3,150 Views)

OK, so I have gotten to this point. I have working side by side XY graphs. Sure enough it was something fundamental. Split was hidden in the express section. I'm still having a hard time getting two plots on one graph

 

I have tried making an array and a cluster of the two XY outputs as an attempt to get both on one XY-graph. So far no luck.
 

0 Kudos
Message 9 of 13
(3,138 Views)

I don't have your sub VIs so I'm not exactly sure what's going on in there, but I have added a build array to combine the 2 plots and display them on a single XY graph.  I hope this helps some.

 

Jeremy

LabVIEW Champion
Certified LabVIEW Architect
Certified Professional Instructor
Message 10 of 13
(3,099 Views)