BrainBit for developers Subscribe for updates Visit website

BrainBit and BrainBitBlack

 

The BrainBit and BrainBitBlack is a headband with 4 electrodes and 4 data channels - O1, O2, T3, T4. The device has a frequency of 250 Hz, which means that data on each of the channels will come at a frequency of 250 samples per second. You can only change the 'Gain' of the signal. The other parameters cannot be changed and you will get an exception if you try.

You can distinguish BrainBit device from Flex by the firmware version number: if the `SensorVersion.FwMajor` is more than 100 - it's Flex, if it's less than BrainBit.

BrainBitBlack, unlike BrainBit, requires pairing with a PC/mobile device. So, before connecting to the BBB, you must put it into pairing mode. SDK starts the pairing process automatically.

 

Receiving signal

To receive signal data, you need to subscribe to the corresponding callback. The values will be received as a packet from four channels at once, which will avoid desynchronization between them. The values come in volts. In order for the device to start transmitting data, you need to start a signal using the `execute` command.

This method is also recommended to be run in an separate thread.

void onBrainBitSignalDataReceived(Sensor *pSensor, BrainBitSignalData *pData, int32_t size, void *userData)
{

}
OpStatus outStatus;
BrainBitSignalDataListenerHandle lHandle = nullptr;
addSignalDataCallbackBrainBit(_sensor, onBrainBitSignalDataReceived, &lHandle, nullptr, &outStatus);
execCommandSensor(_sensor, SensorCommand::CommandStartSignal, &outStatus);
...
execCommandSensor(_sensor, SensorCommand::CommandStopSignal, &outStatus);
removeSignalDataCallbackBrainBit(lHandle);
            
sensor.brainBitSignalDataReceived = data -> {
    Log.i("TAG", Arrays.toString(data));
};
sensor.ExecCommand(SensorCommand.StartSignal);
...
sensor.brainBitSignalDataReceived = null
sensor.ExecCommand(SensorCommand.StopSignal);
            
sensor.brainBitSignalDataReceived = Sensor.BrainBitSignalDataReceived { data ->
    Log.i("TAG", data.toString())
}
sensor.ExecCommand(SensorCommand.StartSignal)
...
sensor.brainBitSignalDataReceived = null
sensor.ExecCommand(SensorCommand.StopSignal)
            
private void onBrainBitSignalDataRecived(ISensor sensor, BrainBitSignalData[] data)
{
    Console.WriteLine("Data: " + data);
}
...
sensor.EventBrainBitSignalDataRecived += onBrainBitSignalDataRecived;
sensor.ExecCommand(SensorCommand.CommandStartSignal);
...
sensor.EventBrainBitSignalDataRecived -= onBrainBitSignalDataRecived;
sensor.ExecCommand(SensorCommand.CommandStopSignal);
            
sensor.AddBrainBitSignalChanged((data)=>{
    console.log(data)
}); 
sensor.ExecuteCommand(SensorCommand.StartSignal)
...
sensor.RemoveBrainBitSignalChanged();
sensor.ExecuteCommand(SensorCommand.StopSignal)
            
def on_brain_bit_signal_data_received(sensor, data):
    print(data)
...
sensor.signalDataReceived = on_brain_bit_signal_data_received
sensor.exec_command(SensorCommand.CommandStartSignal)
...
sensor.signalDataReceived = None
sensor.exec_command(SensorCommand.CommandStopSignal)
            
sensor.setSignalDataCallbackBrainBit( { data in
    print(data)
})
sensor.execCommand(.startSignal)
...
sensor.setSignalDataCallbackBrainBit(nil);
sensor.execCommand(.stopSignal)
            
[sensor setSignalDataCallbackBrainBit:^(NSArray<NTBrainBitSignalData *> * _Nonnull data) {
                      
}];
[sensor ExecCommand:NTSensorCommandStartSignal];
...
[sensor setSignalDataCallbackBrainBit:nil];
[sensor ExecCommand:NTSensorCommandStopSignal];
            

 

