DEV Community

Cover image for Develop apps with biosensors and neurointerfaces
Andrey Parfenov
Andrey Parfenov

Posted on

Develop apps with biosensors and neurointerfaces

Useful links:

A few examples built with BrainFlow:

BrainFlow provides a uniform SDK to work with biosensors with a primary focus on neurointerfaces. It provides SDK for Python, Java, C#, C++, Matlab, R, Julia and Rust.
Core part of BrainFlow is written in C\C++ and all bindings call methods from dynamic library. User API is uniform for all supported devices and allows you to develop device agnostic applications.

Let's take a look at one of examples from BrainFlow docs.

Install BrainFlow for Python:

python -m pip install -U brainflow
Enter fullscreen mode Exit fullscreen mode

Basic example which records data for 15 seconds:

import time
import numpy as np

import brainflow
from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds


def main():
    BoardShim.enable_dev_board_logger()

    # BrainFlowInputParams and board id provided to BoardShim constructor are the only device specific arguments
    params = BrainFlowInputParams()
    # synthetic board is one of many features which speedup development
    board = BoardShim(BoardIds.SYNTHETIC_BOARD, params)
    board.prepare_session()
    board.start_stream(45000, 'file://data.csv:w')
    time.sleep(15)
    # data is a standard 2d numpy array
    data = board.get_board_data()
    board.stop_stream()
    board.release_session()

    print(data)



if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

For examples with signal processing algorithms and more advanced samples please refer to github repo

Top comments (0)