Skip to main content

Library for connect with Neurosky's Mindwave EEG headset via TCP Socket

Project description

PyNeuro is designed to connect NeuroSky’s MindWave EEG device to Python and provide Callback functionality to provide data to your application in real time. The library is tested with Mindwave Mobie2 Headset, and runs stably.

Installation

Run the following command: pip install PyNeuro

Usage

  1. Before you start, make sure you have downloaded Nuerosky Mindware Developer Tools and turned on Thinkgear Connecter. Please keep Thinkgear Connecter on while the program is running.

  2. Importing the module: from PyNeuro.PyNeuro import PyNeuro

  3. Initializing: pn = PyNeuro()

  4. After initializing, if required the callbacks can be set

  5. Then call pn.connect() method, it will connect with TCP Socket server.

  6. Then call pn.start() method, it will be start fetching data.

  7. To stop call pn.close()

Obtaining Data from Device

  • Obtaining value: attention = pn.attention #to get value of attention_ >Other Variable attention, meditation, blinkStrength, delta, theta, lowAlpha, highAlpha, lowBeta, highBeta, lowGamma, highGamma.

  • Setting callback: A call back can be associated with all the above variables so that a function is called when the variable is updated. Syntax:

    pn.set_attention_callback(callback_function1)
    pn.set_meditation_callback(callback_function2)
    pn.set_blinkStrength_callback(callback_function3)
    ....
    
    You can add any number of callback functions to a variable..

Access via callback

from PyNeuro.PyNeuro import PyNeuro
from time import sleep

pn = PyNeuro()

def attention_callback(attention_value):
    """this function will be called everytime NeuroPy has a new value for attention"""
    print ("Value of attention is: ", attention_value)
    return None

pn.set_attention_callback("attention", attention_callback)
pn.connect()
pn.start()

Access via object

from PyNeuro.PyNeuro import PyNeuro
from time import sleep

pn = PyNeuro()
pn.start()

while True:
    if pn.meditation > 70: # Access data through object
        pn.close()
    sleep(0.2)

Python Compatibility

Reference

lihas/NeuroPy - A library based on native Bluetooth serial connection

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

PyNeuro-1.3.1.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

PyNeuro-1.3.1-py3-none-any.whl (5.4 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