Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Go driver for NeuroSky devices.
Tree: f696cf9880

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

NeuroSky/ThinkGear Go Driver

Parser for the NeuroSky ThinkGear protocol used by NeuroSky devices.

Copyright (c) 2012. Jake Brukhman. ( All rights reserved. See the LICENSE file for BSD-style license.


You need at least the following weekly version of Go:

go version weekly.2012-02-07 +52ba9506bd99

You can then use the 'go' command to obtain the package:

$ go get

To install the package and all of the executables, use:

$ go install -v
$ ls $GOPATH/bin


See the gopkgdocs.


NeuroSky devices stream several kinds of data. First, the device delivers "raw signal" at approximately 512 Hz and processed "black box" data at 1 Hz. Using goneuro, you can connect to both kinds of data from the device.

The first step is pairing your device with your Bluetooth interface and giving it a serial port. On the Mac, you can do this without any extra hardware, as a port is built-in. Using the Bluetooth preferences, you can set the serial port manually. It will usually look something like this:


First, you must obtain a Device and connect to it.

d := goneuro.NewDevice("/dev/tty.JakeMindBand")

There are two ways of streaming data with goneuro. If you wish to pick and choose your black box data, you will need a ThinkGearListener as follows:

listener := &goneuro.ThinkGearListener{
   Meditation: func(b byte) {
        // do something
   Attention: func(b byte) {
        // do something else

You can then connect to the device and check for connection errors:

if err := d.Connect(listener); err != nil {
    fmt.Println("could not connect: ", err)

Alternatively, you may be interesting in only a raw data signal coming from the device. In that case, you should create a channel for receiving the raw data.

data := make(chan float64, 512)

Note that the channel is asynchronous, or else you may hold up processing. All parsing of the data stream is done serially to calling back listeners and placing the raw signal on the channel.

Here is the way to connect to raw data:

if err := d.ConnectRaw(data); err != nil {
    fmt.Println("could not connect: ", err)

Raw signal will be delivered to the given channel when processing starts.

This brings us to the last and final point: in order for goneuro to actually start processing the data and delivering it to listeners and raw signal channels, you must call


If you wish to disconnect from the device gracefully without turning off your program, you can call:

Something went wrong with that request. Please try again.