03-09-2023 12:22 AM
Hello All,
I am using a USB 6210 DAQ device for collecting data from a force sensor. 6 analog channels are used for this. I want to synchronise the data with the shaft position.
How I can I do it? All suggestions are welcomed.
Right now I am trying to use a rotary encoder module (without Z index).
How can I synchronise the data with encoder data. Most examples I have seen are collecting the analog data in waveform format. But I need to collect the sensor data as numeric since I need to do matrix manipulations. I tried extracting waveform components etc but did not work for me. Please suggest me how can I achieve what I am looking for.
03-09-2023 01:05 AM
Hi rakkiran,
@rakkiran wrote:
I am using a USB 6210 DAQ device for collecting data from a force sensor. 6 analog channels are used for this. I want to synchronise the data with the shaft position.
How I can I do it? All suggestions are welcomed.
Use the encoder signal as sample trigger for your AI task to sync the force readings to the encoder positions!
@rakkiran wrote:
But I need to collect the sensor data as numeric since I need to do matrix manipulations. I tried extracting waveform components etc but did not work for me. Please suggest me how can I achieve what I am looking for.
Waveform is "numeric"!
(When you don't know how to extract Y data from your waveform then you should consider the Training resources as offered at the top of the LabVIEW board…)
When there are problems in your VI then you should attach that VI so we can provide recommendations to improve it!
03-27-2023 05:30 AM
Sorry for being blunt in my question and replying so late. Attached are all the vi's required.
Data collection vi has the code related to encoder.
03-27-2023 06:30 AM
What problem are you having?
Generally, your task configs look to have set up sync properly -- the encoder task is configured to use the AI sample clock for sampling *and* the encoder task is started *before* AI. You're also reading the same # samples from each task in the loop. So your data is being captured in sync and your retrieval method keeps it in sync.
Sync looks ok, what are you having trouble with?
-Kevin P
03-27-2023 07:11 AM
Thank you for the reply.
Ya, I have followed various synchronization tutorial examples from ni resources to code that, but I am unable to get the data in my arrays.
To begin with the errors am facing are -89120, 89120, 200284, 200019 while running the code.
I couldn't figure out why there is no data errors/ datatype errors from counter channels.
There is also one more question I posted a question on
Using an optical rotary encoder with NI-USB 6210 (https://forums.ni.com/t5/Digital-I-O/Connecting-a-digital-optical-rotary-encoder-to-counter-input-of...), I am afraid if that is the reason!!
Kindly bear with the series of questions.
Regards,
Raj Kiran.
03-27-2023 08:12 AM
I tried a couple things with a simulated device.
1. error # -89120
First main problem: your string constant designation of "ai/sample clock". You need to get rid of the space. The official DAQmx terminal name would use "ai/SampleClock". While the string appeared to be case-insensitive, I'd still opt to duplicate the case found in the official name.
2. error # -200284
This is a timeout error from DAQmx Read. Probably a side effect during your troubleshooting and debugging. Probably the AI task had a config error, thus preventing it from producing a sample clock for the encoder task to make use of. Thus the encoder task, lacking a sample clock, would time out when attempting to read.
After fixing problem #1 above, I did not see this error with a simulated device.
3. error # -200019
This is a probably due to exceeding the safe multiplexing rate across your analog channels. Your device is spec'ed for 250 kHz aggregate ADC conversion rate. As presented, your code asks for a 10kHz rate for 6 channels for a 60 kHz aggregate rate. It works fine here on a simulated device.
My guess is that during your troubleshooting, you asked for a sample rate that exceeded ~45 kHz, which would have led to an *aggregate* conversion rate >250 kHz.
4. encoder electrical interface
I took a shot at an answer in the linked thread. Watch for follow ups or corrections from those with more thorough knowledge about these kinds of electrical interfaces.
-Kevin P
03-27-2023 08:44 AM
Thanks for checking out.
The first error was sorted as I removed the space.
And am not using a sampling rate of more than 100, so the ADC conversion rate would not have exceeded.
But as I tried on debugging mode using a simulator, I am getting an error of -200279. Although I will post again after using the equipment physically.
Thanks again for the reply.
03-27-2023 10:14 AM
Error -200279 is the oft-encountered "buffer overflow" error.
Going by the defaults in the previously posted code:
At 10 kHz samples per channel capture rate and 1000 samples per channel per iteration reading rate, you're in a generally safe position. You just have to maintain a 10 Hz loop iteration rate. I don't remember seeing any obvious reasons in the code that would prevent that.
But if you're using highlight execution mode to run in slow motion, then *for sure* you won't iterate at anything like 10 Hz, and a buffer overflow will happen very early, probably during the 1st or 2nd iteration. Not sure what your "simulator" is or whether it may also contribute to preventing a normal iteration rate.
You say you're not using a sample rate > 100. Do you mean 100 Hz or 100 kHz? The 'rate' input for DAQmx Timing would imply the rate of getting 1 sample from each of the 6 channels in the task. So a 100 kHz sample rate would be too high because it would require a 600 kHz aggregate ADC conversion rate.
-Kevin P