-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blink value is always zero #3
Comments
Hmm, not sure. Are you binding a handler to the blink event, or you are you reading Here's how to capture a blink event and read its strength:
Let me know if it fails that way too. Reading the value directly will only briefly flicker to a non-zero value whenever a blink occurs. |
Didn't work. Here's my code:
I might be doing something completely wrong. Could you show me a full example code that gets blinks? |
A couple things jump out a bit at first glance. One is that appending the handler inside the while loop means that it's getting added over and over and over again, hundreds of times. It only needs to be added once to be "registered," so you can pull it up out of the while loop. Also, it's a good idea to put a little bit of delay in your while loop so you're not taking 100% of the CPU and possibly blocking the thread from executing the blink handler when a blink is detected. This can be done by just adding a small sleep. Try modifying the bottom part of the code to something like this:
Let me know if that helps! Also, have you tried the manufacturer demos just to double-check that blinks are working well? |
Still nothing. The manufacturer demos work fine though. I read somewhere that blink detection is actually done in software, not build directly into the headband like attention and meditation detection. Have you ever gotten blink detection working with this? |
It did work with the MindWave USB headset for sure, but I'm not sure if anyone has tested it with the Bluetooth one. Are you using the USB or Bluetooth MindWave? We've since pretty much retired our headsets, so I don't have them on hand to be able to test any more. |
I'm using the USB version. I have no idea why it's not working. Do you have a full script that I could try so I could do the exact same thing that you did? |
Sorry for the frustrations. I can take a peek when I'm back in the office on Monday and see if I can find any old code that had blinking in it. I have a feeling the only projects we hung onto were the ones that used just the attention/meditation values. I'm going to re-open the issue for now so anyone else with the problem can chime in, or someone can contribute their working blink code if they have a functioning example. |
Just thought of another quick test.. Here's the code for reading blinks from the headset: https://github.com/BarkleyUS/mindwave-python/blob/master/mindwave.py#L127 No need to understand that, but if you notice above that line, it's reading/calling event handlers in the same way it calls the attention/meditation handlers. Would you mind trying to swap out your code to call your handler function as a handler for the meditation or attention events instead? Just to make sure the event handler calling is working at all, since we know attention/meditation are working. Your code might look something like this:
Just make sure it actually detects and prints out attention values. Then, swapping the exact same code, make sure it fails for blink events. |
Thanks for your help. I tried what you said and it works fine for attention and meditation, just not blinks. Any other ideas of what it could be? |
Have the same issue. Blinking is never even reported. I even changed a bit the SYNCing logic and enabled checksum (why did you disable it in the first place?) to be extra sure that I'm not losing anything and dumped any unhandled codes. It seems that it simply does not report blining. Period. So I guess there is no problem in your code, just some weird thing with the EEG itself (blinking is working in windows). I have a USB headset. |
Man, that is so bizarre. I'm really scratching my head, especially since it works with the manufacturer software. And, on the checksums, I was getting invalid checksums when the packets looked just fine, causing it to drop a lot of values, so I disabled it. But, maybe that was just the headset I had at the time. |
I'll tinker with my EEG later trying to get to the root of this. Probably will dump the whole exchange from windows to see if there are some undocumented codes or commands. BTW, there is an error in your checksum code: you should do it for the whole payload, not for payload[:-1]. Also |
Having the same issue, I found a note in the Mindset communication protocol: |
I ended up just writing my own blink detection algorithm which worked pretty well. Probably not quite as accurate as the standard one, though. |
@jacobstein123 Can u share your code with us ? Thanks in advance. |
Here's the code: https://github.com/jacobstein123/EEG_Robotic_Arm/blob/master/eeg_control.py. It has a bunch of other stuff in it, but the blink detection is there. I wrote this in high school before I knew anything so it's prob pretty rough, but it did work. |
Hi! Check these projects based on mindwave-python http://www.vslcreations.com/2018/01/how-to-connect-neurosky-mindwave-with.html |
Meditation and attention work perfectly, but I can't get blink detection to work. It is always at zero.
The text was updated successfully, but these errors were encountered: