Skip to main content

Python module to stream BITalino data though the Lab Streaming Layer (LSL)

Project description

BITalino-lsl

A python module called bitalino_lsl to stream BITalino data though the Lab Streaming Layer (LSL). This module gets data from the BITalino device through the bitalino python api and uses the Lab Stream Layer to stream the data.

The module should work with python versions >= 2.7 although it has only been tested for:

  • Python 2.7.15
  • Python 3.6.5

Getting started

Installation

pip install bitalino_lsl

Example

import bitalino_lsl
from pylsl import StreamInlet, resolve_stream
import time

# MAC address of the BITalino device
MAC_ADDRESS_BITALINO_DEVICE = "20:17:11:1A:2B:3C"

# List with channels of the BITalino device to be streamed to the LSL
# This channels can be specified as a list or as a dictionary with their
# position in the 10-20 system. BITalino uses bipolar electrodes so the
# position will be defined by two points
# CHANNELS = {0: 'Fp1-Fp2', 1: 'P3-T5'}
CHANNELS = [0,1]

# Connect with the BITalino device
device = bitalino_lsl.BitalinoLSL(MAC_ADDRESS_BITALINO_DEVICE)

# Create the Stream with the channels information
device.create_lsl_EEG(CHANNELS)

# Start the stream getting data from the BITalino device
device.start()

# Get the Stream to read the data from
inlet = StreamInlet(resolve_stream('type', 'EEG')[0])

# Read the BITalino data for 5 seconds
t_end = time.time() + 5
while time.time() < t_end:
  sample, timestamp = inlet.pull_sample()
  print(sample)

# Stop the device
device.stop()

# Close the connection with the BITalino device
device.close()

Documentation

Documentation is available here

License

This project is licensed under the GNU GPL v3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitalino_lsl-0.0.3.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

bitalino_lsl-0.0.3-py3-none-any.whl (20.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page