Mindset
MindSet Communications Protocol - протокол разработанный компанией NeuroSky для обмена данными с одноканальными нейрогарнитурами по беспроводному подключению bluetooth.
Вступление
В данном руководстве вы узнаете:
- Как подключиться к последовательному потоку данных Bluetooth для получения потока байтов.
- Как анализировать последовательный поток байтов данных, чтобы восстановить различные типы мозговых волн.
- Как интерпретировать и использовать различные типы данных о мозговых волнах, отправляемых с inkGear (включая данные о внимании, медитации и качестве сигнала) в приложении BCI
В главе «Значения данных inkGear» определяются типы значений данных, о которых может сообщать inkGear.
в MindSet.
В главе «Пакеты inkGear» описан формат пакетов inkGear, используемый для доставки пакетов inkGear.
Значения данных в последовательном потоке ввода-вывода.
Bluetooth Interface
MindSet передает значения данных inkGear, закодированные в пакетах inkGear, в виде последовательного потока.
байт через Bluetooth через стандартный профиль последовательного порта Bluetooth (SPP):
• Профиль Bluetooth: Профиль последовательного порта (SPP).
• Скорость передачи данных: 57600 бод.
• Пароль: 0000.
Пожалуйста, обратитесь к Краткому руководству MindSet и/или Инструкции по эксплуатации MindSet, прилагаемым к
ваш MindSet, чтобы получить инструкции о том, как подключить MindSet к компьютеру с Windows или Mac через
SPP с использованием драйверов Bluetooth и стеков Bluetooth, доступных для этих платформ. Для получения информации о
для сопряжения MindSet через SPP на других платформах обратитесь к документации вашей платформы и
спецификациям SPP, которые можно найти в Интернете.
Значения данных ThinkGear
POOR_SIGNAL Quality
Это однобайтовое целое число без знака описывает, насколько плохим является сигнал, измеряемый inkGear. Это
Диапазон значений от 0 до 200. Любое ненулевое значение указывает на то, что имеется какое-то шумовое загрязнение.
обнаружен. Чем выше число, тем больше шума обнаруживается. Значение 200 имеет особое значение,
в частности, контакты inkGear не касаются кожи пользователя.
Это значение обычно выводится каждую секунду и указывает на неудовлетворительные результаты последних измерений.
Плохой сигнал может быть вызван множеством разных причин. В порядке серьезности они следующие:
• Датчик, заземление или опорные контакты не находятся на голове человека (т. е. когда никто не носит
inkGear).
• Плохой контакт датчика, заземления или опорных контактов с кожей человека (т. е. волосы мешают,
или гарнитура, которая неправильно прилегает к голове человека, или гарнитура неправильно закреплена на
голова).
• Чрезмерные движения пользователя (например, чрезмерные движения головой или телом, тряска гарнитуры).
• Чрезмерный электростатический шум окружающей среды (в некоторых средах присутствуют сильные электрические сигналы или
накопление статического электричества у человека, носящего датчик).
• Чрезмерный биометрический шум, не связанный с ЭЭГ (например, ЭМГ, ЭКГ/ЭКГ, ЭОГ и т. д.)
Определенное количество шума неизбежно при обычном использовании inkGear, и оба фильтра NeuroSky
технология и алгоритм eSense™ были разработаны для обнаружения, исправления, компенсации и учета
и терпят многие типы шумов, не связанных с ЭЭГ. Большинство типичных пользователей, которые заинтересованы только в использовании
ценностям eSense, таким как Внимание и Медитация, не нужно слишком беспокоиться о
POOR_SIGNAL Значение качества, за исключением того, что значения «Внимание» и «Медитация» не будут
обновляется при обнаружении POOR_SIGNAL. Значение качества POOR_SIGNAL более полезно для некоторых
приложения, которые должны быть более чувствительны к шуму (например, некоторые медицинские или исследовательские приложения),
или приложения, которые должны немедленно оповещать об обнаружении даже незначительного шума.
По умолчанию вывод этого значения данных включен. Обычно он выводится раз в секунду.
eSense™ Meters
For all the different types of eSenses (i.e. Attention, Meditation), the meter value is reported on a
relative eSense scale of 1 to 100. On this scale, a value between 40 to 60 at any given moment in time
is considered "neutral", and is similar in notion to "baselines" that are established in conventional EEG
measurement techniques (though the method for determining a inkGear baseline is proprietary and
may differ from conventional EEG). A value from 60 to 80 is considered "slightly elevated", and may
be interpreted as levels being possibly higher than normal (levels of Attention or Meditation that may
be higher than normal for a given person). Values from 80 to 100 are considered "elevated", meaning
they are strongly indicative of heightened levels of that eSense.
Similarly, on the other end of the scale, a value between 20 to 40 indicates "reduced" levels of the
eSense, while a value between 1 to 20 indicates "strongly lowered" levels of the eSense. ese levels
may indicate states of distraction, agitation, or abnormality, according to the opposite of each eSense.
An eSense meter value of 0 is a special value indicating the inkGear is unable to calculate an eSense
level with a reasonable amount of reliability. is may be (and usually is) due to excessive noise as
described in the POOR_SIGNAL Quality section above.
e reason for the somewhat wide ranges for each interpretation is that some parts of the eSense
algorithm are dynamically learning, and at times employ some "slow-adaptive" algorithms to adjust
to natural uctuations and trends of each user, accounting for and compensating for the fact that
EEG in the human brain is subject to normal ranges of variance and uctuation. is is part of the
reason why inkGear sensors are able to operate on a wide range of individuals under an extremely
wide range of personal and environmental conditions while still giving good accuracy and reliability.
Developers are encouraged to further interpret and adapt these guideline ranges to be ne-tuned for
their application (as one example, an application could disregard values below 60 and only react to
values between 60-100, interpreting them as the onset of heightened attention levels).
ATTENTION eSense
is unsigned one-byte value reports the current eSense Attention meter of the user, which indicates
the intensity of a user's level of mental "focus" or "attention", such as that which occurs during
intense concentration and directed (but stable) mental activity. Its value ranges from 0 to 100. Distractions,
wandering thoughts, lack of focus, or anxiety may lower the Attention meter levels. See
eSense\texttrademark Meters above for details about interpreting eSense levels in general.
By default, output of this Data Value is enabled. It is typically output once a second.
MEDITATION eSense
is unsigned one-byte value reports the current eSense Meditation meter of the user, which indicates
the level of a user's mental "calmness" or "relaxation". Its value ranges from 0 to 100. Note that
Meditation is a measure of a person's mental levels, not physical levels, so simply relaxing all the
muscles of the body may not immediately result in a heightened Meditation level. However, for
most people in most normal circumstances, relaxing the body often helps the mind to relax as well.
Meditation is related to reduced activity by the active mental processes in the brain, and it has long
been an observed effect that closing one's eyes turns off the mental activities which process images
from the eyes, so closing the eyes is often an effective method for increasing the Meditation meter level.
Distractions, wandering thoughts, anxiety, agitation, and sensory stimuli may lower the Meditation
meter levels. See "eSense Meters" above for details about interpreting eSense levels in general.
By default, output of this Data Value is enabled. It is typically output once a second.
RAW Wave Value (16-bit)
is Data Value consists of two bytes, and represents a single raw wave sample. Its value is a signed
16-bit integer that ranges from -32768 to 32767. e rst byte of the Value represents the high-order
bits of the twos-compliment value, while the second byte represents the low-order bits. To reconstruct
the full raw wave value, simply shift the rst byte left by 8 bits, and bitwise-or with the second byte:
short raw = (Value[0]<<8) | Value[1];
where Value[0] is the high-order byte, and Value[1] is the low-order byte.
In systems or languages where bit operations are inconvenient, the following arithmetic operations
may be substituted instead:
raw = Value[0]*256 + Value[1];
if( raw >= 32768 ) raw = raw - 65536;
where raw is of any signed number type in the language that can represent all the numbers from
-32768 to 32767.
Each inkGear model reports its raw wave information in only certain areas of the full -32768 to
32767 range. For example, MindSet reports raw waves that fall between approximately -2048 to 2047.
By default, output of this Data Value is enabled, and is outputed 512 times a second, or approximately
once every 2ms.
ASIC_EEG_POWER
is Data Value represents the current magnitude of 8 commonly-recognized types of EEG (brainwaves).
is Data Value is output as a series of eight 3-byte unsigned integers in little-endian format.
e eight EEG powers are output in the following order: delta (0.5 - 2.75Hz), theta (3.5 -
6.75Hz), low-alpha (7.5 - 9.25Hz), high-alpha (10 - 11.75Hz), low-beta (13 - 16.75Hz), high-beta
(18 - 29.75Hz), low-gamma (31 - 39.75Hz), and mid-gamma (41 - 49.75Hz). ese values have no
units and therefore are only meaningful compared to each other and to themselves, to consider relative
quantity and temporal uctuations.
By default, output of this Data Value is enabled, and is typically output once a second.
Blink Strength
is unsigned one byte value reports the intensity of the user's most recent eye blink. Its value ranges
from 1 to 255 and it is reported whenever an eye blink is detected. e value indicates the relative
intensity of the blink, and has no units.
Note: is data value is currently only available via the TGCD and TGC APIs. It is
not directly available as output from any current inkGear hardware. For TGCD, see the
TG_DATA_BLINK_STRENGTH data type for use with the TG_GetValueStatus() and TG_GetValue()
functions.
ThinkGear Packets
inkGear components deliver their digital data as an asynchronous serial stream of bytes. e serial
stream must be parsed and interpreted as inkGear Packets in order to properly extract and interpret
the inkGear Data Values described in the chapter above.
A inkGear Packet is a packet format consisting of 3 parts:
1. Packet Header
2. Packet Payload
3. Payload Checksum
inkGear Packets are used to deliver Data Values (described in the previous chapter) from a inkGear
module to an arbitrary receiver (a PC, another microprocessor, or any other device that can receive a
serial stream of bytes). Since serial I/O programming APIs are different on every platform, operating
system, and language, it is outside the scope of this document (see your platform's documentation for
serial I/O programming). is chapter will only cover how to interpret the serial stream of bytes into
inkGear Packets, Payloads, and nally into the meaningful Data Values described in the previous
chapter.
e Packet format is designed primarily to be robust and exible: Combined, the Header and Checksum
provide data stream synchronization and data integrity checks, while the format of the Data
Payload ensures that new data elds can be added to (or existing data elds removed from) the Packet
in the future without breaking any Packet parsers in any existing applications/devices. is means that
any application that implements a inkGear Packet parser properly will be able to use newer models
of inkGear modules most likely without having to change their parsers or application at all, even if
the newer inkGear hardware includes new data elds or rearranges the order of the data elds.
Packet Structure
Packets are sent as an asynchronous serial stream of bytes. e transport medium may be UART, serial
COM, USB, bluetooth, le, or any other mechanism which can stream bytes.
Each Packet begins with its Header, followed by its Data Payload, and ends with the Payload's Checksum
Byte, as follows:
первый байт синхронизации | второй байт синхронизации | длина пакета | тело ответа | контрольная сумма |
---|---|---|---|---|
Заголовок пакета ^^^ | Данные ^^^ | Контрольная сумма ^^^ |
e [PAYLOAD…] section is allowed to be up to 169 bytes long, while each of [SYNC], [PLENGTH],
and [CHKSUM] are a single byte each. is means that a complete, valid Packet is a minimum of 4
bytes long (possible if the Data Payload is zero bytes long, i.e. empty) and a maximum of 173 bytes
long (possible if the Data Payload is the maximum 169 bytes long).
A procedure for properly parsing inkGear Packets is given below in Step-By-Step Guide to Parsing
a Packet.
Packet Header
e Header of a Packet consists of 3 bytes: two synchronization [SYNC] bytes (0xAA 0xAA), followed
by a [PLENGTH] (Payload length) byte:
[SYNC] [SYNC] [PLENGTH]
_______________________
^^^^^^^^(Header)^^^^^^^
e two [SYNC] bytes are used to signal the beginning of a new arriving Packet and are bytes with
the value 0xAA (decimal 170). Synchronization is two bytes long, instead of only one, to reduce the
chance that [SYNC] (0xAA) bytes occurring within the Packet could be mistaken for the beginning
of a Packet. Although it is still possible for two consecutive [SYNC] bytes to appear within a Packet
(leading to a parser attempting to begin parsing the middle of a Packet as the beginning of a Packet) the
[PLENGTH] and [CHKSUM] combined ensure that such a "mis-sync'd Packet" will never be accidentally
interpreted as a valid packet (see Payload Checksum below for more details).
e [PLENGTH] byte indicates the length, in bytes, of the Packet's Data Payload [PAYLOAD…] section,
and may be any value from 0 up to 169. Any higher value indicates an error (PLENGTH TOO LARGE).
Be sure to note that [PLENGTH] is the length of the Packet's Data Payload, NOT of the entire Packet.
e Packet's complete length will always be [PLENGTH] + 4.
Data Payload
e Data Payload of a Packet is simply a series of bytes. e number of Data Payload bytes in the
Packet is given by the [PLENGTH] byte from the Packet Header. e interpretation of the Data Payload
bytes into the inkGear Data Values described in Chapter 1 is dened in detail in the Data
Payload Structure section below. Note that parsing of the Data Payload typically should not even be
attempted until after the Payload Checksum Byte [CHKSUM] is veried as described in the following
section.
Payload Checksum
e [CHKSUM] Byte must be used to verify the integrity of the Packet's Data Payload. e Payload's
Checksum is dened as:
1. summing all the bytes of the Packet's Data Payload
2. taking the lowest 8 bits of the sum
3. performing the bit inverse (one's compliment inverse) on those lowest 8 bits
A receiver receiving a Packet must use those 3 steps to calculate the checksum for the Data Payload
they received, and then compare it to the [CHKSUM] Checksum Byte received with the Packet. If the
calculated payload checksum and received [CHKSUM] values do not match, the entire Packet should
be discarded as invalid. If they do match, then the receiver may procede to parse the Data Payload as
described in the "Data Payload Structure" section below.