Cov txheej txheem:

Biofeedback Xinesmas: 7 Kauj Ruam
Biofeedback Xinesmas: 7 Kauj Ruam

Video: Biofeedback Xinesmas: 7 Kauj Ruam

Video: Biofeedback Xinesmas: 7 Kauj Ruam
Video: Av qeeg 2024, Kaum ib hlis
Anonim
Image
Image
Biofeedback Xinesmas
Biofeedback Xinesmas

Tus Sau Txoj Haujlwm

Jessica Ann

Cov koom tes

  • Gregory Hough
  • Salud Lopez
  • Pedro Peira

Txog

Ib qho kev sim yees duab kaw uas txuas tus neeg koom nrog lub hlwb rau lub koob yees duab ua haujlwm ntawm Neurosky Mindwave EEG Reader Headset. Biofeedback Xinesmas system ua haujlwm hloov pauv ntawm cov kws ua yeeb yaj kiab ib txwm muaj, hloov chaw muab kev koom tes ntawm cov muaj pes tsawg leeg rau tus neeg koom nrog nws tus kheej ntawm kev coj tus cwj pwm mus rau CAMERA interface. Txoj haujlwm tau tsim los koom tes nrog cov neeg tuaj koom kev cob qhia Gregory Hough, Salud Lopez, thiab Pedro Peira. Koj tuaj yeem nyeem ntawm qhov tshwm sim ntawm kev cob qhia ntawm:

Prototype Configuration

Biofeedback Xinesmas system qiv nws tus kheej rau ntau qhov muaj peev xwm thov. Txog qhov kev qhia no peb tau npaj qhov ua piv txwv ntawm cov kab ke uas saib rau qib koom nrog kev tsom mus rau tus neeg (tsom ib tus lej nkaus xwb) thiab txhais qhov ntawd mus rau lub koob yees duab txoj haujlwm (ntawm yias thiab qaij) thiab tsom lub koob yees duab (sab hauv ntawm OpenCV). Qhov no yog txhua yam ua tau los ntawm kev txuas bluetooth ntawm Neurosky EEG Reader Headset thiab Raspberry Pi.

Raspberry Pi yog lub khoos phis tawj me me uas muaj lub vev xaib thiab cov ntawv sau (muaj hauv qab no) uas txuas tus neeg koom nrog lub hlwb ua haujlwm rau lub koob yees duab teeb tsa thiab txoj haujlwm ntawm lub koob yees duab. Txoj haujlwm lub koob yees duab zoo tuaj yeem ua tau los ntawm Arduino microcontroller tau txais cov cim los ntawm Raspberry Pi. Peb tos ntsoov rau kev txhim kho ntxiv raws li peb lub hom phiaj suav nrog kev ntsuas lub hlwb ntxiv (zaus cuam tshuam nrog lub qhov muag ntsais, thiab lwm yam) thiab lub koob yees duab ua haujlwm (piv txwv li hue, saturation, ci ntsa iab, thiab lwm yam).

Hauv qab no yog cov lus qhia txhawm rau tsim koj tus kheej Biofeedback Xinesmas system.

Zoo siab sim

Kauj Ruam 1: Cov khoom siv

Khoom siv
Khoom siv

Txhua yam koj xav tau los tsim koj tus kheej Biofeedback Cinema prototype tau teev tseg hauv qab no.

  1. Neurosky Mindwave Txawb EEG Lub Pob Ntseg
  2. Raspberry Pi B+ (b+ zoo dua, ntau USB chaw nres nkoj, tab sis tus qauv B zoo ib yam yog tias koj muaj lub hub USB).

    1. Raspberry Pi Lub Hwj Chim Adapter lossis Cov Roj Teeb
    2. Wifi Dongle -or- Ethernet Kev Sib Txuas (tsuas yog tsim nyog thaum teeb tsa)
    3. Bluetooth Dongle pom wiki rau dongles sib xws
    4. SD Card (tsawg kawg 8GBs) nrog NOOBS.
  3. Arduino Txhua lub rooj tsavxwm zoo, siv Uno hauv Cov Lus Qhia no. Tseem ceeb, koj tuaj yeem siv I/O ntawm Pi.

    1. Arduino Power Adapter lossis Roj Teeb Pob
    2. A-B USB Cable
  4. USB Webcam
  5. Mini Pan-Tilt Kit
  6. Saib xyuas nrog HDMI Cov Lus Los Yog Siv VNC los tswj koj lub pi ntawm koj lub khoos phis tawj [nyeem ntawm no]

    HDMI Cable

  7. USB Keyboard & Mouse pom zoo bluetooth keyboard thiab nas kom txo qis USB chaw nres nkoj siv.

Kauj ruam 2: Teeb Raspberry Pi

Teeb Raspberry Pi
Teeb Raspberry Pi

1. Teeb Kho Vajtse

Txuas cov keyboard, nas, bluetooth dongle, wifi dongle (lossis ethernet), webcam, saib xyuas ntawm HDMI cable, thiab lub zog rau koj li Raspberry Pi