You get signal values as a list of samples, each containing:

| Field | Type | Description |
|--|--|--|
|PackNum|uint32_t|number for each packet|
|Marker|uint8_t|marker of sample, if it was sent and this feature is supported by the device|
|O1|double|value of O1 channel in V|
|O2|double|value of O2 channel in V|
|T3|double|value of T3 channel in V|
|T4|double|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|PackNum|Int|number for each packet|
|Marker|byte|marker of sample, if it was sent and this feature is supported by the device|
|O1|double|value of O1 channel in V|
|O2|double|value of O2 channel in V|
|T3|double|value of T3 channel in V|
|T4|double|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|PackNum|Int|number for each packet|
|Marker|Byte|marker of sample, if it was sent and this feature is supported by the device|
|O1|Double|value of O1 channel in V|
|O2|Double|value of O2 channel in V|
|T3|Double|value of T3 channel in V|
|T4|Double|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|PackNum|uint|number for each packet|
|Marker|byte|marker of sample, if it was sent and this feature is supported by the device|
|O1|double|value of O1 channel in V|
|O2|double|value of O2 channel in V|
|T3|double|value of T3 channel in V|
|T4|double|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|PackNum|number|number for each packet|
|Marker|number|marker of sample, if it was sent and this feature is supported by the device|
|O1|number|value of O1 channel in V|
|O2|number|value of O2 channel in V|
|T3|number|value of T3 channel in V|
|T4|number|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|PackNum|int|number for each packet|
|Marker|int|marker of sample, if it was sent and this feature is supported by the device|
|O1|float|value of O1 channel in V|
|O2|float|value of O2 channel in V|
|T3|float|value of T3 channel in V|
|T4|float|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|packNum|UInt32?|number for each packet|
|marker|UInt8?|marker of sample, if it was sent and this feature is supported by the device|
|o1|NSNumber|value of O1 channel in V|
|o2|NSNumber|value of O2 channel in V|
|t3|NSNumber|value of T3 channel in V|
|t4|NSNumber|value of T4 channel in V|
            
| Field | Type | Description |
|--|--|--|
|PackNum|UInt32|number for each packet|
|Marker|UInt8|marker of sample, if it was sent and this feature is supported by the device|
|O1|NSNumber*_Nonnull|value of O1 channel in V|
|O2|NSNumber*_Nonnull|value of O2 channel in V|
|T3|NSNumber*_Nonnull|value of T3 channel in V|
|T4|NSNumber*_Nonnull|value of T4 channel in V|
            

 

 `PackNum` cannot be more then 2047

Ping signal

Some devices support signal quality check functions using signal ping. You can send a specific value (marker) to the device and it will return that marker with the next signal data packet. Marker is small value one byte in size.

Available only for BrainBitBlack

OpStatus outStatus;
pingNeuroSmart(sensor, 5, &outStatus);
            
sensor.pingNeuroSmart(5);
            
sensor.pingNeuroSmart(5)
            
sensor.PingNeuroSmart(5);
            
sensor.PingNeuroSmart(5)
            
sensor.ping_neuro_smart(5)
            
sensor?.pingNeuroSmart(5)
            
[sensor PingNeuroSmart:5];
            

 

Recieving resistance

BrainBit and BrainBitBlack also allow you to get resistance values. With their help, you can determine the quality of the electrodes to the skin. Initial resistance values are infinity. The values change when the BB is on the head.

For BrainBit the upper limit of resistance is 2500 Ohms.

void onBrainBitBlackResistDataReceived(Sensor *pSensor, BrainBitResistData data, void *pVoid)
{

}
OpStatus outStatus;
BrainBitResistDataListenerHandle lHandle = nullptr;
addResistCallbackBrainBit(_sensor, onBrainBitBlackResistDataReceived, &lHandle, nullptr, &outStatus);
execCommandSensor(_sensor, SensorCommand::CommandStartResist, &outStatus);
...
execCommandSensor(_sensor, SensorCommand::CommandStopResist, &outStatus);
removeResistCallbackBrainBit(lHandle);
            
