barkleyus / mindwave-python Goto Github PK
View Code? Open in Web Editor NEWLinux and Mac-friendly Python parser to connect and interact with multiple NeuroSky MindWave headsets from one machine.
Linux and Mac-friendly Python parser to connect and interact with multiple NeuroSky MindWave headsets from one machine.
Hi,
first of all thanks for this valuable work.
I am trying to use the mindwave functionality into another python script which uses threading. I can see that threading is used inside mindwave.py in order to get data from dongle. What I am trying to accomplish is to have a master python script which runs 2 or 3 threads. One of them will be mindwave.py.
So, for example I have the following code:
from future import print_function
import threading
import time
import mindwave
class MyThread(threading.Thread):
def run(self):
print("{} started!".format(self.getName()))
time.sleep(1)
print("{} finished!".format(self.getName()))
if name == 'main':
mythread = MyThread()
mythread.start()
h1 = mindwave.Headset('/dev/rfcomm0')
h1.connect()
time.sleep(.9)
and I get the following error:
Thread-1 started!
Thread-1 finished!
Exception in thread Thread-2 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
File "/usr/lib/python2.7/dist-packages/mindwave.py", line 74, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'error'
Do you have any ideas?
Are there any problem with connecting two mindwave mobile at the same time via bluetooth?
It is giving me this error
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/serial/serialposix.py", line 278, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
SerialException: could not open port /dev/tty.MindWaveMobile-DevA: [Errno 16] Resource busy: '/dev/tty.MindWaveMobile-DevA'
Is there any solution?
I appreciate your response.
Hi - I just bought a MindSet with the intention of developing against it in Linux. I was under the (I now think mistaken) impression that the MindWave wouldn't allow capturing real-time raw data, but the MindSet would. Does this library support the MindSet as well? Should I just buy a MindWave instead?
On Linux, you can use the MindWave just like that but on OS X 10.10, even though /dev/ttys001 appears, it cannot be used. headset.status will be None and usually there will be the error
serial.serialutil.SerialException: Attempting to use a port that is not open
To fix this and to make /dev/tty.MindWave appear, you need to install the Mac OS X NeuroSky MindWave driver from http://support.neurosky.com/kb/mindwave/cant-get-the-connection-with-mindwave-in-mac-os-x-1010
You could add the info to your readme, even though having it here will be helpful already I hope.
https://github.com/vsltech/neuroskymindwavecapture repo does not seem to crash like this one does.
was wondering if you had plans to implement the delta theta gamma readings like neuropy has done. by parsing the 0x83 or is that available on the mw001 headsets ?
I have the Mindset headset with the RF dongle.
I've tested with various scripts including the code snipped from your example.
The headset connects but just after that it receives the following error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
self.run()
File "F:\code\EEG_Python_learning\mindwave.py", line 73, in run
self.parse_payload(payload)
File "F:\code\EEG_Python_learning\mindwave.py", line 143, in parse_payload
raw=ord(value[0])*256+ord(value[1])
IndexError: string index out of range
I can't seem to figure out what the correct value should be and why I'm getting this error.
This happens all the time
is there any configuration/version for windows?
Hi, I'm having some difficulty connecting to my MindWave Mobile- just blew the dust off of it, and am hoping it's not so far in the past it's unuseable.
import mindwave
headset = mindwave.Headset("/dev/tty.MindWaveMobile", '3A8B')
Exception in thread Thread-1:
Traceback (most recent call last):
File "/Users/pizzmancer/miniconda3/envs/mindwaveproject/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
>>> self.run()
File "/Users/pizzmancer/_Code/python-mindwave/mindwave.py", line 122, in run
s.write(DISCONNECT)
File "/Users/pizzmancer/miniconda3/envs/mindwaveproject/lib/python3.11/site-packages/serial/serialposix.py", line 616, in write
d = to_bytes(data)
^^^^^^^^^^^^^^
File "/Users/pizzmancer/miniconda3/envs/mindwaveproject/lib/python3.11/site-packages/serial/serialutil.py", line 65, in to_bytes
raise TypeError('unicode strings are not supported, please encode to bytes: {!r}'.format(seq))
TypeError: unicode strings are not supported, please encode to bytes: 'ร'
I understand there is a difference between having
pip install serial
and
pip install pyserial
but neither library seems resolve this issue. Any help would be much appreciated!
(The NeuroSky drivers have been installed on my Mac, if that's a concern)
Hello
I don't know if I have a problem but I can't get the blink value
Meditation and attention work perfectly, but I can't get blink detection to work. It is always at zero.
Hi after few seconds running fine, the script throws this error and it will stop reading from the mindwave. Any solution?
Thanks
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/home/pi/python/Mindwave/mindwave.py", line 73, in run
self.parse_payload(payload)
File "/home/pi/python/Mindwave/mindwave.py", line 143, in parse_payload
raw=ord(value[0])*256+ord(value[1])
IndexError: string index out of range
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.