Используя контроллер Arduino и систему OpenBCI, позволяющую считывать биопотенциалы человека (ЭЭГ, ЭМГ, ЭКГ) — можно помочь парализованным людям управлять различными устройствами. Например — инвалидными колясками.
В данном проекте, авторы считывают сигналы электромиограммы (ЭМГ) от лицевых мышц при помощи шлема Ultracortex «Mark IV» EEG Headset и 8-канального усилителя Cyton Biosensing Board (усилитель — Texas Instruments ADS1299). Затем данные обрабатываются простым скриптом на Python, который через Bluetooth передаёт управляющие команды на контроллер Arduino.
"""Python Code"""
from pylsl import StreamInlet, resolve_stream
import time
import serial
# set up Arduino serial port - replace with the one you are using
ser = serial.Serial('COM4', 9600)
# resolve an EMG stream on the lab network and notify the user
print("Looking for an EMG stream...")
streams = resolve_stream('type', 'EEG')
inlet = StreamInlet(streams[0])
# inlet_ch2 = StreamInlet(streams[1])
print("EMG stream found!")
# initialize time threshold and variables for storing time
time_thres = 500
prev_time = 0
flex_thres = 0.5
while True:
samples, timestamp = inlet.pull_sample() # get EMG data sample and its timestamp
curr_time = int(round(time.time() * 1000)) # get current time in milliseconds
if ((samples[0] >= flex_thres) & (curr_time - time_thres > prev_time)): # if an EMG spike is detected from the left eyebrow muscles send 'F'
prev_time = int(round(time.time() * 1000)) # update time
ser.write(b'B')
elif((samples[1] >= flex_thres) & (curr_time - time_thres > prev_time)): # if an EMG spike is detected from the right eyebrow muscles send 'R'
prev_time = int(round(time.time() * 1000)) # update time
ser.write(b'F')
elif((samples[2] >= flex_thres) & (curr_time - time_thres > prev_time)): # if an EMG spike is detected from the left side of th jaw muscles send 'L'
prev_time = int(round(time.time() * 1000)) # update time
ser.write(b'L')
elif((samples[3] >= flex_thres) & (curr_time - time_thres > prev_time)): # if an EMG spike is detected from the right side of th jaw muscles send 'B'
prev_time = int(round(time.time() * 1000)) # update time
ser.write(b'R')
elif(curr_time - time_thres > prev_time): # if no spike is detected send 'S'
prev_time = int(round(time.time() * 1000)) # update time
ser.write(b'S')
Ссылки
Mindwave Wheelchair
OpenBCI — Open Source Biosensing Tools
По теме
Управление роботом при помощи ЭЭГ и жестов
Управление роботом силой мысли — исправление ошибок робота с использованием ЭЭГ сигналов
Управление манипулятором при помощи интерфейса мозг-компьютер
Интерфейс мозг-компьютер для управления роботом телеприсутствия
Компьютерное зрение с использованием человеческого мозга
Мысленное управление Arduino-роботом
