My Open Source Flickering Stimulator For SSVEP BCI (MATLAB - Psychtoolbox)

on Thursday, November 10, 2016
I have just published my source code to generate four SSVEP stimuli on my github. Check them out if you are looking for a stable stimulation source.

https://github.com/taro10h/flicker_stimulator


SSVEP based BCI game with my hardware WEEG [Video]

on Wednesday, July 6, 2016
I would like to share the status of my work. This blog post contains a brief description of the system and a demo video of a Brain Computer Interface game. The subject control a game character by looking at different flickering target. The result was great. The game character moves at a decent pace. I will describe more about this system in comming posts.

Hardware:
- WEEG (version 3.2) : Wireless EEG recording device with ADS1299
- Bluetooth module: HC05 to handle wireless data transmission

Software:
- Signal acquitition: Matlab GUI. Major functions in the background: Serial port data acquitition, Ring buffer to balance the datastream, real-time FFT, real-time configrable FIR/IIR filter, data integrity checker, event marker, game controller, and other signal processing functions.
- Stimulation: Flickering stimulation at 4 frequency (6.6Hz, 7.5Hz, 8.75 Hz and 12Hz) by Psychtoolbox 3 ( I built this stimulation software from stratch). Highly recommend this tool box for precise timing experiment (with Matlab).
- Game: Mario maze game ( written on Python). This game communicated with the WEEG signal acquitition via TCP. Insprired by this game

EEG montage:
- Bias drive at Left Mastoid
- Differential measurement at 1 channel: 0z-02





1 Zhu, D., Bieger, J., Garcia Molina, G., and Aarts, R.M.: ‘A Survey of Stimulation Methods Used in SSVEP-Based BCIs’, Computational Intelligence and Neuroscience, 2010, 2010, pp. 12


Capturing alpha waves with WEEGEE

on Tuesday, May 31, 2016
This blog post is an excerpt from my conference paper for the 6th International Conference on the Development of Biomedical Engineering - Ho Chi Minh City, Vietnam. I will post a link to my article once it is available. The detection of alpha waves in my data is an important milestone for my project.

This experiment concentrates on the analysis of the alpha rhythms (in the range of 8-12 Hz). Alpha brain waves boost up in EEG signal when subject’s eyes are closed, and when subject’s eyes open, alpha waves’ amplitude reduce. This is an ordinary feature of EEG data processing. From the standpoint of a hardware designer, it’s an important assessment for EEG recording hardware to verify that the system can measure ultra low brainwave signal.
The subject is a student (23-year-old) who participated voluntarily in this experiment. The experiment comprises two phases. First, the subject sits and relaxes on a chair with his eyes open for 15s. There are none stimuli in front of the subject’s eyes. Second, the subject closes his eyes in 5s and opens his eye in 5s for every trial. This protocol is illustrated in Fig 1.

Fig. 1 Protocol for detecting alpha waves


Every run consists at least 5 trials. We conduct 5 runs in the session. EEG data is recorded in two differential channels. Gelled electrodes are placed on the subject’s scalp according to the International Electrode (10-20) Placement System. One Ground (bias) electrode is placed on the left mastoid. The differential pair of channel 1 is placed on the O2 and the right mastoid. The differential pair of channel 2 is placed on the Oz and O1. The sampling rate is 250 Hz. EEG data was high-pass filtered at 0.3Hz to avoid DC drift and a low-pass filter at 43Hz because the signal of interest would be around 8-12Hz. Data is analyzed and visualized using a Matlab Graphical User Interface (GUI). The Power Spectrum Density (PSD) graph of one run is presented in Fig. 2. The result coherences with the hypothesis in which PSD of alpha waves is high (in red color) when subject’s eye is close; PSD of alpha waves is low when subject’s eye is open and relax. 
Fig. 2 Spectrogram graph to detect alpha waves

Simulation video

Armbrain prototype #3: Introducing WEEGEE, the Wireless EEG recording device

on Friday, April 29, 2016
I consider my Armbrain prototype #2 was a partial success. I get some improvements compare to the 1st prototype in term of circuit footprint. On the other hands, the analog system doesn't perform as I expected. In prototype #1, I use an ADS1299 Front end - Demo Kit from TI as an analog system with a STM32F407 Discovery board from ST as a digital system. I get everything working together to record ECG and alpha waves of the brain. I decided to layout a new circuit board which comprises essential components from those two evaluation boards. It's the prototype #2. 

Its digital system works like a charm. If I send Test Signal from the ADS1299 channels, I can plot the exact plot on the Matlab interface. Also, I demonstrated temperature recording with this hardware in the previous post. I felt great about myself. I moved to the next task, checking analog system performance which is the key feature of this board. It just didn't work. I always got offset value for DC signal and weird noise for AC signal. I tried every possible way to debug the system such as measuring large signal, measuring EKG signal from EKG simulator or using logic analyzer to monitor data transfer. I could locate the issue comes from the ADS chip, yet I couldn't pinpoint the exact problem. I was upset because of this failure. I put off the project for awhile after countless testing and debugging efforts. A year later, I found that I made mistakes in placing polarized capacitor components on negative voltage rail. The positive pole of these capacitors should be soldered to the ground, whereas negative poles should be soldered to Vss.  

Capacitor placement on negative rail

I design a better version 3 which is named WEEGEE. The name stands for Wireless EEG recording device. I built and tested the system. It performed very well. It can catch alpha waves, do some SSVEP experiments and measure electrode impedance. I will post more in upcoming blog posts. This new version has a charge circuit for a lithium battery. Any battery from 2.5V to 12V can power up the device thanks to the buck/boost converter TPS63060.
WEEGEE - Wireless EEG recording device (v3)
The basic spec of this board is listed as below

Item
Font Size
Number of channels
8 (expandable to 32)
Analog Input Option
Differential and single ended input for all channels
Resolution
24 bit
Min input voltage step
22.3nV
Input voltage full-scale
188mV
CMRR
-110db
Analog power supply
Dual ±2.5V
System power supply
Single Lithium polymer battery cell 3.7V
Steady state current
30mA

Also, I summarize the system architecture in the figure below