DAQ: Difference between revisions
No edit summary |
mNo edit summary |
||
| Line 14: | Line 14: | ||
When reading multiple signals simultaneously, it is possible that the signal of channel X will be partially visible in the signal recorded by channel Y due to what is called ghosting. Please find more information about ghosting [https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHy6CAG&l=pt-BR here]. | When reading multiple signals simultaneously, it is possible that the signal of channel X will be partially visible in the signal recorded by channel Y due to what is called ghosting. Please find more information about ghosting [https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHy6CAG&l=pt-BR here]. | ||
'''An example of a python script to read out channels''' <syntaxhighlight lang="python" line="1" start="1"> | '''An example of a python script to read out channels''' Note that in the example below, we use shorts in between the three main signals to read in order to reduce ghosting. <syntaxhighlight lang="python" line="1" start="1"> | ||
import nidaqmx | import nidaqmx | ||
Revision as of 20:25, 4 December 2024
For more information regarding a DAQ, please visit this link.
In our lab, we are using a DAQ NI USB-6259:
Specifications Detailed specifications can be found on the website of National Instruments Specific specs: Multichannel maximum: 1.00 MS/s. This rate is shared among all input channels.
Ghosting When reading multiple signals simultaneously, it is possible that the signal of channel X will be partially visible in the signal recorded by channel Y due to what is called ghosting. Please find more information about ghosting here.
An example of a python script to read out channels Note that in the example below, we use shorts in between the three main signals to read in order to reduce ghosting.
import nidaqmx
DAQtaskAI = nidaqmx.Task(); #create a task object
DAQtaskAI.ai_channels.add_ai_voltage_chan("Dev1/ai0",min_val=0,max_val=10) # add an input channel to the task. min_val and max_val are the minimum and maximum voltage that will be applied. #Transmission
DAQtaskAI.ai_channels.add_ai_voltage_chan("Dev1/ai1",min_val=0,max_val=10) # Short
DAQtaskAI.ai_channels.add_ai_voltage_chan("Dev1/ai2",min_val=0,max_val=10) # MZI signal
DAQtaskAI.ai_channels.add_ai_voltage_chan("Dev1/ai3",min_val=0,max_val=10) # Short
DAQtaskAI.ai_channels.add_ai_voltage_chan("Dev1/ai4",min_val=0,max_val=10) # HCN signal
DAQtaskAI.timing.cfg_samp_clk_timing(rate=100000,samps_per_chan=500000) #set sampling parameters. In this example the sampling rate per channel is 100 kHz and data will be collected during 5 seconds.
#measure
data = DAQtaskAI.read(number_of_samples_per_channel = 500000, timeout = 5);
transmission = data[0]
mzi = data[2]
hcn = data[4]
An example of a python script to set an output voltage
import nidaqmx
DAQtaskAO = nidaqmx.Task(); #create a task object
DAQtaskAO.ao_channels.add_ao_voltage_chan("Dev1/ao0");
DAQtaskAO.write(data=5.2, auto_start = True); #5.2 Volt will be set at channel ao0.