Showing results for 
Search instead for 
Did you mean: 

How to control mouse cursor using EEG signals

Go to solution

Hi everyone,


I am doing a project of cursor control using EEG signals. The idea is to find the average of all signals in a specific epoch time in order to find the peak signal. Then, the highest peak will be a parameter to control the position of a mouse cursor.


Can anyone tell me the function that use to control the mouse cursor?


I also  found old topic asking about this ( and I run an example program from that link ( ). My cursor stuck at the upper left corner of screen, I can't control it again. Would you explain me how to run that program and use the windows API?


Thank you in advance.




0 Kudos
Message 1 of 11

What is exactly your problem? The VI just works fine for me. I guess you run the VI in "Run continuously" mode? Do not do that.


I would use an Event structure pattern, but of course, it also depends on your DAQ part. Also important to program a button Event case, so when you want to stop the code running, you can do it so with a key press (or combination), since your mouse will be moved by the code and cannot be used to control the GUI...

If you are a beginner in LabVIEW, I advice you to have a look at the free online training material...

0 Kudos
Message 2 of 11

Have a look at this png snippet (if you drag&drop it into a BD, you have the VI). I just generate random numbers to set position of mouse 4 times per sec in the timeout case. If you press ctrl+shift+Q, the VI stops running. You could have your DAQ+processing in a separate loop(s), and by using User Events you could set the mouse position in the Event loop. But of course there are other options too, it can be done in many other ways depending on your actual requirements...



0 Kudos
Message 3 of 11

Hi Blokk,


Thank you for your suggestion. I finally can control that program. To stop executing file, press ctrl+ period(.) button.


However,  Do you know how to calculate data element from acquired data file with specific time window, epoch. For example, In 1 acquired data file, I separate all data in to 4 epoch,a,b,c and d. I want to find the average signal between a,c and b,d. Then, I want to detect the highest peak from both average signal. Could you suggest me?



0 Kudos
Message 4 of 11

I would suggest to start learning the basics of LabVIEW. Have a look how to read different type of data files (you have a binary, ASCII, tdms,...?).

Try to make a VI, and post it here if you have problems. People will most likely help if you show effort to program yourself.

Have a nice learning!

0 Kudos
Message 5 of 11

Thank you for your suggestion Blokk. 


This is my VI. A function generator represents to a DAQ assistant. I also attached an example file which consist of acquired data and comments that I want to separate each epoch and calculate it. However, I have no idea how to calculate elements in data file with specific time interval. Can you help me solve this?

0 Kudos
Message 6 of 11
Accepted by topic author kuzing
11-01-2015 12:29 PM

Sorry, but I cannot do it for you.

As I advised, you should take the free online tutorials. You are clearly missing basic concepts of LabVIEW, like data flow.


Some more things: in your real applicaton do not use DAQ Assistant, Express VIs are not optimal for data acquisiton usually. It is safer and better to use proper DAQmx VIs. What is the hardware you are going to use? Sampling rate, etc?

Why do you need to read data files? For testing? I thought you will acquire live data, no? In your VI you generate some signals, and write it to a data file. Is it also for testing?

There are multiple constructs in your VI which just do not make any sense.


Therefore again, I really suggest to go through the Core1-2 online teaching material, which can be accessed if you are a student, or if you have SSP licence...It will really help.

0 Kudos
Message 7 of 11

Actually I am a student and very new to Labview but I am fun to learn it. You may know from my non make sense code. ..,,


I used NI USB6009 as a DAQ device with sampling rate of 300 Hz.

The signal generator is just for testing.

The reason I need to read data file is that I want to find the average of signal and detect the peak to be a parameter for cursor control.



0 Kudos
Message 8 of 11

Ok, I see. Well, it looks an interesting project, so this is a good opportunity to start learning LabVIEW.


0 Kudos
Message 9 of 11

Hi Kuzing,


I was wondering whether you came right with your project.

I am also doing the same type of work and would like to chat to you about your method to get information from the EEG signal.

Can we discuss it? Or at least could you point me toward some documentation that describes your method.


I hope you can help.

Best regards

0 Kudos
Message 10 of 11