05-14-2018 08:09 AM - edited 05-14-2018 08:16 AM
Hello,
I am running a little python script to log the data from a microphone, I would like to sample a sine wave with 500Hz, so I thought I would need a sampling rate of 10000. I can log some data but it seems I am not activating IEPE from python.
This is the code I am using:
############################################### # import libraries import time as t import numpy as np import nidaqmx import csv fSampling = 10000 #Hz nSamples = 1 #samples dtMax = 10 #sec csvfile ="./data.csv" ############################################### # DAQ # config with open(csvfile, "w") as output, nidaqmx.Task() as task: writer = csv.writer(output, delimiter=';') task.ai_channels.add_ai_voltage_chan("cDAQ1Mod1/ai0") task.timing.cfg_samp_clk_timing(fSampling) t1 = t.time() dt = 0 while dt < dtMax: data = task.read(number_of_samples_per_channel=nSamples) t2 = t.time() dt = t2-t1 writer.writerow(data)
it is mostly copied from different sources but I think I get what it does. I read in the nidaqmx-python documentation that I can set the IEPE sensitivity, but I couldnt find anything about how to enable it at all.
The setup works with labview:
Any ideas how I can get this to work with python? At the moment I am mostly getting Noise with python and a good signal with LabView.
EDIT: The DAQs I am using are:
- NI cDAQ-9171
- NI 9250
kind regards,
Johannes