Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with triggering and sampling rate on USB-6341 DAQ

Solved!
Go to solution

I attempted the continuous sampling in two analog input channels by using task.in_stream.config_logging(). It seems to be acquiring the data, however, it is weird that the measured data from these channels are correlated, which should not be. There are significant artifacts, ideally the Photodetector channel should give the response of device under test and the trigger channel should give the trigger from laser. The trigger channel is acquired to some extent reliably. But the Photodetector channel is unpredictable completely. In addition, the voltage shows negative, which is not possible ideally, I think it is something to do with DAQ. The device under test is a ring resonator and it should have narrow resoannce dips, but the photodetector signal has many peaks and dips.

I am attaching a few instances.

Is it not having sufficient sampling points, or is it sampling faster? This data is at a rate of 250 kHz, and the sweep speed in laser takes 5 sec, I had manual control over stopping the acquisition.

Could you suggest a way out?

 

Download All
0 Kudos
Message 21 of 26
(180 Views)

You may be experiencing some of the disadvantages in multiplexed input DAQ devices, especially ghosting.

How Do I Eliminate Ghosting from My Measurements? - NI

 

Images attached in previous reply,

santo_13_0-1751862354909.png

 

santo_13_1-1751862378926.png

 

Note: please put images in the content unless it is very high resolution so that users don't need to download to see the content.

 

Which channels were these analog inputs connected to and how?

 

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 22 of 26
(163 Views)

It is true that there is cross-talk and ghosting taking place because I used two adjacent channels ai0 and ai1. I tried with ai0 and ai7, in this case the ghosting effect got reduced, but not devoid of.

 

In addition, I have a query regarding tdms logging, as the FIFO buffer of DAQ is only 2047 samples, and What should be the sample per channel used so that I can be assured that the data will not be lost. 

0 Kudos
Message 23 of 26
(154 Views)

@pkp401 wrote:

It is true that there is cross-talk and ghosting taking place because I used two adjacent channels ai0 and ai1. I tried with ai0 and ai7, in this case the ghosting effect got reduced, but not devoid of.

 

In addition, I have a query regarding tdms logging, as the FIFO buffer of DAQ is only 2047 samples, and What should be the sample per channel used so that I can be assured that the data will not be lost. 


If both your signal have very good drive strength, you may not observe ghosting as the signals will be able to fully charge the sample and hold circuit within short period. You can use a unity gain buffer for your signals to improve this.

Don'y worry about FIFO buffer, DAQmx uses DMA and can ensure it is not losing any samples, you can use the highest sample rate supported by DAQ, please share the code if you need someone else to ensure it is not a bottleneck.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 24 of 26
(146 Views)

I am attaching the code, I am manually stopping the acquisition currently.

 

I am skeptical about how data is acquired, It would be helpful if I get some heading to better acquisition method which can have better time stamps. In manual control, it tends to acquire unwanted data too, which I will figure out how to stop the acquisition as soon as sweep stops. But to assure it does not miss any data logging, I had given a sleep time of sweep duration, is it reliable?

 

#############Code Snippet#######

daq = "Dev1"  
pd_ai_channel = f"{daq}/ai2"  # Analog input from photodetector
trigger_ai_channel =f"{daq}/ai7" #trigger to be sampled continuously
sample_rate = 250000    #max sample rate in Hz, 500kSa/s, for two channels, 250kSa/s each
read_chunk_size = 5000  # Number of samples to read at once
with nidaqmx.Task() as task:
    #add ai channels, differential configuration to reduce noise
    task.ai_channels.add_ai_voltage_chan(pd_ai_channel,terminal_config=TerminalConfiguration.DIFF,min_val=0, max_val=1.0)
    task.ai_channels.add_ai_voltage_chan(trigger_ai_channel,terminal_config=TerminalConfiguration.DIFF,min_val=0, max_val=3.5)
task.in_stream.configure_logging(
        tdms_save,
        logging_mode=LoggingMode.LOG,  # Log and read data
        #logging_mode=LoggingMode.LOG_AND_READ,#log & read, task.read() required
        #log only no need of read()
        group_name="wavelength_sweep",
        operation=LoggingOperation.CREATE
    )
    #configure timing for (onboard clock,continuous sampling)
    task.timing.cfg_samp_clk_timing(
        rate=sample_rate,
        sample_mode=AcquisitionType.CONTINUOUS,
        samps_per_chan=read_chunk_size # Number of samples to read at once
        #samps_per_chan=sample_rate * max_duration,  # check this For continuous acquisition
    )
print('Starting data acquisition..., press enter to start acquisition and laser sweep')
    input()
    task.start()
sweep_laser()
input("Press Enter to stop acquisition and sweep...")
time.sleep(max_duration)  # Wait for a while to ensure all data is logged, max_duaration takes 5s for sweep
  task.stop()


 

 

 

 

0 Kudos
Message 25 of 26
(127 Views)

Is the data logging limited by PC RAM? The way I have defined the time.config() i have included the samples_per_channel as chunk_size (5000) , does it help? And if I don’t use it, will it run out of memory.

What is a better practice?

0 Kudos
Message 26 of 26
(123 Views)