2. Teeb Txheej Txheem Ua Haujlwm

  • Toggle lub zog thiab koj Pi yuav tsum pib. Nruab Rasbpian OS, cov lus qhia ntawm no:
  • Yog khau raj thiab Raspian teeb tsa kom raug koj yuav tsum pom lub desktop desktop [Duab saum toj no].

HNUB:

  • Yog tias lub desktop piv piv tau tawm sim rov pib dua koj li Raspberry Pi. Yog tias nws tseem tseem tawm, saib ntawm no txhawm rau hloov kho qhov sib piv ntawm tus kheej.
  • Yog tias koj qhib tus kws kho ntawv thiab koj cov keyboard tshwj xeeb cov cim tsis sib xws, saib ntawm no txhawm rau hloov kho koj cov keyboard teeb tsa.
  • Ntsuas koj qhov kev sib txuas hauv is taws nem (koj yuav xav tau qhov no los nruab cov tsev qiv ntawv thaum teeb tsa). Saib ntawm no kom pab tau teeb tsa wifi.

Kauj Ruam 3: Txuas Neurosky Headset

Txuas Neurosky Headset
Txuas Neurosky Headset
Txuas Neurosky Headset
Txuas Neurosky Headset

1. Kev teeb tsa Bluetooth

Ua ntej Pi tuaj yeem txuas rau Neurosky peb xav tau teeb tsa bluetooth:

Ntawm lub desktop qhib "LXTerminal" (hu ua Terminal los ntawm no tawm). Khiav cov lus txib no los daws teeb meem thiab hloov kho qhov tsis xws luag:

$ sudo apt-tau hloov tshiab

Nruab bluetooth nrog cov lus txib no:

$ sudo apt-tau nruab bluetooth

Nruab ib lub desktop-toolbar bluetooth muaj txiaj ntsig:

$ sudo apt-tau nruab -y bluetooth bluez-utils blueman

Reboot Pi los ntawm Terminal:

$ sudo rov pib dua

2. Xeem Bluetooth Txuas

  • Qhib Neurosky lub mloog pob ntseg
  • Los ntawm Terminal scan rau cov cuab yeej:

hcitool luam theej duab

Lub mloog pob ntseg Mindwave yuav tsum tau teev tseg, sau tseg ntawm MAC chaw nyob ntawm lub mloog pob ntseg [duab saum toj no]

3. Nruab Neurosky Libraries

Tam sim no peb tau npaj los nruab Neurosky Python cov tsev qiv ntawv thiab pib khaws nws cov ntaub ntawv kwj nrog cov tsev qiv ntawv xeem ntawv:

Los ntawm Terminal teeb tsa github nqi hluav taws xob:

sudo apt-tau nruab git-core

Clone github chaw cia nrog Neurosky Python lub tsev qiv ntawv:

sudo git clone

Peb yuav tsum hloov kho MindwaveMobileRawReader.py cov ntaub ntawv nrog MAC chaw nyob ntawm koj lub mloog pob ntseg. FYI: Cov npe ntawv yog cov ntaub ntawv rhiab

sudo nano /home/pi/python-mindwave-mobile/MindwaveMobileRawReader.py

  • Hloov kho MAC chaw nyob uas teev tseg hauv daim ntawv. Ctrl-X kom tiav, Y kom txuag, Nkag mus rau tawm.
  • Pair Neurosky thiab Pi thiab tso cai rau nws txuas tus yam ntxwv, yog hais kom siv tus lej PIN "0000":

$ sudo bluez-yooj yim-tus sawv cev hci0 XX: XX: XX: XX: XX: XX

$ sudo bluez-test-device ntseeg XX: XX: XX: XX: XX: XX yog

Nruab Python Bluetooth tsev qiv ntawv:

sudo apt-tau nruab python-bluez

Khiav lub tsev qiv ntawv xeem tsab ntawv kom ntseeg tau tias Pi muaj peev xwm saib ua ntej cov ntaub ntawv. Koj yuav tsum pom cov ntaub ntawv ntws [duab saum toj no]:

$ sudo nab hab sej /home/pi/python-mindwave-mobile/read_mindwave_mobile.py

Kauj Ruam 4: Txuas USB Webcam W/Qhib CV

Txuas USB Webcam W/Qhib CV
Txuas USB Webcam W/Qhib CV

1. Nruab OpenCV

Los ntawm Terminal:

$ sudo apt-tau nruab libopencv-dev nab hab sej-opencv

Thaum ua tiav, txuas ntxiv mus:

$ sudo apt -tau -f nruab

Rau kev ntsuas zoo:

$ sudo apt-tau nruab libopencv-dev nab hab sej-opencv

Kuaj kev teeb tsa los ntawm kev sim ntshuam lub tsev qiv ntawv:

$ nab hab sej

> ntshuam cv2

