Reconstructing EEG signals from raw data using only MATLAB (not EEGLAB)

edited July 2018 in Software
Hi,

I am new to this technology, and have recently picked up an OpenBCI Cyton and Daisyboard, and a Ultra-Cortex Mark IV headset.  I then picked up MATLAB, as I want to analyze the raw EEG signals out.

But I am trying to avoid EEGLAB, as I would like to analyze the raw waveforms mathematically using MATLAB myself.  I have successfully brought over channels 2 to 17 into a variable.  I also created variables containing the raw data from each electrode. 

In researching the Cyton, I see that it is using the ADS1299, which is a 24bit ADC.  I used the MIN and MAX functions in MATLAB to determine the range of the output -72063, and 184775 respectively - hoping that I could cross-reference this range against the 24 bit range.  Essentially I am trying to determine how to convert the raw data into a reconstructed signal. 

I stumbled across "The Ultimate Guide for FFT Analysis in OpenBCI GUI and MATLAB" in the Community Forum, but was not able to follow it.  Does anyone have any sample code for MATLAB suitable for my purposes? 

Thanks,
Don

Comments

  • I think  you need to apply a notch (50 or 60Hz) and bandpass (1-40Hz) filter to have a "normal" eeg signal. 
  • edited July 2018
    Hi,

    I purchased MATLAB (Home version), and have been working to interpret the signals generated by my Cyton, Daisy Board, and Mark IV Headset.

    Because I am new to this technology, and was struggling to 'get going', I thought I would help out anyone also new to this technology by creating a step by step detail on how to:
    1) Run the OpenBCI software using the Cyton, Daisy Board, and Mark IV headset
    2) Capture EEG signals via the SD Card
    3) Download the file to the computer
    4) Translate the file generated on the SD Card into CSV format
    5) Import it into MATLAB directly (not using EEGLAB)
    6) Separate the data into the different channels
    7) Apply Zero-Phase Digital High-pass, Low-pass, and Notch filters
    8) Use the Timer data to number each of the samples and show time lapse between samples

    I am writing scripts to perform various actions at timed intervals, and find it helps to align the eeg signals with the time lapse data.

    My end-goal is to be able to provide a data stream to my MATLAB code and have it decipher what actions were performed during the recording.  I am starting to work on that now.

    I have published my work (and code) thus far here.

    Thanks,
    Don
  • Don awesome. Thanks for documenting how you were able to pull this process off. Your method seems to be the most reliable.
  • Thanks @pushtheworld I appreciate the compliment.
  • Hi,

    I updated the documentation tonight to include signal conditioning.

    When you first start recording, the hardware 'settles', causing spurious signals - which are also recorded. I wrote code to allow the viewing of the first few samples, such that you can determine how much of the signals need to be removed. I then wrote a routine, using a variable to hold the total number of samples to be removed, that adjusts the sample count and sample timer,
    while ensuring the data is kept in alignment with the original sample
    count and time recorded. This helps ensure that any timed scripts being
    followed remain aligned with the recorded signals.

    In my example, we review the first 400 samples, then decide to remove the first 100 samples from all recorded signals, while considering the sample count and keeping the remaining data aligned with the original sample count and timer.

    I will now continue to focus on actual signal analysis. In the meantime, I hope this helps get people started on their own adventure!

    I appreciate feedback, both positive and negative on my work - such that I can continue to improve as needed.

    Thanks,
    Don
Sign In or Register to comment.