From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

example code

 I want to take the output of two sensors such as tgs 823 and tgs 825  at the same time through single daq  usb 6210   so can you please provide an example code for this, i already determined the response curve for single sensor by connecting the output pin to ai8 ( and after that ai9) and ground to 28 pin of daq  but i dont  know how to take  continuous   output for two sensors at same time by using daqasst  

0 Kudos
Message 1 of 14
(4,086 Views)

You mention DAQ Assistant. If you're using that, you should be able to select more than one physical channel for Analog Input (am I understanding your workflow correctly here?) and then you'll get an array of waveforms, or a 2D array of doubles.

 

If you want to do this without the DAQ Assistant, the idea is basically the same. Set up one task, using two physical channels.

 

Examples can be found using the LabVIEW NI Example Finder, under the help menu. Search by keyword. Remember that when you're measuring the continuous output of sensors, what you want is actually continuous input to the measurement system, i.e. your USB 6210 DAQ system.


GCentral
0 Kudos
Message 2 of 14
(4,065 Views)

 i actually used two  physical channels for two sensors respectively ai8 and ai9, but as vc and ground  was provided by same source to both the sensors like 5v through arduino and ground through 28 th pin of daq,  but the output was incorrect may be it was considering it as one circuit  consisting of two sensors  .but  i want to see the response for individual circuits of tgs823 and 825 at same time  ,what should i do.

0 Kudos
Message 3 of 14
(4,050 Views)

Looking at the datasheet for the TGS823, it seems like this is essentially like a RTD? You want to provide some current and measure the voltage drop across the resistor, and then calculate the resistance of the TGS823 device? It doesn't look like you can make a current measurement with the USB-6210.

 

How are you setting your 'constant' current? Can you describe the hardware setup you have with regards to your sources and resistors? Additionally you mention an Arduino - what is this doing?

 

It might well be that your problem has nothing to do with LabVIEW, and is instead related to your circuit.


GCentral
0 Kudos
Message 4 of 14
(4,044 Views)

 i am using arduino for providing   heater voltage (5v), as daq  has limited current so it doesn't power the heater . also i am only providing voltage source of 5v , and want to take the corresponding output i.e voltage and current  of the complete circuit   and want to determine the change in response curve i.e variation in resistance  when ethanol is sensed  

0 Kudos
Message 5 of 14
(4,023 Views)

Ok. I'm pretty sure that the easiest way for you to make these measurements is to give up on measuring current.

 

What you want to do is hook up your two TGS sensors and a known value resistor in series. You can then place a connection to an Analog Input channel on either side of each sensor/resistor - this should be 3 analog inputs + one ground connection.

 

You can calculate the current through the complete collection using Ohm's law and the known resistance's voltage drop. Then, you can use this current value to calculate the resistances of the two sensors using their voltage drops.

 

You can measure two of your 3 resistors (sensor = resistor) in differential mode, and the final resistor referenced to ground.

 

If you can't get differential measurements set up (I think it should be possible - I just had a simulated USB 6210 with differential configuration, but it's not entirely clear where to configure the pairings) then you can measure all three relative to ground, and then subtract values as needed.


GCentral
0 Kudos
Message 6 of 14
(4,013 Views)

can you help me by providing example code  for running two tasks simultaneously using same daq ,as i want to take outputs of two sensors at the same time using same daq within same vi 

0 Kudos
Message 7 of 14
(3,975 Views)

Depending on the DAQ board you have, this might be more or less tricky. I'm not sure about the 6210 with regards to multiple separate AI tasks. However, it's likely much simpler to simply add multiple physical channels to one DAQmx Task. Is there a reason you can't do this?

 

You mentioned earlier that when you tried this, you got the 'wrong output'. What did you get, and how was it wrong? Did you try the circuit I suggested, or is there some reason that you don't think it will be suitable? It should allow both to be measured simultaneously very easily. You just need a known value resistor - this is a ratiometric measurement.


GCentral
0 Kudos
Message 8 of 14
(3,972 Views)

daqmx multiple channels.png/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 14
(3,968 Views)

As  you suggested that we should place the two sensors and known resistor in series   and then take measurements across each sensor  but  each sensor has its own circuit in which resistor is already used, so should  we use  different different resistors for each sensor circuit plus known resistance in series , is such kind of circuit be ok, or it would get difficult for measurements as we only want to get the response curve i.e voltage and current  of sensors ,not as a whole circuit but as independent circuit  

0 Kudos
Message 10 of 14
(3,951 Views)