Welcome to the EmBCI!

English | 中文

EmBCI is fully open source on Github since release v.0.2.3!

This README file is only a quick start. Check out full documentation here.

EmBCI is still under developing. Any contributions are welcomed.

What is EmBCI?

EmBCI is the abbreviation of Embedded Brain-Computer Interface, a bio-signal acquisition and processing platform.

It is composed of a high precision, wearable, 8-channel bio-signal measuring hardware and a signal processing python library optimized for embedded devices.

Users can quickly develop their own applications based on EmBCI. And EmBCI comes with some interesting apps, check out here!

Features

  • Fast prototyping: EmBCI provide lots of data streaming and IO interfaces. Build your app within 100 lines of code!

  • Signal processing: baseline-correction, denoising, time-frequency algorithms, and many many more.

  • Multiple Biosignal: support EEG, EMG, ECG… We implemented gesture-recognition based on sEMG and SSVEP Speller based on EEG in the same platform.

  • It’s embedded: 40mm x 40mm wearable device, small but powerful, get rid of PC!

  • WiFi connection: data visualization, files management, visual stimulus keyboard and more Web UI applications are accessable by simply connect to a hotspots.

Hardware support

EmBCI Shield is an EmBCI official release of PCB board designed to measure, denoise, buffer and transfer bio-signals. Currently, the stable version is EmBCI Shield Rev.B1. It can also be used as an extension shield for OrangePi/RaspberryPi and other 40-Pin compatiable develop boards.

It integrates:

  • ADS1299 from Texas Instruments:

    Low-noise 8-Channels 24-Bits ADC for Biopotential Measurements

  • ESP32 from Espressif:

    Tensilica Xtensa Dual-core 32-Bits Processor with WiFi and Bluetooth

  • Power management chips and others

See files/hardware for more detail.

Requirements

  • On embedded linux: WiFi, Serial, SysGPIO, SpiDev

  • On PC/server: WiFi[, Serial, USB]

Installation

Install from PyPI

NOT available yet

pip install embci

Install from source

git clone https://github.com/hankso/EmBCI.git && cd EmBCI
sudo python -m pip install -r ./requirements.txt
python setup.py build && sudo python setup.py install

Install in developer mode

For those who want to build their applications based on EmBCI, you may want to install embci in developer mode:

git clone https://github.com/hankso/EmBCI.git && cd EmBCI
sudo python -m pip install --editable .

Then you just code and test.

EmBCI provides lots of useful input/output interfaces including an extendible WebUI so that one can easily implement applications. See embci.io, embci.webui and embci.apps for more information.

Platform specifics

On arm and aarch64 embedded Linux platforms, setup.py will also install Linux service configuration files.

To autostart EmBCI applications at boot on PC and other systems, you have to config autorun manually.

Extra dependencies

TODO: only install the package is not enough

Linux service interface

EmBCI has a Linux Service interface to work properly on embedded devices.

Both System-V style scripts and System D service manager scripts are provided.

See files/service for more details.

Configuration

EmBCI use INI-Style configuration files with an extention .conf.

Here’s an example:

# File: EmBCI/files/service/embci.conf
# Lines beginning with '#' or ';' are ignored and will be used as comments.

[Path]
DIR_BASE = /usr/share/embci

[Platform]
HARDWARE = Rev.A7
BOARD = Orange Pi Zero Plus 2

[GPIO]
PIN_ESP32_DRDY = PD11
PIN_ILI9341_DC = PA02

[Network]
WEBUI_HOST = 0.0.0.0
WEBUI_PORT = 8080

When you type import embci, it will automatically search for configuration files and load them into embci.configs with following priority(from low to high):

project config file: "${EmBCI}/files/service/embci.conf"
 system config file: "/etc/embci/embci.conf"
   user config file: "~/.embci/embci.conf"

On Windows system:

project config file: "${EmBCI}/files/service/embci.conf"
 system config file: "${APPDATA}/embci.conf"
   user config file: "${USERPROFILE}/.embci/embci.conf"

See Documentation->Configurations for more details.

Documentation

EmBCI documentation is hosted by GitHub Pages built with sphinx. We highly welcome contributions to the docs, such as python API reference (in progress), code examples, applications and screenshots gallery etc. To build documentation locally, you need to clone the repo first:

git clone https://github.com/hankso/EmBCI.git && cd EmBCI/docs
sudo python -m pip install requirements.txt  # modules used to build docs

Make your modification or add some content under folder EmBCI/docs. Then build markdown/reStructuredText/… files into html format and view by browser:

make html && google-chrome _build/html/index.html

Update the newest docs to GitHub Pages:

git checkout master
cd /path/to/EmBCI && make -C docs html
git checkout gh-pages
cp -av docs/_build/html/ ./
git add . && git commit -m 'build doc for version X.X.X' && git push

Files outline

Folder

Description

embci

Data-processing algorithms, IO, WebUI and frameworks

embci.apps

Basic applications and an example app project

embci.gyms

Output classification result to gyms to control games

embci.io

Stream Readers/Commanders, data save/load functions

embci.utils

Miscellaneous tools: useful decorators and functions

embci.viz

Visualization: SPIScreen, Matplotlib, and Qt

embci.webui

Web-based User Interface

files/avr

On shield Atmega328P firmware (Deprecated)

files/esp32

On shield ESP32 firmware and burning tools

files/cases

3D models files in SolidWorks and STL format

files/hardware

EmBCI Shield files in Eagle format

files/service

Linux service configurations

Supported gyms

Currently two environments have been implemented to use mind-control results to control movement. See embci.gyms for more.

Plane war game

Written by @ buaawyz. See game installation guide.

Run python main.py first and then from gyms import PlaneClient as Client

TORCS car game

See more at gym_torcs. And embci.io.TorcsCommander.

License

MIT license. See LICENSE.txt