Message Boards Message Boards

GROUPS:

[WSS17] Mathematica connection to NI - Data Acquisition (DAQ) cards

Posted 2 years ago
2366 Views
|
4 Replies
|
3 Total Likes
|

[WSS17] Mathematica connection to NI - Data Acquisition (DAQ) cards

I have controlled hardware devices through serial ports, GPIB ports, USB ports using SerialRead/Write and NI - VISA from Mathematica. Here at WSS17, I wanted to control NI - DAQ cards using Mathematica. Through all these device communication protocols, large number of devices can be controlled which enables me to run my experiments efficiently using Mathematica.

DAQ cards are used for efficient measurements as they are compact and occupy less space than traditional devices. NI-DAQmx is an efficient driver to control NI-DAQ cards. In WSS17, I developed Mathematica-DAQmx Link ("DAQmxLink"), which links NI-DAQ cards with Mathematica through the communication between Mathematica NETLink and NI-DAQmx .

Project structure You can find the detailed code Git link

Further Reading on DAQmx

More on DAQmx .NET object

NI - DAQ - Test

usb6000 = DeviceOpen["DAQmx"]

enter image description here

ListPlot[DeviceReadBuffer[usb6000, 10000, "source"]]

enter image description here

I can read the individual data too.

Table[DeviceRead[usb6000], {i, 1, 10}]

enter image description here

This is the basic connectivity between Mathematica and NI DAQmx.

4 Replies

Hi Suman. I'm a physics student and i'm tryng to communicate with a NI-DAQ using Wolfram Mathematica, for a class experiment i'm running. I found you developed a tool called DAQmxLink to do just that...or so I understood. I searched for it all over the web but I couldn't find it! Here you shared a GitHub link (https://github.com/sumanban/HW_submit/blob/master/HW_suman%20_fin.nb), which I thought would contain the answer for my questions, but it gets me to some other code of yours that has nothing to do with the one I'm looking for...I don't know why. In any case, if you could direct me to that code or something similar that helped me do that, I would be very grateful!! Thanks.

Hi, Please check the NB added. I hope it helps!

Attachments:

Thanks a lot Suman! It took me some time...I had to change your code a little to adapt it to my set up, but now I have it working...almost. I would actually need to read more than one input simultaneously, to be able to correlate measurements. I know the NI-DAQ (cDAQ9184-1A54FE2) can do it. So, if you could point me to the function (or functions) to do it...Thanks

It is nice to know that you are able to control your DAQ card using Mathematica!

I worked on this long time ago and unfortunately I do not remember many things about this project now. I tried to find some resources for you.

task@AIChannels@CreateVoltageChannel[
   "cDAQ1Mod3/ai1, cDAQ1Mod3/ai2",
   "",
   termConfig, 
   -6.0, (*voltage level*)
   6.0,
   aiVolts  
   ]

should work for multi-channel measurements. I also found this document Using NI-DAQmx in Text Based Programming Environments was helpful. It may help you as well.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract