All Projects → pwittchen → neurosky-android-sdk

pwittchen / neurosky-android-sdk

Licence: Apache-2.0 license
Android SDK for the NeuroSky MindWave Mobile Brainwave Sensing Headset

Programming Languages

java
68154 projects - #9 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to neurosky-android-sdk

EEGReader
EEG Reader is an Android mobile application, which reads EEG signal from NeuroSky mobile device connected to smartphone via Bluetooth.
Stars: ✭ 36 (-7.69%)
Mutual labels:  eeg, neurosky, bci, mindwave
Kotlinrxmvparchitecture
Clean MVP Architecture with RxJava + Dagger2 + Retrofit2 + Mockito + Fresco + EasiestGenericRecyclerAdapter using Kotlin. Includes Unit Tests(Kotlin Tests)!
Stars: ✭ 94 (+141.03%)
Mutual labels:  rxjava, rxandroid, rxkotlin
Rxbiometric
☝️ RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android
Stars: ✭ 295 (+656.41%)
Mutual labels:  rxjava, rxandroid, rxkotlin
ganglion-ble
Web Bluetooth client for the Ganglion brain-computer interface by OpenBCI
Stars: ✭ 27 (-30.77%)
Mutual labels:  eeg, bci
Reactivenetwork
Android library listening network connection state and Internet connectivity with RxJava Observables
Stars: ✭ 2,484 (+6269.23%)
Mutual labels:  rxjava, rxandroid
Marvel
Marvel Characters Android Application Assigned by smava GmbH
Stars: ✭ 227 (+482.05%)
Mutual labels:  rxjava, rxandroid
Reactivewifi
Android library listening available WiFi Access Points and related information with RxJava Observables
Stars: ✭ 186 (+376.92%)
Mutual labels:  rxjava, rxandroid
pyRiemann
Python machine learning package based on sklearn API for multivariate data processing and statistical analysis of symmetric positive definite matrices via Riemannian geometry
Stars: ✭ 470 (+1105.13%)
Mutual labels:  eeg, brain-computer-interface
pybv
A lightweight I/O utility for the BrainVision data format, written in Python.
Stars: ✭ 18 (-53.85%)
Mutual labels:  eeg, brain
connectomemapper3
Connectome Mapper 3 is a BIDS App that implements full anatomical, diffusion, resting/state functional MRI, and recently EEG processing pipelines, from raw T1 / DWI / BOLD , and preprocessed EEG data to multi-resolution brain parcellation with corresponding connection matrices.
Stars: ✭ 45 (+15.38%)
Mutual labels:  eeg, brain
Deep-Learning-for-BCI
Resources for Book: Deep Learning for EEG-based Brain-Computer Interface: Representations, Algorithms and Applications
Stars: ✭ 63 (+61.54%)
Mutual labels:  eeg, bci
hnn
The Human Neocortical Neurosolver (HNN) is a software tool that gives researchers/clinicians the ability to develop/test hypotheses on circuit mechanisms underlying EEG/MEG data.
Stars: ✭ 62 (+58.97%)
Mutual labels:  eeg, brain
EEGwithRaspberryPI
Open-Source board for converting RaspberryPI to Brain-computer interface
Stars: ✭ 402 (+930.77%)
Mutual labels:  eeg, bci
Android Disposebag
Automatically dispose RxJava 2 streams on Android using Lifecycle events.
Stars: ✭ 200 (+412.82%)
Mutual labels:  rxjava, rxkotlin
Prefser
Wrapper for Android SharedPreferences with object serialization and RxJava Observables
Stars: ✭ 228 (+484.62%)
Mutual labels:  rxjava, rxandroid
Mvpdemo
Stars: ✭ 193 (+394.87%)
Mutual labels:  rxjava, rxandroid
EEG-Motor-Imagery-Classification-CNNs-TensorFlow
EEG Motor Imagery Tasks Classification (by Channels) via Convolutional Neural Networks (CNNs) based on TensorFlow
Stars: ✭ 125 (+220.51%)
Mutual labels:  eeg, brain-computer-interface
brain-monitor
A terminal app written in Node.js to monitor brain signals in real-time
Stars: ✭ 119 (+205.13%)
Mutual labels:  eeg, brain
Materialistic
A material-design Hacker News Android reader
Stars: ✭ 2,163 (+5446.15%)
Mutual labels:  rxjava, rxandroid
Androidbasemvp
🚀一个快速搭建MVP+RxJava2+Retrofit 基础框架,主要是封装有Http网络请求、日志、缓存、加载等待、toast、页面状态布局管理、权限、RxBus、Glide图片加载等组件,方便快速开发新项目、减少开发成本。
Stars: ✭ 184 (+371.79%)
Mutual labels:  rxjava, rxandroid

NeuroSky Android SDK

Android SDK for the NeuroSky MindWave Mobile Brainwave Sensing Headset

Build Status codecov Maven Central

This SDK allows you to write mobile Android apps interacting with the brain via NeuroSky MindWave Mobile device connected to the phone or tablet via Bluetooth. You can write apps controlled by your brain or perform data acquisition and analysis of the brain signals (attention, meditation, brain waves, raw signal) and eye blinks. NeuroSky uses EEG technology for gathering brain data and EMG sensor for detecting blinks. NeuroSky Android SDK uses ThinkGear library under the hood, which was developed by the NeuroSky company.

Please note: this SDK is not a product of NeuroSky company, but it depends on its software and hardware

Contents

Usage

Java

Listener

// initialize NeuroSky object with listener
NeuroSky neuroSky = new NeuroSky(new ExtendedDeviceMessageListener() {
  @Override public void onStateChange(State state) {
    // handle state change...
  }

  @Override public void onSignalChange(Signal signal) {
    // handle signal change...
  }

  @Override public void onBrainWavesChange(Set<BrainWave> brainWaves) {
    // handle brain waves change...
  }
});

// connect to the device
try {
  neuroSky.connect();
} catch (BluetoothNotEnabledException e) {
  // handle exception...
}

// disconnect from the device
neuroSky.disconnect();

// start monitoring
neuroSky.start();

// stop monitoring
neuroSky.stop();

You can also create simpler listener with DeviceMessageListener interface and handle android.os.Message objects.

NeuroSky neuroSky = new NeuroSky(message -> {
  // handle message...
});

Nevertheless, in that case, you'll have to process and handle data manually.

RxJava

// initialize object
RxNeuroSky neuroSky = new RxNeuroSky();

// stream data
neuroSky
  .stream()
  .subscribeOn(Schedulers.computation())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(brainEvent -> {
    // handle state in brainEvent.state();
    // handle signal in brainEvent.signal();
    // handle brainwaves in brainEvent.brainWaves();
  });

// connect to the device
neuroSky
  .connect()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
      () -> /* is connecting... */,
      throwable -> { /* handle error...*/ }
  );

// start monitoring
neuroSky
  .start()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
    () -> /* started monitoring */,
    throwable -> { /* handle error...*/ }
   );

// stop monitoring
neuroSky
  .stop()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
    () -> /* stopped monitoring */,
    throwable -> { /* handle error...*/ }
   );

// disconnect from the device
neuroSky
  .disconnect()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
    () -> /* is disconnected */,
    throwable -> { /* handle error...*/ }
  );

Default backpressure strategy is BUFFER. In order to customize backpressure strategy, you can use the following method:

Flowable<BrainEvent> stream(backpressureStrategy)

Kotlin

Listener

// initialize NeuroSky object with listener
val neuroSky = NeuroSky(object : ExtendedDeviceMessageListener() {
  override fun onStateChange(state: State) {
    handleStateChange(state)
  }

  override fun onSignalChange(signal: Signal) {
    handleSignalChange(signal)
  }

  override fun onBrainWavesChange(brainWaves: Set<BrainWave>) {
    handleBrainWavesChange(brainWaves)
  }
})

// connect to the device
try {
  neuroSky.connect()
} catch (e: BluetoothNotEnabledException) {
  // handle exception...
}

// disconnect from the device
neuroSky.disconnect()

// start monitoring
neuroSky.start()

// stop monitoring
neuroSky.stop()

You can also create simpler listener with DeviceMessageListener interface and handle android.os.Message objects.

val neuroSky = NeuroSky(DeviceMessageListener {
  // handle message here...
})

Nevertheless, in that case, you'll have to process and handle data manually.

RxKotlin

//initialize object
val neuroSky = RxNeuroSky()

// stream data
neuroSky
  .stream()
  .subscribeOn(Schedulers.computation())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe {
    // handle state in it.state();
    // handle signal in it.signal();
    // handle brainwaves in it.brainWaves();
  }

// connect to the device
neuroSky
  .connect()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
      { /* is connecting... */ },
      { throwable -> /* handle error */ }
  )

// start monitoring
neuroSky
  .start()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
      { /* started monitoring */ },
      { throwable -> /* handle error */ }
  )

// stop monitoring
neuroSky
  .stop()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
      { /* stopped monitoring */ },
      { throwable -> /* handle error */ }
  )

// disconnect from the device
neuroSky
  .disconnect()
  .subscribeOn(Schedulers.io())
  .observeOn(AndroidSchedulers.mainThread())
  .subscribe(
      { /* is disconnected */ },
      { throwable -> /* handle error */ }
  )

Default backpressure strategy is BUFFER. In order to customize backpressure strategy, you can use the following method:

Flowable<BrainEvent> stream(backpressureStrategy)

Examples

You can find examples of library usage in the following directories:

  • app-java (example with listener)
  • app-kotlin (example with listener)
  • app-rxjava
  • app-rxkotlin

Download

You can depend on the library through Gradle:

dependencies {
  implementation 'com.github.pwittchen:neurosky-android-sdk:0.0.2'
}

Please note: this library is released as a fat aar and contains all its dependencies within a single *.aar file. It's done this way because this library depends on ThinkGear library, which is distributed as a ThinkGear.jar file by the NeuroSky company. ThinkGear is also not available on the Maven Central repository. I wanted to make usage of this library as simple as possible without bothering about additional dependencies and custom configuration. Now, with this approach we can add a single dependency to our project and we're good to go.

Tests

Tests are available in library/src/test/java/ directory and can be executed on JVM without any emulator or Android device from Android Studio or CLI with the following command:

./gradlew test

To generate test coverage report, run the following command:

./gradlew test jacocoTestReport

Code style

Code style used in the project is called SquareAndroid from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.

Static code analysis

Static code analysis runs Checkstyle, PMD and Lint. It can be executed with command:

./gradlew check

JavaDoc

JavaDoc is available at: http://pwittchen.github.io/neurosky-android-sdk/javadoc

Documentation

Documentation is available at: http://pwittchen.github.io/neurosky-android-sdk/docs

Changelog

See CHANGELOG.md file.

Releasing

See RELEASING.md file.

Verified devices

This SDK was tested with the following devices:

  • NeuroSky MindWave Mobile 1
  • NeuroSky MindWave Mobile 2

Device diagram

This is diagram of the NeuroSky MindWave Mobile 1

References

License

Copyright 2018 Piotr Wittchen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].