06-01-2018 08:26 PM
Hi,
Greetings. I need to use several sensor nods for data acquisition and control of greenhouse environment. Initially, I will use 4 NI USB 6009 with temp, humidity and CO2 sensors. I am confused about the connection of NI USB with the computer.
1. Do I need to connect all the NI USB separately with the computer?
2. Do I need separate coding for each NI USB/sensor nod?
Thanks in advance....
06-02-2018 02:21 AM - last edited on 07-11-2024 03:39 PM by Content Cleaner
On the other hand, I am not sure that these USB-6009 modules are the best approach for the task you want to do. Could you give more info about how many sensors and actuators you need to use? So how many AI, AO or DIO channels are required for your project? I am a bit concerned about distances and distribution of the sensors. Usually it is not a good idea to use USB-cabel "extenders", I had some issues in the past when I tried to use a 5m long USB cable extension plus the original USB cable of a NI DAQ device. I got several times driver crashes. There are some solutions like powered USB-extenders, but I believe you would be much better with some Ethernet or wireless distribution approach. NI offers different options, but of course the price range is also higher for these devices. But adding together the price of 4 USB-6009, you might be better with a 2 or 3 module cDAQ chassis?
You can check out options here: https://www.ni.com/en/shop/compactdaq.html
I would also consider using the cheap Raspberry PI single board computers for such task. You get a low power consumption linux board, built-in wifi and you can attach a wide range of AI (AO, DIO, etc) "shields", which can communicate to the sensors via different protocols, like I2C. I could imagine a kind of sensor network, where multiple groups of your sensors are connected to several RPi boards, and these boards could broadcast the measurement data via TCP/UDP etc back to your PC which would run LabVIEW. You can program the RPi boards with languages like Python, or even using LabVIEW: https://www.labviewmakerhub.com/
06-02-2018 01:22 PM
Hello Mr. TRUSTED ENTHUSIAST,
Thanks for your quick reply. I usually DAQassistant for coding. As you said to use DAQmx, I tried to make code but I can't understand how can I put sensor equations/formulas in DAQmx coding system. I have attached my DAQassistant code here.
Would you please give some guideline or links to solve the problem.
06-02-2018 04:20 PM - edited 06-02-2018 04:22 PM
@Chowdhury_Milon wrote:
Hello Mr. TRUSTED ENTHUSIAST,
Thanks for your quick reply. I usually DAQassistant for coding. As you said to use DAQmx, I tried to make code but I can't understand how can I put sensor equations/formulas in DAQmx coding system. I have attached my DAQassistant code here.
Would you please give some guideline or links to solve the problem.
"DAQmx coding system" and "equations/formulas" have nothing to do with each other 🙂 Are you aware of the basic mathematical formulas present in LabVIEW? Like multiplication?
I put together a small example for you, using a kind of Producer/consumer pattern with Stream Channel. I let you do the data manipulation/scaling and the File saving, their place is in the Consumer loop!
Here is the snippet, try to re-build it (since you have LV2017, I used a "Stream Channel with Abort", more compact than a Queue):
06-03-2018 02:13 AM
Before giving Kudos which I do not deserve! 🙂 Imagine, what happens in case of any DAQmx errors if you use my design: the producer loop will not stop, but will stop generating valid data!
So we also need to stop the top loop in case of error, and send this info to the bottom loop. Using one of the inputs of the Stream Channel Writer, like the "Abort", "Last element?" and the "element valid?" ones!
06-14-2018 02:51 AM
Hello Mr. Blokk,
10 days already passed. I am sorry I can't reply. I bought a "5 port PCI-E PCI express to USB 3.0 HUB Expansion Card SATA Adapter". and it works well. But the DAQmx seems difficult/hard to me. Actually, I used some sensor equation in DAQassist coding. But in DAQmax I couldn't find "Abort.vi" for putting formula/equation. I have some others problems too.
1) I already bought NI USB 6009. So I have no option to buy wireless NI products.
2) How can I add several (4 NI USB 6009; 1 CO2, 1 Temp., 1 humidity, 1 light sensor are connected with each 6009) NI USB in one DAQmx code?
I don't know, is it clear to you or not. Now, adding 4 DAQassist or DAQmx in one code is my target. Would you give me the suggestion, please?
06-14-2018 04:36 AM - last edited on 07-11-2024 03:39 PM by Content Cleaner
To be honest I do not understand this sentence: "But in DAQmax I couldn't find "Abort.vi" for putting formula/equation. " You can create a formula simply using the "Mathematics" palette set from the block diagram, you do not need those Formula/equation Express VIs!!
For the DAQmx question: You need to create 4 DAQmx Tasks for the 4 USB6009 modules. USB6009 supports up to 4 Differential AI inputs, so I recommend to use Differential pin configurations for your sensors instead of RSE (since you need to connect only 4 sensor to each USB device). Here you can see how to wire your sensors to the USB modules: https://www.ni.com/docs/en-US/bundle/usb-6008-6009-feature/page/pinout-signal-descrip.html
Channel0 will be AI0/AI4 (AI0+/AI0-), Channel1 AI1/AI5 (AI1+/AI1-), etc...
I show you here a simple example, no explicit timing setup (just "on demand" sampling), only taking a single sample per channel per While loop iteration (so 4 channels X 4 devices = 16 samples per iteration), might be enough for your sensors (you can modify it to take more samples, but in that case you might need to use 4 separate While loops due to make timing/acquisition tight in the loop).
06-15-2018 06:17 AM
Hello Mr. Blokk,
Thanks for your patient and continuous support. Still, I have some confusion.
1, During the use of DAQassistant, I separated the signals using "Select signal" option and the used "Formula" option to set sensor equation for getting the actual value (Picture attached). How can I separate those signals in "Consumer while loop"?
2. You told me to do math in Consumer loop's "false case". So, what about the "True case"? Should I keep it empty?
3. I also want to add "Numeric indicator" and "Waveform graph" to see the data. Should I add these at "Consumer loop"?
Thanks in advance.
06-15-2018 06:24 AM - last edited on 12-13-2024 08:11 AM by Content Cleaner
Hi Milon,
1. You get an array in the consumer loop. Which function can be used to index single elements from an array? Basic stuff: IndexArray…
2. Yes.
I suggest to use scales for your DAQmx channels, see the LabVIEW example VIs and this one!
This way you don't need to scale your DAQmx readings afterwards…
3. Yes.
06-15-2018 06:33 AM
I really advise to take someonline tutorials for LabVIEW, you miss many of the most basic concepts and techniques of the language. You can find many links here: https://forums.ni.com/t5/Community-Documents/Unofficial-Forum-Rules-and-Guidelines/ta-p/3536495
(under section "Looking For Free Training")
Regarding to your questions: