LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Threshold Detector

I am using the Express VI's for Amplitude and Level Measurement as well as Tone Measurement. Then I am trying to use them in conjunction with a threshold detector. The measurement VI's do not generate a stream of data that the threshold detector needs. I tried building arrays, but this was not fruitful. I get error -20013 which can mean it is not getting any inputs or not enough. 

 

Everything is in a while loop and getting data from a myDAQ sampling continuously. Could that have something to do with it?

 

Any Ideas?

 

Vi and pics are below

Download All
0 Kudos
Message 1 of 15
(5,183 Views)

Project Objective:

A.) detect activation of small muscle group

B.) count # of activations in 3 second period

C.) display counted # after each 3 second period

 

The first part is where my problem lies.

System description:

1) using an analog front end to filter raw EMG signal from biopolar surface electrodes and producing one analog output. 2) That one output goes to AI 1+ on the myDAQ (analog in 1), AI 1-  is connected to ground. 3) daq assistant brings data into labview. 4) two additional digital filters refine signal. 5) amplitude, level, and tone measurement express Vi's used (these Vi's produce values that change an order of magnitude in response to a muscle activation) this is where the problem sets in. 6) the rest of the code is different attempts to use threshold detection to detect when and how many times the muscle has been activated.

 

My Problem:

the VI's explained in step 5 above all generate a single value at time zero or something like that. Their waveforms are consistently centered at t=0. This could mean time data is not included after the measurement is performed by the VI. I get ERROR code 20013 which can be related to the number of inputs being less than the width (my width is 1 for each detector). I tried building arrays to store the data and using different types of threshold detectors, but nothing worked. 

 

I think maybe a shift register might work, but then I would have to change my sampling setting from continuous and it would get to complicated for my level of expertise. It would also make the loop in a loop I am planning on using for part B and C from above very confusing. 

 

Any fixes for my code or suggestions on a new method would be welcome. 

 

0 Kudos
Message 2 of 15
(5,156 Views)

Project Objective:

A.) detect activation of small muscle group

B.) count # of activations in 3 second period

C.) display counted # after each 3 second period

 

The first part is where my problem lies.

System description:

1) using an analog front end to filter raw EMG signal from biopolar surface electrodes and producing one analog output. 2) That one output goes to AI 1+ on the myDAQ (analog in 1), AI 1-  is connected to ground. 3) daq assistant brings data into labview. 4) two additional digital filters refine signal. 5) amplitude, level, and tone measurement express Vi's used (these Vi's produce values that change an order of magnitude in response to a muscle activation) this is where the problem sets in. 6) the rest of the code is different attempts to use threshold detection to detect when and how many times the muscle has been activated.

 

My Problem:

the VI's explained in step 5 above all generate a single value at time zero or something like that. Their waveforms are consistently centered at t=0. This could mean time data is not included after the measurement is performed by the VI. I get ERROR code 20013 which can be related to the number of inputs being less than the width (my width is 1 for each detector). I tried building arrays to store the data and using different types of threshold detectors, but nothing worked. 

 

I think maybe a shift register might work, but then I would have to change my sampling setting from continuous and it would get to complicated for my level of expertise. It would also make the loop in a loop I am planning on using for part B and C from above very confusing. 

 

Any fixes for my code or suggestions on a new method would be welcome. 

 

I am using LabView from 2014. 

 

 

 

 

Download All
0 Kudos
Message 3 of 15
(5,155 Views)

Why are you building an array of blue dynamic data wires?  My guess the problem is there.  In one case you wind up indexing that element back out.  But in another you use to Double to turn it into a Double Array.  How many elements does that array have?  My guess is just one.

 

You should try to avoid the Express VI's.  And if you do use them, use the From DDT express VI to convert it to meaningful data early in the process.

0 Kudos
Message 4 of 15
(5,142 Views)

Each of the terminal branches on the right side of the code are floundering attempts at fixing my problem. I am out of my depth here. 

 

I tried avoiding the use of the measurement VI's, but the other function (extract single tone information.vi) gives me the same error ( 20013) when I hook it up to the threshold detector. I have used the convert from dynamic data, but it hasn't helped. 

Download All
0 Kudos
Message 5 of 15
(5,108 Views)

Exactly what are you trying to do with the Threshold detectors and the Threshold Array?

 

I can tell you why you have an error.  -20013 says the width must be between 0 and the number of samples.  Your width is 1.  But the problem you are turning scalar data back into 1 element arrays.  Thus the number of samples equal 1 which is the same as your width.

 

First, clean up the block diagram.  Second, convert the dynamic data to a waveform and not an array so that you don't lose timing information.

 

Third, describe what you are trying to do with the threshold functions you have dropped into your block diagram.

 

See attached VI for a cleaned up version.

0 Kudos
Message 6 of 15
(5,104 Views)

A more comprehensive explanation of my problem and project is available on this thread: 

https://forums.ni.com/t5/LabVIEW/EMG-Controller/m-p/3629826 

0 Kudos
Message 7 of 15
(5,099 Views)

I tried running your cleaned up code and modifying my own by changing my dynamic data converter to output a single waveform. The 20013 error continues to present.

0 Kudos
Message 8 of 15
(5,094 Views)

@rossc44 wrote:

Each of the terminal branches on the right side of the code are floundering attempts at fixing my problem. I am out of my depth here. 

 


Agreed.Smiley Wink

 

Lets try to take a bit of water out from under you.

 

Starting at the beginning. You have a DAQmx single channel task giving you 500 samples at 1kHz  from a MyDAQ Analog Input

 

Then you toss the 1kHz signal  through a 400Hz lowpass filter --- ??? Why "Frequency (sub) Nyquist" is 500Hz just reduce the sample rate to 800Hz and achieve the same thing only better?  Now that is a serious question... why the lowpass?

 

Then you toss the semi filtered signal through a bandstop  with a 2Hz reject.  expecting what?   Another serious question!!

 

Finally, instead of using all the built in smarts of the myDAQ, you pass the missfiltered signal into some measurement express vis that generate scalar measurements from the 1kHz analog input  (NOTE: those same measurements are available directly from the myDAQ DMM!) And you are putting those scalar measurements through threshold dectector vis and expecting what again?  Why not just use Greater Than? Its arrays of 1 element

 

I think Raven's Fan had a great point asking you to elaborate on WTFWYT?


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 15
(5,085 Views)

@rossc44 wrote:

I tried running your cleaned up code and modifying my own by changing my dynamic data converter to output a single waveform. The 20013 error continues to present.


Of course.  I told you that in my message.

 

I have also brought your other message thread into this one since it had no replies, and that information is important to this conversation.

 

What is your definition of a muscle activation?  Your simulated signal brings in 100 samples at 1 kHz, so 1/10th a second of data.  What about that defines a muscle activation occurred?  And do you expect more than 1 in that 1/10 th of a second?

 

Why are you extracting tone information?

 

Right now, you really don't have a LabVIEW question as much as a question about how you are analyzing your signal.

0 Kudos
Message 10 of 15
(5,077 Views)