sensor.brainBitResistDataReceived = data -> {
    Log.i("TAG", Arrays.toString(data));
};
sensor.ExecCommand(SensorCommand.StartResist);
...
sensor.brainBitResistDataReceived = null
sensor.ExecCommand(SensorCommand.StopResist);
            
sensor.brainBitResistDataReceived = Sensor.BrainBitResistDataReceived { data ->
    Log.i("TAG", data.toString())
}
sensor.ExecCommand(SensorCommand.StartResist)
...
sensor.brainBitResistDataReceived = null
sensor.ExecCommand(SensorCommand.StopResist)
            
private void onBrainBitResistDataRecived(ISensor sensor, BrainBitResistData data)
{
    Console.WriteLine("Data: " + data);
}
...
sensor.EventBrainBitResistDataRecived += onBrainBitResistDataRecived;
sensor.ExecCommand(SensorCommand.CommandStartResist);
...
sensor.EventBrainBitResistDataRecived -= onBrainBitResistDataRecived;
sensor.ExecCommand(SensorCommand.CommandStopResist);
            
sensor.AddBrainBitResistanceChanged((data)=>{
    console.log(data)
}); 
sensor.ExecuteCommand(SensorCommand.StartResist)
...
sensor.RemoveBrainBitResistanceChanged();
sensor.ExecuteCommand(SensorCommand.StopResist)
            
def on_brain_bit_resist_data_received(sensor, data):
    print(data)
...
sensor.resistDataReceived = on_brain_bit_resist_data_received
sensor.exec_command(SensorCommand.CommandStartResist)
...
sensor.resistDataReceived = None
sensor.exec_command(SensorCommand.CommandStopResist)
            
sensor.setResistCallbackBrainBit( { data in
    print(data)
})
sensor.execCommand(.startResist)
...
sensor.setResistCallbackBrainBit(nil);
sensor.execCommand(.stopResist)
            
[sensor setResistCallbackBrainBit:^(NTBrainBitResistData * _Nonnull data) {
                      
}];
[sensor ExecCommand:NTSensorCommandStartResist];
...
[sensor setResistCallbackBrainBit:nil];
[sensor ExecCommand:NTSensorCommandStopResist];
            

 

You get resistance values structure of samples for each channel:

| Field | Type | Description |
|--|--|--|
|O1|double|value of O1 channel in Ohm|
|O2|double|value of O2 channel in Ohm|
|T3|double|value of T3 channel in Ohm|
|T4|double|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|O1|double|value of O1 channel in Ohm|
|O2|double|value of O2 channel in Ohm|
|T3|double|value of T3 channel in Ohm|
|T4|double|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|O1|Double|value of O1 channel in Ohm|
|O2|Double|value of O2 channel in Ohm|
|T3|Double|value of T3 channel in Ohm|
|T4|Double|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|O1|double|value of O1 channel in Ohm|
|O2|double|value of O2 channel in Ohm|
|T3|double|value of T3 channel in Ohm|
|T4|double|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|O1|number|value of O1 channel in Ohm|
|O2|number|value of O2 channel in Ohm|
|T3|number|value of T3 channel in Ohm|
|T4|number|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|O1|float|value of O1 channel in Ohm|
|O2|float|value of O2 channel in Ohm|
|T3|float|value of T3 channel in Ohm|
|T4|float|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|o1|NSNumber|value of O1 channel in Ohm|
|o2|NSNumber|value of O2 channel in Ohm|
|t3|NSNumber|value of T3 channel in Ohm|
|t4|NSNumber|value of T4 channel in Ohm|
            
| Field | Type | Description |
|--|--|--|
|O1|NSNumber*_Nonnull|value of O1 channel in Ohm|
|O2|NSNumber*_Nonnull|value of O2 channel in Ohm|
|T3|NSNumber*_Nonnull|value of T3 channel in Ohm|
|T4|NSNumber*_Nonnull|value of T4 channel in Ohm|