Sign in to follow this  
goldfronts1

Data Aquistion

Recommended Posts

I am trying to collect more data points for my graphs. When I go into my channels on the "main" tab. I change the timing to 0.01 secs and the plot looks very choppy. Is this the area where I need to adjust in order to collect more data points so that I can have a smooth plot?

Thanks

Share this post


Link to post
Share on other sites

What do you mean by choppy? Vertical choppy, or horizontal? I'm assuming vertical. If you want to oversample, set the timing to 0.01, but then check the Average box and specify an average count. So, you could put 10 there and have it oversample 0.01 second data to 0.1 seconds. This will smooth it out somewhat, but its important to understand the source of the noise before you try smoothing it in software, otherwise you might smooth out something that is real.

Share this post


Link to post
Share on other sites

I actually recording data from a potentiostat. I am collecting current vs voltage data. I am plotting this data. It is scanning at 50mV per second. I am wanting to collect more data points in order to smooth out my curves.

thanks

Share this post


Link to post
Share on other sites

Are you familiar with Stream mode in DAQFactory?

Not understanding this code as my channels are 0 and 1. How do I change this code to get information from channels 0 and 1? Don't understand AddRequest and eGet?

// standard initialization:

using("device.labjack")

include("c:\program files\LabJack\Drivers\labjackud.h")

// setup stream:

// set scan rate:

AddRequest(0, LJ_ioPUT_CONFIG, LJ_chSTREAM_SCAN_FREQUENCY, 1000, 0, 0)

// setup channels to stream:

AddRequest(0, LJ_ioCLEAR_STREAM_CHANNELS, 0, 0, 0, 0)

AddRequest(0, LJ_ioADD_STREAM_CHANNEL, 2, 0, 0, 0)

AddRequest(0, LJ_ioADD_STREAM_CHANNEL, 3, 0, 0, 0)

GoOne(0)

// start the stream:

global scanrate = 0

eGet(0,LJ_ioSTART_STREAM, 0, @scanrate, 0)

// scanrate now has the actual scanrate, which you can display on the screen if you want.

Share this post


Link to post
Share on other sites

You need to do two things:

1) change the lines with ADD_STREAM_CHANNEL from 2 and 3 to 0 and 1.

2) create two LabJack channels with the appropriate D# (ID of your labjack, 0 if you use the above code), Type A/D, Channel #'s 0 and 1, timing = 0.

Once you start the stream, the data should appear in those channels.

Share this post


Link to post
Share on other sites

I have done this. But now how do I get the graph to update when the x and y axis are both set to channels read from a device.

Thanks

Share this post


Link to post
Share on other sites

??? I'm not sure what you mean. Just specify the two channels as the X and Y expression and the graph will update, provided the X and Y scale are set within range of values. Maybe you should post your .ctl document.

Share this post


Link to post
Share on other sites

A few things:

1) you have to hit your "Reset" button to define starttime

2) your history length on Voltage2 is only 3600 long, so only shows the last 3.6 seconds of data (at 1khz rate)

3) you should set the align threshold for the bottom axis to -1 to turn off alignment. The "starttime" variable is throwing the time stamp on the bottom axis and causing it to align incorrectly.

Share this post


Link to post
Share on other sites

So I should click my "reset" button before I click the "start" button?

Also, by changing the alignment threshold, will this correct the startime variable issue?

Thanks

Share this post


Link to post
Share on other sites

Yes, you have to click the "reset" button because that is where you define starttime, and without that your graph expression is invalid.

The align threshold will resolve the issue where time is getting pulled from starttime, yes. It won't fix the requirement that you define starttime (which you do when you click the reset button). I personally would suggest declaring and initializing starttime in an auto-start sequence.

Share this post


Link to post
Share on other sites

I updated the items as you suggested and was able to stream data. However, my data is still noisy. I have attached images of what I mean. Do you have any suggestions on how to smooth out the plots. I want to collect a lot of data points but the plot should be a smooth continuous plot.

Thanks

post-8150-1328221906_thumb.jpg

post-8150-1328221913_thumb.jpg

Share this post


Link to post
Share on other sites

Well, the noise is real, so my first suggestion is to try and quiet the signal in hardware. Look for unshielded wiring and the other standard sources of noise. This is not software noise and appears to be mostly in the Voltage channel. You can smooth the curve out using the smooth() function, but, this is just masking the real problem.

Share this post


Link to post
Share on other sites

Do you have any sample code for using the smooth() function for smoothing out graphs.

I searched the forum and couldn't find anything.

Thanks

Share this post


Link to post
Share on other sites

That's because there isn't much to it. If your current Expression is:

myVoltageChannel

You'd change it to something like:

smooth(myVoltageChannel,5)

That would do a running 5 point boxcar average on the data used for the graph.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this