Your Brains on Python Part 2: Python Mindwave Brainwave Recorder and How To Get Started

Поделиться
HTML-код
  • Опубликовано: 13 сен 2024

Комментарии • 36

  • @SitoNiv
    @SitoNiv Год назад +1

    Thank you very much for this project.
    I've been trying to obtain data from a brainlink headset, to my understanding it has the same protocol as the mindwave headset so this project should do, am I right?
    In addition, I have some questions:
    How do you interpret negative raw eeg values?
    why are the band values so high, is there a specific range or it's just 0 to infinity?
    (If you know of written documentation regarding those questions I would like to see it)
    Thanks a lot!!

    • @DevXplaining
      @DevXplaining  Год назад +1

      Hi, I'm happy you like it!
      I've only used the Mindwave headset so cannot say much about the protocol of any other headsets. But if you are using Mindwave, the documentation is here: developer.neurosky.com/docs/doku.php?id=thinkgear_connector_tgc
      And even if using something else, the basic principles should remain the same so documentation might be an interesting read. Of course, evolution has gone a long way from my trusty old headset already, so current gen devices are much more powerful.

  • @aarohizade5878
    @aarohizade5878 Год назад +1

    Thank you so much!!

  • @bearfoot7415
    @bearfoot7415 3 года назад +2

    Hi i'm window user but how can i run the program?

    • @DevXplaining
      @DevXplaining  3 года назад

      Hi, getting the bluetooth pairing, access and libraries to work was a bit problematic, that's why I ended up running it on a MacBook.
      That being said, if you have the device, and it's paired on your Windows machine, you should see the Bluetooth device and can attempt to connect to it. But I didn't figure it out all the way myself, never got it to work too well. This is based on a fork from original BarkleyUS repo (github.com/BarkleyUS/mindwave-python) - and they say it's 'Linux and Mac-friendly' - so might explain why it's difficult on Windows.
      There is like few dozen alternative libraries, so might be some of them works better with Windows. But I just wanted to get it done and it was easiest to get working in Macbook.

  • @bobobobobobobob21
    @bobobobobobobob21 3 года назад +2

    maybe ill use this to control an RC car. It would be funny, you have to think sad thoughts to turn left, happy thoughts to turn right.

    • @DevXplaining
      @DevXplaining  3 года назад +1

      Haha, you know, I had similar ideas about mind-controlled drone. But as becomes evident in the next weeks episode, it's not reliable enough for anything that moves :)
      I am thinking of doing a series on a gestures UI later, that could be used for controlling a drone or RC car, easily.

    • @bobobobobobobob21
      @bobobobobobobob21 3 года назад +1

      @@DevXplaining hahah yeah I thought the feeling control would be wonky. I like the gestures idea, would be a good video.

  • @user-gy4qo3ev4z
    @user-gy4qo3ev4z Год назад +1

    headset = mindwave.Headset('/dev/tty.MindWave') How shall I change it if I am using windows? Thanks

    • @DevXplaining
      @DevXplaining  Год назад

      Hi, most important thing is that you have managed to pair the headset with your computer, otherwise there is no device. And that to my experiment has not been always so easy. For Mindwave mobile, the manual is here: download.neurosky.com/support_page_files/MindWaveMobile/docs/mindwave_mobile_user_guide.pdf
      But once you are there, you should have.a COM port for the connection. In my case it was simply 'COM4'. I left a bit of commented-out code in the git repo that has the line that was working for me with Windows.
      headset = mindwave.Headset('/dev/tty.MindWaveMobile-DevA')
      #headset = mindwave.Headset('COM4')
      So first one is for my macbook/linux, second was for Windows. But COM4 might be something else in your case. If you can somehow enumerate bluetooth or com port details on your machine, you know the proper port. Otherwise you can of course try with a few probable ones, see which one might connect.
      The hardware and software starts to be rather old nowadays, so especially with Windows starting to be a tricky business. I've been looking for a more recent generation to play with, it seems EEG headsets are still getting attention.

  • @usermnh
    @usermnh 2 года назад +1

    Hi, do you know if this requires the ThinkGearConnector? I have problems with connecting to my Mac (M1 2020), I only get null values and also the connection with the Mindwave tutorial app does not work..

    • @DevXplaining
      @DevXplaining  2 года назад +1

      Hi, yes, sadly the Mindwave is very fragile. The code does not require ThinkGearConnector, as it is conversing with the device directly via the Bluetooth port. However, there may be a number of issues, including:
      - Is the headset Mindwave mobile with Bluetooth? If not, code would not work. Or, if it's a new version they have changed, something I have not tested with.
      - Can you connect to it with the provided software? If not, probably code would not work either.
      - Is the headset successfully paired, as in visible as a Bluetooth device?
      - Can the serial port code successfully connect?
      - And yes, sometimes I managed to get a connection, but would receive null values. In that case typically the sensors were not aligned properly to my head/earclip, also needed to give it few minutes time to settle.
      So, sadly, it is a sensitive and tricky piece of equipment. Good news is that MacBook is where I managed to get it to work, without the ThinkGear connector. Bad news is that if you cannot connect with the tutorial app, there might be some incompatibility issue that I am not aware of.
      But, if you manage to pair it as a Bluetooth device, from there it's mostly just serial port traffic, so more straightforward to debug. So I would check: Is it paired as Bluetooth device, and can you make a connection? And then, is ear clip properly attached, can you adjust the forehead sensor location and see if you start getting data?
      If none of these work, then I think we have to wait for the Neuralink sensors instead :p

  • @bearfoot7415
    @bearfoot7415 3 года назад +2

    how did you set illithid git :(master) in your terminal?

    • @DevXplaining
      @DevXplaining  3 года назад +1

      Hi, sorry, I don't understand the question here, can you elaborate? The way to use the code is to do a 'git clone' from the repository, but you also need the Mindwave headset and need to have paired it with your computer.

    • @bearfoot7415
      @bearfoot7415 3 года назад +1

      @@DevXplaining Um sorry my question was wrong. I mean what should I install the module to import mindwave. I m a student preparing school competition by mindwave mobile devices so i'm learning the device and python now:)

    • @DevXplaining
      @DevXplaining  2 года назад

      Hi, sorry I missed this question, just noticed it. First you need to have the device and need to have paired it, as per developer.neurosky.com/docs/doku.php?id=mindwavemobile
      I see that I don't have the normal requirements.txt library files in git, should have fixed that (huecontrol subfolder has it). But the way I connect, I think the most essential dependency is pyserial, since after pairing the device is visible as a serial port. So 'pip install pyserial' is a good starting place.

  • @kodiererg
    @kodiererg 2 года назад +1

    I wonder what could be done if we had millions of people feeding eeg data into machine learning models. Particularly supervised machine learning models.

    • @DevXplaining
      @DevXplaining  2 года назад

      Oh, haha, yes, that's one thing that boggles my mind too. In my work I've been integrating tens of thousands of IoT devices to AWS that feed a constant stream of data, that's then processed, analyzed, and refined. So when I see a sensor that sends wirelessly some data, of course, my imagination thinks of this. Then my imagination remembers all the sci-fi books I've read and I reject that thought :)
      But just from a curiosity perspective, with people willing to use that kind of stuff, it doesn't differ that much from sports watches or smart rings. And my sensor set is like a decade old, so I do wonder what could be done with today's best sensor tech, connecting things say to Kinesis streams.
      Way back I ran a little experiment to use machine learning to gauge people's attention and mood during video conferences. That was mostly a fun experiment, nothing serious. But the idea was for the speaker to get constant, real-time, very simple (traffic lights) feedback on how well people are present there. Now imagine if we could experiment the same but add more metrics... :) Or, if we could really measure stress levels and give better recommendations for pacing the work day. Or be able to predict, in nursing homes, if accidents are about to happen before they happen. The list is endless.
      And, what requires a sensor helmet today, will probably fit in sunglasses tomorrow. :)

    • @kodiererg
      @kodiererg 2 года назад +1

      @@DevXplaining I think we could probably get more insights than we currently think are possible, but the flipside is I wonder if companies like Meta already do this with their oculus. If they can figure out whether or not you're bored or engaged by your brain waves, that's a whole new level.

  • @johnlloydengay3389
    @johnlloydengay3389 2 года назад +2

    Hello! May I ask how will I show those results in the graph?

    • @DevXplaining
      @DevXplaining  2 года назад

      Hi! Do you have some brainwave data recorded? If you do, the notebook functions will show it. Without any recorded data, of course nothing to see.
      I did not include my brainwaves data in git repository, perhaps I should have left there a bit, so people can play even without having access to recording?

    • @johnlloydengay3149
      @johnlloydengay3149 2 года назад +1

      @@DevXplaining hello! I dont have data recorded yet. However, I would like to use the python project as a tool to gather brainwave data. Unfortunately, i'm facing some issue because it says that "ModuleNotFoundError: No Module named Neurosky" appears. How will I fix that?

    • @DevXplaining
      @DevXplaining  2 года назад

      ​@@johnlloydengay3149 Hmm, the code I have should not be looking for any Neurosky Modules. What is it exactly you are doing when you get that error?
      Here is the Neurosky device support pages:
      developer.neurosky.com/docs/doku.php?id=mindwavemobile

  • @emregungor7500
    @emregungor7500 2 года назад +1

    Hello how can we connect headset on online server ?

    • @DevXplaining
      @DevXplaining  2 года назад

      Hi, good question! I haven't taken my experiments so far yet, but have given it some thought. I would use AWS Kinesis sercice right now to stream the realtime data in, or something similar. Better question is what to do with it :)

  • @serlyyuliana9730
    @serlyyuliana9730 3 года назад +1

    Hi, can you give me the link of the codes ob GitHub? i need for my final project. thank you very much

    • @DevXplaining
      @DevXplaining  3 года назад +1

      Hi, just noticed the descriptions and the link are missing from this episode two. I fixed the descriptions, thanks for pointing this out. The link is same for all episodes, I'll just walk through different parts of it in these videos.
      But you should now see the link in the description. Let me know if you cannot find it - but do note that code without a BCI device is not doing much.

    • @serlyyuliana9730
      @serlyyuliana9730 3 года назад +1

      @@DevXplaining thank you very much. I have any questions about bci device, how to make dataset from bci device? I am confused about that, cause i am beginners to use the device

  • @themianazhar5275
    @themianazhar5275 2 года назад +1

    hi thankyou for the video i used your code but my results are not good both attention and meditation are greater than 50 at same time

    • @DevXplaining
      @DevXplaining  2 года назад +1

      Hi! Thanks for the comment! It is possible to have high scores on both simultaneously, as they are not exlusive ends of same line.
      But they are calculated from the raw values, and obviously simplify the results a lot, that's why I am more interested in the raw bandwidth data.
      Also: Always when measuring, it's important to record longer bits, as thing will always settle down a bit over time. So truer results are always after a bit of warmup period, when you start forgetting you are measuring, if that makes any sense?

    • @umarkhayam3500
      @umarkhayam3500 2 года назад +1

      could not open port /dev/tty.MindWaveMobile-DevA: [Errno 2] No such file or directory: '/dev/tty.MindWaveMobile-DevA'
      how to handle with this error?

    • @themianazhar5275
      @themianazhar5275 2 года назад +1

      @@umarkhayam3500 "headset = mindwave.Headset('/dev/tty.MindWaveMobile-DevA')" remove this line from the code and uncomment the very next command "#headset = mindwave.Headset('COM4')"

  • @umarkhayam3500
    @umarkhayam3500 2 года назад

    could not open port /dev/tty.MindWaveMobile-DevA: [Errno 2] No such file or directory: '/dev/tty.MindWaveMobile-DevA'
    Sir how to handle with this error

    • @DevXplaining
      @DevXplaining  2 года назад

      Hi! So do you have the Mindwave Mobile device? And have you paired it with your computer? May I ask if it is Windows or Macbook?
      The device port depends on the operating system, and if you paired with Bluetooth, and what other devices you have there, so what works for me probably is different for you.
      Here is the Neurosky support page for Mindwave Mobile headset.
      developer.neurosky.com/docs/doku.php?id=mindwavemobile

    • @FahimShahryer-
      @FahimShahryer- Год назад

      @@DevXplaining working on windows, and paired with bluetooth and same issue