06-08-2017 11:07 AM
Hi,
I am trying to use Vernier's SensorDAQ to acquire and plot data from a dyanometer in real-time in matlab (see http://www.vernier.com/products/interfaces/sdaq/).
I am using the exact same code as I have previously used with an X-series multifunction DAQ (NI USB-6343 ) connected to a pressure sensor. This worked perfectly.
Example code: https://uk.mathworks.com/help/daq/examples/acquire-continuous-and-background-data-using-ni-devices.h...
However, with the SensorDAQ, it will not plot any data until after the code has finished running. I've tried alternative code and so on, but to no avail. I can only conclude there is a difference in the hardware / on-board software. Any suggestions?
Many thanks in advance,
Ed
Solved! Go to Solution.
06-08-2017 12:35 PM
Sorry, I should add the one slight difference in code is you connect to the device using vernier's toolbox:
addpath('SensorDAQ')
s = sdaq.createSession; sdaq.addSensor(s,1,sdaq.Sensors.HandDynamometer);
06-09-2017 04:52 AM
Hi all,
An update from this morning, so I have narrowed it down further:
Dev1 is the SensorDAQ, Dev2 is the X series.
This code plots both datasets at the end of the script:
s = daq.createSession('ni'); ch1 = s.addAnalogInputChannel('Dev1','_sensor0_5V','Voltage'); ch2 = s.addAnalogInputChannel('Dev2','ai0','Voltage'); s.Rate = 100; s.DurationInSeconds = 10; s.NotifyWhenDataAvailableExceeds = 100; lh = addlistener(s,'DataAvailable', @(src,event) plot(event.TimeStamps, event.Data)); startBackground(s); disp('Go') s.wait(); delete(lh)
Whereas, if I comment-out Dev1, this code plots the data from Dev2 in realtime.
s = daq.createSession('ni'); % ch1 = s.addAnalogInputChannel('Dev1','_sensor0_5V','Voltage'); ch2 = s.addAnalogInputChannel('Dev2','ai0','Voltage'); s.Rate = 100; s.DurationInSeconds = 10; s.NotifyWhenDataAvailableExceeds = 100; lh = addlistener(s,'DataAvailable', @(src,event) plot(event.TimeStamps, event.Data)); startBackground(s); disp('Go') s.wait(); delete(lh)
Any idea what in the SensorDAQ might be causing this?
06-09-2017 05:19 AM - edited 06-09-2017 05:24 AM
Hi Ed,
Thanks for getting touch regarding this issue. Can I just confirm, are you using the Vernier toolbox to interface with the sensorDAQ rather than DAQmx?
If so, I believe this issue is best handled by Vernier support as this is their toolbox and is subsequently not supported by National Instruments.
EDIT:
Alternatively, if it's this package you're using - https://uk.mathworks.com/matlabcentral/fileexchange/32636-matlab-support-package-for-vernier-sensord...
Matlab support may be who you're look for. Please see here for the answer forum from Matlab - https://uk.mathworks.com/matlabcentral/answers/?s_tid=hp_ff_s_answers
Best Regards,
James
06-09-2017 05:30 AM
Hi,
Thanks for replying, I have tried both. My first reply above is using the Vernier Toolbox:
sdaq.addSensor...
The second reply is using the normal session based DAQmx functions:
s.addAnalogInputChannel...
All the vernier toolbox does is call the standard functions.
Both methods connect to the sensor fine (validated using a single scan e.g.data = s.inputSingleScan).
I have tried everything I can think of to get this working! That's why I believe it is something related to the configuration of NI card itself, but that's beyond my technical expertise...
Best regards,
Ed
06-09-2017 05:54 AM
Ah ok, thank you for the clarification. I don't have a particular working familiarity with the usage of the Vernier toolbox however, have you tried creating a session for each of the devices?
Best Regards,
James Kinch
06-09-2017 05:59 AM
Yes, unfortunately that didn't work.
I was initially only using the SensorDAQ so it had it's own session. I only added the other NI card to check my code was correct.
(I'm guessing the SensorDAQ is a modified version of NI myDAQ, if anyone is familiar with whether this issue also exists for this card.)
06-09-2017 06:13 AM - edited 06-09-2017 06:14 AM
Also, looking further into this function pack - https://jp.mathworks.com/hardware-support/nidaqmx.html - you should speak with Matlab support regarding this issue.
Apologies for not being able to offer further support.
06-12-2017 03:30 AM
Hey Ed,
You are correct in saying that the SensorDAQ is essentially a re branded version of a USB DAQ sold by NI (kind of like this - http://sine.ni.com/nips/cds/view/p/lang/en/nid/201986 although this may not be the specific equivalent).
From the sounds of things, it's likely a software implementation issue and as such, as I mentioned before it's best supported by Matlab. This said, it may be worth taking a look through the specification document (http://www.vernier.com/files/manuals/sdaq-specifications.pdf) to ensure that you're asking the card to operate within specification.
06-12-2017 04:53 AM
Thanks - I took look through the spec, but I'm not really sure what I can change. I've reduced the sampling rate to 10Hz, which it should be more than capable of. Unfortunately, I've had no response from Matlab, so I might have to admit defeat!