07-05-2016 06:32 AM
Have this piece of code written by BLOKK. (http://forums.ni.com/t5/LabVIEW/Where-to-put-communication-with-NI-USB-6212/td-p/3254217/page/3)
I would read Analog output with the rate of 100 kHz but I can't figure out how to do this with his fine piece of code.
Can anybody help?
07-05-2016 06:43 AM - edited 07-05-2016 06:46 AM
Ok, so you opened up a new post too. See my comment at your original post. What you show, my example code was designed to run software timed. So it takes 1 sample per all required channels. If you need higher sampling frequency, you need to modify the initialization part of the VI. You need to specify the required frequency and the number of samples per channel using "DAQmx Timing.vi". Also, you need to decide on the design: you sample in your actual while loop, or -wich is better usually- you start to use a Producer/consumer pattern to decouple DAQ and data analysis (logging) parts in your code.
Anyway, but as I wrote in my other comment, I think you really not need 100 kHz sampling for a pressure transducer in your actual experimental setup...The sensor itself has a much higher "inertia", its output changes much slower than 100 kHz...
edit: I guess the "6210" is a mistypo, since you mentioned "6212" in your original post?
07-05-2016 01:42 PM
As advised( I think you were part of that) I replaced my 6212 with 2 6210.
The variation of the output is 0.7 mBar. The precition is 0.1 % of full scale which is 100 mbar.
You are right about the change speed of the pressure transducer. Probably some kind of noise as you also suggest .
Our Idea was to sample more an average the noise out, but we will of course also try to reduce noise.
The room where the equipment is placed is temperature controlled.
Thank you for your reply
07-05-2016 01:46 PM - edited 07-05-2016 02:04 PM
@Michael.Koppelgaard wrote:As advised( I think you were part of that) I replaced my 6212 with 2 6210.
The variation of the output is 0.7 mBar. The precition is 0.1 % of full scale which is 100 mbar.
You are right about the change speed of the pressure transducer. Probably some kind of noise as you also suggest .
Our Idea was to sample more an average the noise out, but we will of course also try to reduce noise.
The room where the equipment is placed is temperature controlled.
Thank you for your reply
I never heard about pressure sensor with upper limit 100 mbar. Are you sure it is not 1000 mbar (~1 atmosphere)? If the scale is up to 1000 mbar, it means precision is 1mbar. So actually the 0.7 mbar variation is quite good. I use many pressure sensors (full scale 1000 and also 3000 mbar) and their signal fluctuates around a few mbars. Totally in agreement with their data sheet. So I do not see any problem here...
edit: I know, I know, i am not a mathematician 🙂 Actually precision, accuracy, noise, etc. are not the same things, but for now I just called it "signal fluctuations" 🙂 Anyway, 0.7 mbar fluctuations seems totally OK...
edit2: could you provide the data sheet of these sensors, or link it? I am just curious... (i use such products from companies MKS and TEI)
edit3: I have found products with upper limit of 100 mbar, so they exist indeed 🙂 In this case the precision is 0.1 mbar. So your fluctuation has a (peak-to-peak) amplitude 7 times higher than the precision. Hmmm, could you make a measurement in an ideal separated environment? So only using the DAQ module and a single pressure sensor? Record the signal fluctuations, and show it here (the raw voltage signal and the conversion formula too).
edit4: please also share the wiring (wire type, shielding, grounding, etc.).
07-05-2016 11:53 PM - edited 07-05-2016 11:56 PM
As I remember, you used RSE for input terminal configuration. You could move to Differential wiring (and so set the input terminal configuration to "Differential" for the "init_USB6212.vi"), it might improve the system. So you have to wire your pressure sensors in this way to the phyisical pins ( more reading:http://www.ni.com/white-paper/3344/en/ ).
For the question about how to sample at 100 kHz, you need to modify my code to include timing, and specify the number of samples per channel. You also need to decide how you want to calculate the Mean and SD values from your data. If you have 12 channels, you need to calc means and SDs on 100k values 12 times. Another question whether you want to embed this statistical calculations inside the lvlib ("ResourceModule"), or you request a 2D data array instead (size 12X100k) and calculate these statistics in your main VI (maybe using a Producer/consumer design).
As a not too elegant solution, you could stay with software timing, and request data just at around 100 Hz. Take lets say 80 values in a FOR loop, and then you can get some more data to calculate mean and SD values to play with... (the trick is that you keep the DAQ time just a bit below 1 sec, and still using the "Wait until msec multiple" function to ensure better matching between iteration times). Something like this:
EDIT: another thought about your experiment: you should really test your sensor attached to a CONSTANT pressure chamber, it might be that the "fluctuations" around 0.7 mbar what you see is actually really there. Can it be that the pressure really fluctuates at this level? I do not know what you measure, so it is another possibility...
07-06-2016 04:44 AM
Thank you for you reply ! 🙂
Here is my test app:
And output
Also the data for the pressure transducer. I mentioned range 0- 100 mbar. What I meant was -100 to 0 mbar. The data on the curve is positive. That's a mistake. Should of course be negative, but that should not matter.
About wiring I can tell you without help from my workshop man who is not available today.
We a discussing change to difference wiring..
.
07-06-2016 04:54 AM
Udgangssignal: 4 - 20 mA
Regarding to the above info from your specificatons, this pressure sensor outputs current and NOT voltage signal. You connect this pressure sensor to a USB-6210 unit which is a DAQ device to measure VOLTAGE signals...
07-06-2016 04:54 AM
I modified my app after you example. New output after the blue arrow 🙂 But we should try to reduce noise anyways. But now I know there is another way .... 🙂
07-06-2016 05:01 AM - edited 07-06-2016 05:02 AM
Did you read my post about you connect a current signal to a voltage measurement HW, which is a NO GO?
edit: you could show the wiring diagram...maybe a resistor is used connected to the sensor, and the voltage drop over the resistor is measured via the USB device?
07-06-2016 07:16 AM
Ups Error. I should multiply with slope instead of subtracting.... 😞