LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having a motor response by EEG and EMG

Hey Everyone,

 

I am working on a project that is supposed to read EEG and EMG data and then turn on a motor. The aim of this is to keep a rat awake using an external stimulus. Currently I have a basic structure, but there are still some things that I'm not sure how to accomplish in LabView. Here is what I would like the program to do.

 

EEG and EMG signals come in from the DAQ I'm using. The EEG should be filtered with the fft block. From there I would like to separate alpha, beta, etc waves and then measure the intensity in order to determine if signal coming in is asleep. Currently I am just looking at the alpha waves to determine if the eyes are open/closed. If the signal meets the set criteria, then it would be sent to an AND boolean operator. The other part of the AND operator would be the EMG. The EMG should just be looked at by intensity (whether or not the muscle is activated or not). When the EMG is below a threshold it sends a TRUE value to the AND operator. When the AND operator is TRUE, I want to have an output signal through the DAQ. I thought about using case structure for this part, but haven't had much success. I would like to have 10 seconds of recording and then take an average. Mainly this is just so that way the motor isn't constantly changing. I would like to have the smallest increment of time the motor be on would be 3 seconds.

 

I've put an image of the program below because LabView won't let me save the VI to transfer it this computer (no internet on the LabView computer).

 

I am running v 15.0.1f7(32-bit)

Thanks in advance!

0 Kudos
Message 1 of 5
(2,402 Views)

I'm having some problems uploading the image file I had (.tif) so I just uploaded it to imgur.

https://imgur.com/phbTCYB

0 Kudos
Message 2 of 5
(2,400 Views)

Could you provide some more details on the exact issues you are currently experiencing? What are the specific issues in your code that you are running into?

CH
Applications Engineering
National Instruments
http://www.ni.com/en-us/support.html
0 Kudos
Message 3 of 5
(2,357 Views)

The main problem I am having right now is getting it to collect data for X amount of time and then average those values. For example, I would like to collect data for 10 seconds. After that 10 seconds the DAQ outputs a signal until it reads that the rat is awake and then return to the 10 second epoch recording.

0 Kudos
Message 4 of 5
(2,348 Views)

Just looking at your code I have some basic feedback to get you started.

 

1. In general, you will probably want to find a way to move your post processing out of the while loop you are doing your data acquisition in. What you are trying to do sounds like a great use of a producer consumer architecture in LabVIEW. Your producer loop will run your finite data aquistion task, and your consumer loop will average the values and do any other processing or logging you desire. See more here:

 

http://www.ni.com/white-paper/3023/en/

 

2. To do a finite task, i.e collect data for X amount of time, you'll want to wire an appropriate value to your '# of samples input' that will give you a 10 second acquisition give your sample rate. If you would like to see how this would be done using the DAQmx function calls themselves and not the DAQ Assistant, try looking, in LabVIEW, at Help > Find Examples > Hardware Input and Output > DAQmx.

 

Some other links that may be helpful:

 

http://www.ni.com/product-documentation/5438/en/

 

http://www.ni.com/product-documentation/2835/en/

CH
Applications Engineering
National Instruments
http://www.ni.com/en-us/support.html
0 Kudos
Message 5 of 5
(2,337 Views)