From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Real time notch filter 8 channel doesn't work

Hi

I built 8 channel real time EMG data acquisition hardware connecting to LabVIEW interface, in real time filtering low pass and high pass point by point work properly but band stop doesn't work even for 1 channel, i change band stop to dfd iir comb filter it work great for 1 to maybe 3 channel but when i apply it to 8 channel real time acquisition get very slow! i think this block most modify for 8 channel but i don't know how, i attached my block for every 8 channel:

0 Kudos
Message 1 of 10
(3,253 Views)

Hi saleh,

 

whenever you have problems with your code you should attach that code so we can inspect it!

(Please attach the VI, not just images of it.)

 

Don't forget to include some sample data with your VI!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,238 Views)

Thanks for reply

I attached basic vi , this vi acquisition get 8 channel data with 1000 sample per second but when i apply notch filter it doesn't work and vi become very slow.

 

0 Kudos
Message 3 of 10
(3,225 Views)

Hi saleh,

 

would you mind to clean up your VI first?

 

There are some "interesting" things in your VI, like:

- why do you write a value to a chart, just to write a different value to the same chart using a local variable after that?

- why do you write all those "zero" values to your charts when the channel is switched off?

- why are there controls without labels?

- are you sure about your conversion from (array of) U8 to U32 values after the VISARead operation?

- what is the sampling frequency? Is it really 1000Hz as you have set for your filters?

- why don't you minimize usage of case structures per channel? Why do you need 8 (?) case structures per channel?

 

Why don't you use arrays instead of copying the very same code again and again?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(3,218 Views)

1-Because of hardware restriction i can send 500 time buffer to labview in 1 second,so i send 2 sample per 2 millisecond, finally i concatenating 2 sample together(it isn't serial protocol)

2-I have no idea when user off channel, is write zero to chart make problem? or I can do something else?

3-Witch controls do you mean?

4-Yes it is true, i clean some other calculation for security but it is real 24bit adc and work fine.

5-Sampling is exactly 1000 Hz , it work fine for low and high pass filter

6-How can i minimize case structure?

I have another problem that when i set sampling to 250Hz it work great in my pc and other weak pc ,but when i set sampling to 500 or 1000 it get slow in weaker pc.

0 Kudos
Message 5 of 10
(3,211 Views)

Hi saleh,

 

1. "500 time buffer in 1 second" suggests just 500Hz sample rate…

2. You could prohibit any plotting at all when the channel is off. You could even prohibit any data processing (aka filtering) when the channel is off…

3. Several boolean buttons have no label!

4. When you use a 24bit ADC you should multiply with 65536 and 256 (instead of 65535 and 255)…

5. See point 1.

6. By grouping them better…

 

I have another problem that when i set sampling to 250Hz it work great in my pc and other weak pc ,but when i set sampling to 500 or 1000 it get slow in weaker pc.

Well, you have two simple choices:

- limit the processing needs of your algorithm

- only use "better" computers able to run your algorithm

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 10
(3,208 Views)

Hi saleh,

 

just a suggestion:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 10
(3,202 Views)

I would either clean up the string parsing or replace it (see image)

 

ParseString.png

Randall Pursley
Message 8 of 10
(3,177 Views)

Hi GredW

Thanks for your reply and i modify my code but the notch problem still remain, lowpass and highpass filter work properly but notch filter doesn't work, also i am sure sampling is 1000Hz 

0 Kudos
Message 9 of 10
(3,158 Views)

Hi saleh,

 

with a 2nd order filter you probably will not filter such a narrow frequency band.

Read the help for the filter function and wire ALL inputs as needed!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(3,155 Views)