Did anyone connected a Mindflex (or other EEG device with NeuroSky TGAT1-L64 chip) to Bela?
Curious if anyone did this before or has comments on the two methods below.

-8 values representing the amount of electrical activity at different brainwaves can be used with the serial data from the chip.
It's easy to get the serial data: "the Mindflex’s “T” pin goes into the Arduino’s RX pin"
https://frontiernerds.com/brain-hack
There's an Arduino library for this
https://github.com/kitschpatrol/Brain

And someone also made a PureData External in C to communicate with the Mindflex
https://github.com/Feulo/pd_mindflex
This would be ideal for me, but I have no idea if it uses the same serial data tap as mentioned above.

OR

-1 value, calculated between “attention” and “mediation” can be used by tapping the PWM of the motor that controls a small fan.
That PWM can be filtered to get a steady DC voltage to go into Bela.

    Haven't heard of anyone using this

    Floris There's an Arduino library for this

    this looks straightforward to port to Bela.

    This is using a Bluetooth connection instead of UART, but with a few changes it can be adapted to receive UART. It seems to be using a separate thread for input, so it should be able to run with real-time constraints.

    alt text
    I'm getting these nice packages of data in the Arduino serial monitor.
    11 numbers separated by a comma.
    When printing the Pd (comport) object, I these packages appear in print.
    Can anyone point me how to get 11 sliders moving from the numbers in these prints?
    alt text

    ps: the numbers in the Pd screenshot are different then the ones in the Arduino screenshot because I wasn't wearing the Mindflex when using Pd ("200" means "no connection" etc)

      Floris Can anyone point me how to get 11 sliders moving from the numbers in these prints?

      you'll need to use an [unpack f f f f f f f f f f f ] out of your [serial_print13] and send its outlets to 11 sliders. This will get the slides moving in Pd, but if you are running this patch on Bela, you won't see them move (as the Pd GUI is not updated while the patch is running on Bela). On Bela you can manually send to the Bela GUI.

      unpacking only partly works.
      In almost every package, there's numbers ending on "e+"
      and often the error "unpack: type mismatch" is printed
      Any idea what I should do different?

      print: 0 24 6.74479e+13 2 3943 7926 24 4865 321808 459 22
      print: 0 4.40925e+12 6.52309e+08 7.10133e+07 1 6913 4 87729 3 2.1197e+06 13
      print: 9 63 5436 113241 791288 5.84935e+15 84698 824
      print: 26 7.16411e+06 2.3026e+09 7178 77 1 7.26135e+07 1 536029 1
      unpack: type mismatch

      hmmm that doesn't sound right. As far as I can tell, scientific notation numbers are correctly interpreted, see below (no unpack error):

      alt text
      (the number boxes are width 10 to ensure the whole number)

      Is it possible that your unpack: type mismatch refers to the next line and not to the previous one?

      alt text

      Just found that the problem starts in the Arduino code already.
      After loading, it always works or a few minutes, and then starts receiving errors.
      When power cycling the headset, the problem stays.
      When restarting the Arduino, it goes well again for a few minutes.
      New battery doesn't help either.

      just to clarify, what's your setup?
      mindflex to arduino to Bela?

      Mindflex > Arduino > laptop over USB > Processing > Pd

      The Arduino Brain library just passes the serial data, so also sends errors.
      Those errors messed up the packages arriving in the Pd/Bela patch.
      By writing a custom processing code, the errors are now ignored and not send to Pd so the packages are received well.

      It's quite a digital detour, but another advantage is that Processing code now also gives me visual feedback in the form of growing triangles over 8 different brainwaves what makes (much needed) brain training easier.