BrainBay, install, neurofeedback tutorial

edited February 2015 in Software
Hi All,

Chris, the primary developer for <a href="http://www.shifz.org/brainbay/"; title="BrainBay">BrainBay</a>, has just created an OpenBCI-specific driver. Now you can use OpenBCI with BrainBay without any fakery or trickery...just plug it in and go! All 8 channels at full 24-bit resolution...yay!

You can see some example data at: http://eeghacker.blogspot.com/2014/01/openbci-driver-in-brainbay.html

I think that the OpenBCI driver is part of BrainBay V1.9.

Thanks, Chris!

Chip

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited February 2015
    A new release of BrainBay is available. We've been working closely with Chris Veigl over the past couple months adding various fixes and enhancements (via Git Pull requests to his main repository).

    As an example, one mod in particular, to the Oscilloscope block, makes it much easier to view your signals from the OpenBCI board. Previously scale factors had to be adjusted manually with right clicking on Osc. input pins, (due to the huge signal range of our 24 bit samples.) Now the scale factors are adjusted automatically.

    So if you are interested in BrainBay, this version 1.9.3 has considerable improvements over the January 2014 version. And works with the V3 board. Partial list of Github commits:

    * added sanity checks to Filter parameters to prevent crashes
    * fixed design view display of 1 channel RAW EEG sources
    * MCI Media Player: now rewinds / restarts at end-of-media.
    * New installer .nsi with Uninstall warning message.
    * Roll the Spectrogram window rather than completely clearing it.
    * Oscilloscope mod for huge (24-bit) output range EEG devices.
    * New OpenBCI V3 packet format, both 8 and 16 channels.
    * added opi test configurations
    * modified COMREADER to allow also writes to COM port
    * second NIA device updates
    * added OPI TrueSense Exploration support
    * added option to append archive starttime to time display
    * Neurobit fixes, dll version

    Download page: https://github.com/ChrisVeigl/BrainBay/releases

    Main site:  http://www.shifz.org/brainbay/

    Commits log:  https://github.com/ChrisVeigl/BrainBay/commits/master

    Neurofeedback tutorial with OpenBCI: https://sites.google.com/site/biofeedbackpages/brainbay-openbci

    If you previously used an old BrainBay installer, you do not need to uninstall before installing the new version. You can just run the new installer. If you do use the Uninstaller, be cautious, as it will also uninstall any additions or changes you have made in your CONFIGURATIONS (.con files) folder. The new Uninstaller dialog box warns of this.

    William Croft

    PS as an aside, it does even appear to work on Mac under VirtualBox using one of the free Microsoft virtual machines(!) (And virtual COM port emulation). But you are obviously better off running under native Windows.


  • wjcroftwjcroft Mount Shasta, CA
    edited February 2015
    Some users are asking how to get started with Brainbay and to verify it is working. A tutorial is now available at,

    https://sites.google.com/site/biofeedbackpages/brainbay-openbci

    This covers both an initial simple design, similar to what is described below -- and a sample neurofeedback design. Both designs are explained so that you can start building your own 'circuits'.

    ----

    Very abbreviated steps just to verify install and oscilloscope output (tutorial is recommended instead):

    Run the BrainBay installer from http://www.shifz.org/brainbay/ . Start Brainbay.

    You can then setup a very simple design / "circuit".  OpenBCI EEG element on the left, connect one of the channels to a Filter element, then connect the Filter output to an Oscilloscope. Filter parameters would be for example, a Butterworth Bandpass filter, order 4, from .5 hz to 40 hz.

    All the design blocks "open up" by right clicking on them. In the EEG block, put in your COM port and press the Connect button. The check box should come on. When your circuit is ready, press Play button in the lower left of the main window. Adjust the slider in the Oscil. to set your full scale uV. It starts out somewhat high at 500 uV full scale. Typical scope full scale values would be around 100 uV or 50 uV.

    William
  • Hi William,

    I'm wondering if there are some resources online you'd recommend where I could educate myself on some of the basics of building neurofeedback programs. I'm quickly realizing that I'm missing (or forgetting in some cases) basic math and electronics fundamentals that I learned (or should have learned) 15 years ago.

    Not sure what others' experience here looks like, but I'm a software guy who purchased OpenBCI as an alternative to an out-of-the-box solution to learning about neurofeedback. I'm more interested in using programs like BrainBay and BioExplorer than I am in hacking the hardware side of things, but it's been interesting picking up bits about Arduino and related topic along the way.

    I'm basically wondering if there are software-agnostic resources for a beginner to learn about creating these kinds of projects on their own. As I've alluded to in other posts, I'd like to eventually play with the OpenBCI hardware in BioExplorer, but BrainBay works now and it's free. To be honest I don't know enough about BrainBay vs. other commercial packages like BioExplorer, BioEra, etc to know whether they're apples and oranges.

    Thanks again for all of your help here on these forums.

    Frank
  • wjcroftwjcroft Mount Shasta, CA
    Frank, hi.

    The 'books' page below has a link to a video tutorial series on BCI from UCSD. Many other resources in these lists as well.

    http://openbci.com/forum/index.php?p=/discussion/185/list-of-blogs-about-openbci-neuroscience-and-related-topics

    Brainbay, Bioexplorer, etc. are what you could consider "signal processing flow" programming environments. They basicallly take a stream of EEG samples (250 per second) and do various filtering and feedback operations on the data. So a typical sequence might be to filter and display EEG activity in a certain band, say alpha from 8 to 12 hz. Then extract the magnitude / amplitude of that band (in microvolts), and use that to control the audio volume / or visual feedback that is given to the user. I'm sure you've seen Chip's blog, a really excellent series of tutorials / DIY howto's.
  • edited January 2015
    Addendum for Mac users: I was able to install BrainBay in Wine and get the data connection to work correctly. In order for this to work you need to download and install the FTDI drivers for Mac from here http://www.ftdichip.com/Drivers/VCP.htm
    When plugging in the dongle, a new device should appear under /dev/tty.usbserial...
    Symlink this file to a virtual com port in Wine like this:
    ln -s /dev/tty.usbserial-DN00969W ~/.wine/dosdevices/com1
    After installing and starting BrainBay in Wine, insert the OpenBCI source via "Insert Element" -> "Source" -> "Biosignal/EEG Amplifier" -> "OpenBCI" and then choose and connect to COM port 1.
    Using the oscilloscope test that William explained in the first post, I got plausible signals from all channels including accelerometer :)

    The same procedure should work under Linux, only the device name might differ and you should check that the permissions on the device file are appropriate.

    Have fun!
    Martin
  • Just wanted to say thanks to everyone that has contributed to this thread. I was able to install and configure BrainBay successfully to work with my openBCI and using the alpha test suggested for the Processing application (electrode at O1) was able to generate some noticeable voltage spikes in an oscilloscope using an alpha filter upon closing my eyes. Very exciting!

    On the same scope I included a filter for Beta which, whilst lower in amplitude  seems to mirror the beta patterns in ratio. Is this correct? I'd have thought there would have been an inverse relationship between alpha and beta during eyes open/eyes closed.

    Thanks again, I look forward to experimenting even more with my new device and BrainBay.

  • wjcroftwjcroft Mount Shasta, CA
  • edited March 2015
    Hi, 

    I'm having problems connecting the dongle with the com port in Mac having installed BrainBay with Crossover,
    i'm trying:

    ln -s /dev/tty.usbserial-DN00969W /Users/Ray/Applications/CrossOver/BrainBay/com1

    It says  Not such file or directory. Any sugggestions?

  • wjcroftwjcroft Mount Shasta, CA
    Bright, you might have better luck with Wine, see post above by @nightscape . For one thing though, you need to use the correct tty.usbserial-xxx file. Do an "ls /dev/tty.usb*" command to see what your exact device name is. Then symbolic link THAT name, not the one used on the previous Wine example. Each dongle has a unique serial number / device name.
  • edited March 2015
    However....isnt Crossover a wine version actually? I thought so. i've changed the name of the device name (spacey..) 
    Now It responds like that:

    ln: /Users/Ray/Applications/CrossOver/BrainBay/com1: File exists

    anyhow...i've managed to run it with parallels.  thx
  • wjcroftwjcroft Mount Shasta, CA
    "ln -s /dev/tty.usbserial-xxxx /Users/Ray/Applications/CrossOver/BrainBay/com1"

    The command which creates a symbolic link will not overwrite the previous link you created. You must remove the first link before creating a new link. This is a safety feature to avoid links on top of links.
  • I was working on open bci .Offlate i was working with brainbay.
    I was able to live steam into brainbay and do some processing and wven control music volume with it.
    Now Is it possible to interface brain bay with arduino??
    I would like to have a system something like ,i detect a alphs peak and then accordingly blink an led on arduino.
    I do realise there is a serial com port in brain bay ,but still not clear of how to use it and to link it to arduino.
    Can anyone please help....
  • wjcroftwjcroft Mount Shasta, CA
    bci_v, hello.

    BrainBay currently does not have an element block that can send an arbitrary string to a COM port. The COM port block you see in the documentation is for outputting commands to the old OpenEEG interface.

    Are you wanting to do some text (source code) programming language work, or do you want to use the BrainBay / OpenViBE / PureData / VVVV style of visual programming language (VPL)? A number of projects have utilized the 'Processing' language built OPENBCI_GUI source code as a base. See some of Chip's EEGHacker blog posts. Python is another good choice.

    If you want to stay with VPLs, here is the list of element 'box'es in OpenViBE,

    http://openvibe.inria.fr/documentation/unstable/Doc_BoxAlgorithms.html

    The Run Command box there would allow you to do arbitrary COM port operations. And if you had a 2nd Arduino listening on that COM port, your commands to it could initiate various operations. VVVV and PureData also allow command execution; these would read the EEG data over a OSC link. And the OSC Python plugin would feed the OSC stream.



  • bryanbeusbryanbeus Spanish Fork, UT
    edited May 2015
    I can get the OpenBCI GUI working just fine, so I know that my board etc. are working properly. I added the necessary files etc. so that it would read fine on a Mac. And it shows EEG data streaming when I tell it to. So no problems there.

    I'm trying to learn BrainBay, now, but can't seem to add the OpenBCI source properly. I'm operating on a Mac using Wine.

    BrainBay opens perfectly fine, with one exception saying that it can't find the Windows MIDI or whatever. I'm assuming that's referring to a music input/output something or other, which I'm not using any time soon. So that's okay.

    Anyway, I go to Insert Element>Source>Biosignal/EEG Amplifier>OpenBCI (8 Channel). A window pops up with the first two boxes that I need to fill in asking

    Com Port [dialogue box]
    Baud rate [dialogue box - default is set to 115200]

    Then you click the button that says Connect/Disconnect. I've cycled through a dozen com ports before clicking and always get the reply, "The Port COM[X] is not available. Please choose another Com-Port." Alas, I'm such a newb. I don't know what a Com Port is, even. What's the prob? Thanks for the help in advance.
  • wjcroftwjcroft Mount Shasta, CA
    @bryanbeus , hi. I merged your post into this existing thread.

    See the previous post above by @nightscape , on Jan 2. You need to setup the symbolic link to the 'simulated' COM port. Windows uses COM1 through COMn ports for serial IO. Linux and Mac use /dev/.

    William

  • bryanbeusbryanbeus Spanish Fork, UT
    edited May 2015
    Hi @wjcroft

    Yes, actually...I did that earlier out of blind obedience, not knowing what I was doing, and it still wasn't working. I'm getting more familiar now with what we're doing and I think I made one step forward. However, it doesn't appear to be enough. There is a problem with the post by @nightscape

    I'm not sure how wine operates on most people's systems or how it installs. The dev files are found in the root directory, but wine installed itself in my actual user folder "beus". So, in order to properly get the com port lined up with the mac dev I had to go into my .wine/dosdevices folder, delete the old file com1, and then go back to my root directory and execute the following command in the Mac Terminal.

    ln -s /dev/tty.usbserial-DN0094OA ~users/beus/.wine/dosdevices/com1

    Well, apparently that did something...as the following shows that there was some kind of change in behavior. I then ran BrainBay again with wine and did:

    Insert Element>Source>Biosignal/EEG Amplifier>OpenBCI (8 Channel)

    I set the port to com1. Instead of giving me that "com port 1 is unavailable" response, BrainBay froze altogether. The Connect/Disconnect window stays open but untouchable, and the main BrainBay window is also untouchable. Improvement! Ha.

    What do you think is up? Why's BrainBay freezing now, instead of simply getting started?
  • wjcroftwjcroft Mount Shasta, CA
    Bryan, do you have the latest FTDI drivers installed? Have you tried rebooting? Best practice with the hardware is to plug in your dongle first, then power up board a couple seconds later. Does the board still work with OpenBCI_GUI, but fail with Brainbay? I havent used this Wine / Mac approach personally. It's possible you have some glitch in your Wine setup, file/folder permissions, etc. You might try sending a Private Message (click on user name), to one of the other Wine users on this thread, asking for their advise. You may also consider running Wine under Linux, as some others on the thread have done.

    Other ways to emulate Windows on Mac are Crossover, the Parallels package, or VirtualBox, with the free Windows images at Microsoft.
  • bryanbeusbryanbeus Spanish Fork, UT
    edited May 2015
    @wjcroft

    Thanks for the quick response. Something in here got BrainBay up and running properly. Here's the details.

    "Bryan, do you have the latest FTDI drivers installed?"
    I'm not sure which one I had before, but I went to their site, reinstalled the latest one, and then rebooted the computer, just to be safe.

    "Have you tried rebooting?"
    During the course of this, yes. Alas, I did not try to run BrainBay in between the first reboot and the reboot after reinstalling the FTDI driver, so we won't know if it was the driver or a need to reboot that was the problem.

    "Best practice with the hardware is to plug in your dongle first, then power up board a couple seconds later."
    Check. I have remembered to do that throughout.

    "Does the board still work with OpenBCI_GUI, but fail with Brainbay?"
    Yes, OpenBCI_GUI was working at the time of the BrainBay-induced crash, and yes both are now working.

    Terminal gave me the following during BrainBay successful run. This is from the initialization to the running 

    $ wine brainBay.exe
    fixme:heap:HeapSetInformation 0x0 1 0x0 0
    fixme:win:EnumDisplayDevicesW ((null),0,0x32f418,0x00000000), stub!
    fixme:d3d:context_check_fbo_status FBO status GL_FRAMEBUFFER_UNDEFINED (0x8219)
    err:d3d:context_check_fbo_status FBO 0 is incomplete, driver bug?
    err:d3d:device_clear_render_targets >>>>>>>>>>>>>>>>> GL_INVALID_FRAMEBUFFER_OPERATION (0x506) from glClear @ device.c / 672
    fixme:d3d:context_check_fbo_status FBO status GL_FRAMEBUFFER_UNDEFINED (0x8219)
    err:d3d:context_check_fbo_status FBO 0 is incomplete, driver bug?
    err:d3d:device_clear_render_targets >>>>>>>>>>>>>>>>> GL_INVALID_FRAMEBUFFER_OPERATION (0x506) from glClear @ device.c / 672
    fixme:win:EnumDisplayDevicesW ((null),0,0x32f478,0x00000000), stub!
    fixme:comm:set_queue_size insize 1024 outsize 1024 unimplemented stub"

    It's above my knowledge to understand what all of that means, and what problems may lie in the future as I go forward with BrainBay. But from here it looks like I can now add the BrainBay documentation to my list of resources. Thanks. If I can, I am going to write a post specifically for Mac OpenBCI/BrainBay would-be users.
  • bryanbeusbryanbeus Spanish Fork, UT
    Coming back to this, almost a year later and now working on a PC:

    The brainbay tutorials seem to work well with my 8-bit Arduino board. I got the neuro feedback audio to play, even, though I seem to be having some connectivity problems that I've experienced elsewhere, and I think I can solve on my own.

    There is a problem with the 32-bit ChipKit board, though. I cannot get BrainBay to communicate with it, even if I switch the EEG source box to OpenBCI 16 Channel and recreate all the design boxes myself.
    Searched around here online and have not found anyone posting with similar problems. Any idea why this might be?
  • wjcroftwjcroft Mount Shasta, CA
    The OpenBCI 16 channel element block in BrainBay has a bug in it currently. It's not adjusting the sample rate down from 250 sps (8 channel) to 125 sps (16 channels.) The 32-bit board works fine in 8 channel mode. This is an easy fix in the source code; just need to patch that and do another release.

  • wjcroftwjcroft Mount Shasta, CA
    Both my 8 channel boards here, 8-bit and 32-bit, work with BrainBay. If you are having electrode problems, try connecting everything with paste. I thought you said on the other thread that you mailed your 16 channel system to Joel and everything checked out? Perhaps just experiment with your 8-bit system until you are satisfied everything is solid and you know the effects of your different electrode setups. You need to have at least 1 channel, the SRB2 and Bias all connected solidly before a noise-free setup is possible. If any of those wires, connectors, or cup electrode crimps are intermittent, you will be frustrated. Try swapping with known good components that are working on your 8-bit card. Or just forget the 32-bit board until you have more experience with the 8-bit. It was not that long ago that your other thread was encountering many problems. Get a solid working configuration then expand from there.

  • wjcroftwjcroft Mount Shasta, CA
    edited August 2017
    Great news! Chris Veigl just released BrainBay v 2.0 with Ganglion support!


    Chris appended this comment in an email exchange with him this morning:

    For Ganglion the Brainbay integration needs the GanglionHub bridge for interfacing with the Ganglion. To achieve this, the path to GanglionHub.exe must be specified in the Brainbay application settings. The recommended way is to install the OpenBCI GUI for first operation of the Ganglion, and then providing the path to Ganglionhub.exe (which is located in the /data subfolder of the OpenBCI GUI). Please note that there is a 32 bit and a 64 bit version of the GanglionHub and the 32bit version is not part of every official release of the 32 bit OpenBCI GUI.

    ----

    Brainbay v2.0

    @ChrisVeigl ChrisVeigl released this 19 minutes ago

    • Support for OpenBCI Ganglion
    • Support for Neurosky devices
    • Cursorkey integration for Oscilloscope and Threshold Windows
    • KeyCapture element allows logging of key events
    • Oscilloscope can save snapshots for training reports
    • SessionManager and Sessiontime elements for menu-based selection of designs
    • Keystrike element for key logging and interaction
  • wjcroftwjcroft Mount Shasta, CA
    edited April 2019
    Chris Veigl just released BrainBay v 2.3 with support for the latest OpenBCI Hub and both dongles: BLED112 and CSR


    Article on our Community page,


    Thanks again Chris for your exemplary support of the OpenBCI community!
  • AlexBAlexB Russia
    edited April 2019
    Dear wjcroft!

    Thanks for great news!

    Only one moment for clarification, please: according to Chris’ comments about usage of OpenBCI Hub for communication with Ganglion, in this new release BrainBay still uses middleware OpenBCI Hub interface to communicate with board, not directly by hardware (dongle) drivers. But it did exactly the same already in previous versions of BrainBay, at least since v2.0.

    So, what’s the new feature of this new release?

    What would be great, if BrainBay include WiFi option for communication with OpenBCI boards. I believe it could be implemented quite easily by using the same middleware, OpenBCI Hub.


    Best regards,

    Alexei
  • wjcroftwjcroft Mount Shasta, CA
    Alex, hi.

    The format command / response strings sent between a client (such as GUI or BrainBay) and Hub changed last fall. New format uses JSON. So from that point on the previous version of BrainBay (2.0 through 2.2) would not be able to communicate with current Hub versions. BrainBay 2.3 solves that and also has the ability to talk to either BLED112 or CSR dongles. Prior to 2.3, it was only the CSR. CSR has now been deprecated, and the Shop only sells the BLED112. The new dongle works with fewer glitches than the old scheme using Zadig.

    You are correct, the Hub commands would allow operation with the wifi shield as well. And... we're very grateful Chris has made available these 2.3 mods. He's a busy guy and has multiple projects going on. Please feel welcome to dive into the Github, to experiment with Wifi support.

    William

  • AlexBAlexB Russia
    Dear William,

    Thanks for prompt details explanation! Now all is clear for me!

    Yes, I’m very interested in WiFi support of BrainBay and plan to play a bit with BrainBay source, kindly provided by Chris. Hopefully within this month I can be able to report here about results.

    Thanks again,

    Alex
  • wjcroftwjcroft Mount Shasta, CA
    edited May 2019
    Chris Veigl just released BrainBay v 2.4 with new features listed at the end of this post.


    Article on our Community page,


    Thanks again Chris for your exemplary support of the OpenBCI community!

    ----

    * New elements Shadow and Volume allow control of volume and desktop transparency
    * New element OSC-Sender for transfer of live values to other applications via Open Sound Control / UDP
    * Logical elements And, Or and Not got extended modes, increasing flexibility
    * Threshold element improved, increasing flexibility
    * user manual updated!


    i included several changes which were eleborated togheter with elliot recently - e.g. new modes for the logical elements and the threshold element. (demo models available in the folder /Configuration/OtherDemos)
  • wjcroftwjcroft Mount Shasta, CA

    Chris Veigl just released BrainBay v 2.5 with new features listed at the end of this post.
    https://github.com/ChrisVeigl/BrainBay/releases/

    Article on our Community page,
    https://openbci.com/community/brainbay-dsp-environment-update-for-ganglion-cyton/

    Thanks again Chris for your ongoing support of the OpenBCI community!

    --

    • Improved Threshold element and handling of logical conditions
    • Improved documentation
    • Improved interface and handling for Neurobit devices
Sign In or Register to comment.