2. Kuaj OpenCV hauv Python nrog USB Webcam

  • Ntawm lub desktop qhib "IDLE" (tsis txhob qhib IDLE3!)
  • Los ntawm cov ntawv qhia zaub mov xaiv Tshiab Qhov rai. Luam peb cov ntawv Cv-Blur-Test rau hauv lub qhov rai tshiab thiab txuag. Tsab ntawv muaj nyob ntawm no:
  • Los ntawm cov ntawv qhia zaub mov Xaiv Run Module (lossis Nias F5). Nws yuav siv ob peb feeb los mus, tab sis koj yuav tsum pom lub thav duab me me tshwm nrog koj lub webcam pub nyob, thiab cov vis dis aus yuav tsum tsis meej. Nrog koj zoo siab, OpenCV tau teeb tsa thiab ua haujlwm tau zoo nrog koj lub vev xaib [Duab saum toj no].

Kauj ruam 5: Txuas Arduino

1. Rub tawm Arduino IDE

Los ntawm Terminal:

sudo apt-tau nruab arduino

2. Txuas Arduino & Load Sketch

  • Txuas lub arduino rau hauv Pi nrog A-B USB cable.
  • Los ntawm lub desktop pib ntawv qhia zaub mov mus rau Electronics thiab qhib Arduino IDE. Luam peb daim duab arduino-serial-pi rau hauv IDE [Txuas hauv qab no]. Qhov no yog cov duab kos yooj yim heev uas yuav txav cov servo motors raws li kev nkag los dhau ntawm cov ntawv. Peb yuav xa cov ntaub ntawv hla cov lej raws li lub hlwb tso tawm, siv Python kos duab hauv cov kauj ruam kawg thaum peb tso txhua yam ua ke.

Arduino-serial-pi sketch online ntawm no:

Hauv Arduino IDE, mus rau Cov cuab yeej ntawv qhia zaub mov, xaiv Serial Port thiab xaiv Arduino chaw nres nkoj teev tseg, tej zaum zoo li /dev /ttyACM0. Sau ntawv ceeb toom ntawm chaw nres nkoj

3. Disable Serial Console

Rub tawm thiab khiav ib tsab ntawv kom tsis ua haujlwm txuas rau lub console kom USB txuas txuas tuaj yeem ua haujlwm du:

$ wget

/alamode-setup.tar.gz?raw=true -O alamode-setup.tar.gz

$ tar -xvzf alamode -setup.tar.gz

$ cd alamode-teeb tsa

$ sudo./setup

$ sudo rov pib dua

FYI:

Yog tias koj siv B+ tej zaum yuav txaus I/O los txhawb cov kev pabcuam, (saib ntawm no txhawm rau teeb tsa thiab siv GPIO). Txawm li cas los xij, Kuv txaus siab ntxiv cov khoom ntxiv rau yav tom ntej lub hlwb-rau-kev sim tshuaj. Yog li, teeb tsa thawj qhov qauv nrog arduino kom ntseeg tau tias muaj peev xwm tawg hluav taws xob ntau.

Kauj Ruam 6: Muab Txhua Qhov Ua Ke

Image
Image

1. Tsab ntawv Python kawg

Ua ntej peb tuaj yeem ntxiv tsab ntawv nab nab zaum kawg rau hauv "nab nab-mindwave-mobile" nplaub tshev, peb yuav tsum hloov pauv daim ntawv tso cai. Los ntawm Terminal:

$ chmod a = rwx/home/pi/python-mindwave-mobile

  • Qhib IDLE thiab khiav peb tsab ntawv Python zaum kawg, muaj nyob online ntawm no: https://github.com/PrivateHQ/biofeedback-cinema/ Nco ntsoov tias nws nyob hauv cov nab hab sej-mindwave-mobile nplaub tshev. FYI: Koj yuav tsum hloov kho peb cov ntawv Python nrog koj qhov chaw nyob Arduino tiag.
  • Thaum koj khiav tsab ntawv no peb yam koj yuav tsum tshwm sim: 1) Koj qib kev mloog yuav raug teev nyob rau hauv Python Plhaub, 2) Lub thav duab me me zoo nkaus li pom lub webcam nyob pub nrog lub plooj hloov pauv raws qib kev saib xyuas, 3) lub cev muaj zog (s) txav mus raws qib kev saib xyuas tau raug xa mus rau arduino ntawm ntu [Video saum toj no].

Kauj Ruam 7: Txhim Kho & Txhim Kho

Raspberry Pi muaj lub zog ua tsawg, thiab tawm tsam kom ua haujlwm OpenCV ua haujlwm tau zoo. Nov yog qee yam kuv yuav txuas ntxiv txhim kho thiab txhim kho. Ib qho ntxiv, Kuv npaj yuav suav nrog qhov ntsuas tsis tau ntawm lub paj hlwb ntxiv (zaus cuam tshuam nrog qhov muag ntsais muag, thiab lwm yam) thiab lub koob yees duab ua haujlwm (piv txwv li hue, saturation, ci ntsa iab, thiab lwm yam) yav tom ntej.

Pom zoo: