Jump to content

Contributions:BrainFlow: Difference between revisions

From BCI2000 Wiki
Rlellis (talk | contribs)
Mellinger (talk | contribs)
 
(27 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[File:Brainflowpic.png|300px|thumb|right]]
==Synopsis==
==Synopsis==
This module integrates the data aquistion capabilities from [https://brainflow.readthedocs.io/en/stable/ BrainFlow] into BCI2000, allowing for compatibility with several new boards.
This module integrates the data aquistion capabilities from [https://brainflow.readthedocs.io/en/stable/ BrainFlow] into BCI2000, allowing for compatibility with several new boards, especially boards from the OpenBCI hardware project.


==Location==
http://{{SERVERNAME}}/svn/trunk/src/contrib/SignalSource/BrainFlow
<!--
==BrainFlow Installation/Setup==
==BrainFlow Installation/Setup==
Before installation, please install [https://gitforwindows.org/ git bash] and [https://www.python.org/downloads/ python].
Before installation, please install [https://gitforwindows.org/ git bash] and [https://www.python.org/downloads/ python]. Note that VS2022 is not compatible with this module.
 


'''Please note that after generating the libraries for debug or release, you may ONLY build in that configuration! To switch to the other configuration you must rebuild the libraries, which can quickly be done through the BrainFlowBuild.py script in the SignalSource\BrainFlow folder'''
===Automatic Installation===
===Automatic Installation===
'''Note that instillation will take around 125MB. Also ensure that you are using VS2019.'''


Libraries generated from BrainFlow are needed for this module, which requires the user to download and build the project. The download process (and configuring the solution) can be automated using these scripts:
Libraries generated from BrainFlow are needed for this module, which requires the user to download and build the project. The download/compilation process can be automated using this script located in SignalSource\BrainFlow:
<gallery mode="packed" widths=75px heights=75px>
<gallery mode="packed" widths=75px heights=75px>
File:BFModules.JPG|BrainFlow installation/configuration automation scripts
File:BFLibInstall.JPG|BrainFlow library install script
</gallery>
</gallery>
All that needs to be done to use this scripts is: locate them in {BCI2000 Folder}\src\contrib\SignalSource\BrainFlow, and double click on "BrainFlowInstall.bat". This will clone the [https://github.com/brainflow-dev/brainflow BrainFlow repository]*** into the correct location (which will be one folder outside of BCI2000--if your BCI2000 copy has directory User\BCI2000, then this script will create User\brainflow) as well as run the BrainFlowBuild.py script, which will generate compiled libraries for either debug or release, depending on what you enter upon being prompted (0=debug, 1=release).
All that needs to be done to use this scripts is: locate them in {BCI2000 Folder}\src\contrib\SignalSource\BrainFlow, and double click on "GenerateLibraries.bat". This will clone the [https://github.com/brainflow-dev/brainflow BrainFlow repository] into src\extlib. The script will build libraries for both debug and release configurations, so there will be two folders installed. '''Make sure to press enter when indicated. Do not exit the console until everything has finished installing--just follow the prompts given by the console.''' After each set of libraries are installed, you will be told to add the directories {BCI2000 Folder}\src\extlib\brainflowDebug\installed\lib and {BCI2000 Folder}\src\extlib\brainflow\installed\lib to your systems PATH
 
(please follow [https://www.youtube.com/watch?v=91SGaK7_eeY this] tutorial if you are unsure how to do this).
Afterward, you will need to add the generated libraries to your systems path. ("Compiled/{Release and/or Debug}"). This can be done by searching for "Path" in the windows search bar, which will show "Edit the system environment variables", which upon opening will open up a tab labelled system properties. Open the "Environment" tab and click on "Path" under the "System Variables" window, and press edit. At the bottom of the list, enter the folder ...\brainflow\compiled.
 
C:\Users\Robbie\Documents\BCI2000folder\brainflow\installed\lib
 
In BCI2000's CMake window (build\Configure.sh.cmd), press the blue "Add Entry" arrow in the top right corner. In the dropdown menu for "Type:", select "PATH", then in "Name:" enter: "CMAKE_PREFIX_PATH". For the value, enter the entire file location of ...\brainflow\installed\lib\cmake\brainflow (go to the folder your BCI2000 folder resides in, a folder named "brainflow" will be located there. You can append the the location of this folder with this location so your entire file location looks like C:\Users...\{Folder containing BCI2000 folder}\brainflow\installed\lib\cmake\brainflow). After these three fields are filled out, press "OK". Make sure under "BUILD" that "BUILD_ALL_SOURCEMODULES" is selected, and '''you will also need to deselect "USE_DYNAMIC_CRT" under "USE"'''--if this is selected, BCI2000 will fail to build. In the batch file to be used, append '''start executable BrainFlowADC --local''' to the line corresponding to the source module.
 
 
 
===Manual Installation===
 
First, in the same folder containing your working copy of BCI2000, create a folder named 'brainflow'. For example, if the location of your copy of BCI2000 is C:\Users\Bob\Desktop\BCI2000, your folder will be C:\Users\Bob\Desktop\brainflow. In this new folder, open [https://gitforwindows.org/ git bash], and enter 'git clone https://github.com/OpenBCI/brainflow.git' ([https://github.com/OpenBCI/brainflow/tree/master BrainFlow]). After installation is complete, navigate to the 'tools' folder, and run build.py. This will create the solution needed to generate the libraries for EITHER debug or release.
 
Afterward, you will need to add the generated libraries to your systems path. ("brainflow\compiled\{Release and/or Debug}")
 
If you wish to use debug mode, open build.py and search for 'config' until you find a section that looks like this:
 
    def build(args):
        if platform.system() == 'Windows':
            config = 'Release'
 
 
'config' determines how the solution is built, so adjust this according to which version you plan to use ("Release" or "Debug"), then run it.
 
Afterward, you will need to add the generated libraries to your systems path. ("Compiled/{Release and/or Debug}"). This can be done by searching for "Path" in the windows search bar, which will show "Edit the system environment variables", which upon opening will open up a tab labelled system properties. Open the "Environment" tab and click on "Path" under the "System Variables" window, and press edit. At the bottom of the list, enter the folder ...\brainflow\compiled.
 
In BCI2000's CMake window (build\Configure.sh.cmd), press the blue "Add Entry" arrow in the top right corner. In the dropdown menu for "Type:", select "PATH", then in "Name:" enter: "CMAKE_PREFIX_PATH". For the value, enter the entire file location of brainflow\installed\lib\cmake\brainflow (go to the folder your BCI2000 folder resides in, a folder named "brainflow" will be located there. You can append the the location of this folder with this location so your entire file location looks like C:\Users...\{Folder containing BCI2000 folder}\brainflow\installed\lib\cmake\brainflow). After these three fields are filled out, press "OK". Make sure under "BUILD" that "BUILD_ALL_SOURCEMODULES" is selected, '''and you will also need to deselect "USE_DYNAMIC_CRT" under "USE"'''. In the batch file to be used, append '''start executable BrainFlowADC --local''' to the line corresponding to the source module.


In CMake, make sure under "BUILD" that "BUILD_ALL_SOURCEMODULES" is selected. In the batch file to be used, append '''start executable BrainFlowADC --local''' to the line corresponding to the source module.
-->
==Parameters==
==Parameters==
===BoardID===
===BoardID===
Identifier for the boad in use, compatable with any board able to be used with BrainFlow.
Identifier for the board in use, compatible with any board able to be used with BrainFlow.
BoardIDs are listed the parameter's commentary, and boards are displayed by name in the parameter GUI.


===RecordingChannels===
===RecordingChannels===
Sets which board channels will be used for data aquisition. Some boards will not have all listed channel types, in which case no data will be collected from such types.
Sets which board channels will be used for data acquisition. Some boards will not have all listed channel types, in which case no data will be collected from such types. If channels are found and '''ChannelNames''' is set to auto, listed channels will be given their designated names.
 
 
'''The following information might not be needed for specific boards. Search for your board [https://brainflow.readthedocs.io/en/stable/SupportedBoards.html here] to see which parameters are necessary.''' 


===COM===
===COM===
Specifies the port the device is connected to
Specifies the port the device is connected to (this must be found by the user--the program will not search ports to find which the device is connected to. Open your system's device manager to determine this) if needed. If not needed, leave as auto.


===MAC===
===MAC===
Specifies the MAC address of the device
Specifies the MAC address of the device if needed. If not needed, leave as auto.
 
 


C:/Users/Robbie/Documents/BCI2000folder/brainflow/installed/lib/cmake/brainflow
===IPPort===
Specifies the address of an IP port if needed. If not needed, leave as auto.


===SerialNumber===
Specifies the serial number of the device if needed. If not needed, leave as auto.


==See also==
[[User Reference:Filters]], [[Contributions:ADCs]]


C:/Users/Robbie/Documents/BCI2000folder/brainflow/installed/lib/Brainflow.lib
[[Category:Contributions]][[Category:Data Acquisition]]
C:/Users/Robbie/Documents/BCI2000folder/brainflow/compiled/Debug/BoardController.lib
C:/Users/Robbie/Documents/BCI2000folder/brainflow/compiled/Debug/DataHandler.lib
C:/Users/Robbie/Documents/BCI2000folder/brainflow/compiled/Debug/MLModule.lib
C:\Users\Robbie\Documents\BCI2000folder\brainflow\installed\lib\cmake\brainflow

Latest revision as of 12:31, 17 December 2024

Synopsis

This module integrates the data aquistion capabilities from BrainFlow into BCI2000, allowing for compatibility with several new boards, especially boards from the OpenBCI hardware project.

Location

http://www.bci2000.org/svn/trunk/src/contrib/SignalSource/BrainFlow

Parameters

BoardID

Identifier for the board in use, compatible with any board able to be used with BrainFlow. BoardIDs are listed the parameter's commentary, and boards are displayed by name in the parameter GUI.

RecordingChannels

Sets which board channels will be used for data acquisition. Some boards will not have all listed channel types, in which case no data will be collected from such types. If channels are found and ChannelNames is set to auto, listed channels will be given their designated names.


The following information might not be needed for specific boards. Search for your board here to see which parameters are necessary. 

COM

Specifies the port the device is connected to (this must be found by the user--the program will not search ports to find which the device is connected to. Open your system's device manager to determine this) if needed. If not needed, leave as auto.

MAC

Specifies the MAC address of the device if needed. If not needed, leave as auto.

IPPort

Specifies the address of an IP port if needed. If not needed, leave as auto.

SerialNumber

Specifies the serial number of the device if needed. If not needed, leave as auto.

See also

User Reference:Filters, Contributions:ADCs