Message Boards Message Boards


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

Posted 3 years ago
5 Replies
5 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.

5 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 (, 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!


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.

   "cDAQ1Mod3/ai1, cDAQ1Mod3/ai2",
   -6.0, (*voltage level*)

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.

Posted 7 months ago

Dear Suman,

Thank you for the posting. Which version of NationalInstruments.DAQmx.dll should I use? I am using old Mathematica version Number : recent version of NationalInstruments.DAQmx.dll generate following error while LoadNETAssembly[].

LoadNETAssembly::noload: The assembly C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET4.5.1\Counter\Generate Pulse\GenDigPulseTrain_Continuous\CS\bin\Debug\NationalInstruments.DAQmx.dll either was not found or could not be loaded. >>

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

Group Abstract Group Abstract