EEG harmonic components, and data scaling factor

jackchenjackchen vancouver
edited October 2016 in Hardware
Hi,
I was testing the EEG data scaling factor by looking at the output and the input voltage.

Here is the experiment,

I set up a sine wave generated by the function generator with vary frequencies which were less than 125Hz and the amplitude of 0.01V (10mV). I connected the N1N pin with the positive probe and the SRB2, AGND pin were connected to the negative probe. And I opened up the OpenBCI_GUI to monitor the signal and implemented the data in MATLAB. What I observed were,
imageimage

- Input signal: 10Hz and 10mV, a nice and clean sinusoidal waveform obtained. 

However, when I was slowly increasing the frequency, probably (>25Hz) , I observed that signal was getting harmonics components.

- Input signal: 123Hz and 10mV
 image

And my second quesiton is the data scaling factor
for the above example of 10Hz, 10mV. The amplitude of the output signal is around 9000, (I am guessing the unit is microvolts). Since my input is 10mV, with a default gain 24x, thus 

input: 10mV/24 = 0.416667 mV and data scaling factor is 9mV/0.416667mV =21.6 ?

and i don't know how the 24-bit will affect the data scaling factor here?

I am not sure whether my thinking is correct or not and sorry for my bad English.

Thanks for the helps!


Comments

  • jackchenjackchen vancouver
    edited September 2016
    Hmm, I guess I made a wrong assumption, the output/input scale should be 1, right? Input voltage is being transformed into counts and processed. After the processing, the number of counts is transformed into volt again and being outputted. I don't know if this is correct.
  • wjcroftwjcroft Mount Shasta, CA
    edited September 2016
    Jack, hi.

    You did not state which board you were using. Was it the 8 channel or 16 channel? The 8 channel samples at 250 hz. With the daisy attached (16 channels), the sample rate drops to 125 hz. Even at 250 hz, the Nyquist limit starts to come into effect at roughly half the sample rate. In other words there are not enough data points to approximate the smooth curves of the input signal.


    re: the scale factor, it is explained on this page,


    The CSV file produced by the GUI is showing values in microvolts. So your 10 mV signal should produce values at approximately 10000 uV.

    William

  • Hi, William
    Sorry! I should have stated that. I am currently using the 8 channel board which samples at 250Hz. All the experiments I did, the frequency was less than 125Hz.

    I did a few more experiments on it yesterday. Sine wave with 10mV amplitude as my input signal. And the frequency was set at 80Hz and 100Hz. Here are the results,

    The amplitudes of these two signals are not equal to the expected amplitude (10000uV)

    I also used the LabStreamingLayer plugin and streamed data in MATLAB. I varied the frequency from 125Hz to 1Hz, amplitude was 10mV again. 


    The amplitude of the output signal increased as I decreased the frequency. Could you explain why this is happening?

    Thanks a lot!
    Jack
  • wjcroftwjcroft Mount Shasta, CA
    edited October 2016
    None of your figures are viewable. Suggest posting on Google Drive or someplace with a complete URL containing your cloud specifics. These URLs you have provided don't reference your account.

    The large majority of EEG usage at 250 hz will be with waveforms below 50 hz. In many cases not even reaching 40 hz.

    Regarding your statement: "I am currently using the 8 channel board which samples at 250Hz. All the experiments I did, the frequency was less than 125Hz." Realize that to avoid distortion and harmonics, you need more than just the Nyquist limit. Probably more like 5, 6 or more samples per waveform cycle. 250/6 = 41.6 hz.

    If you need faster sample rates, there are some other threads on the forum which explain how that can be done using wired USB link or Bluetooth 2.0.

  • Hi, William
    I just uploaded the pictures on Google Drive, hope you can view these pictures.


    Thanks,
    Jack
  • wjcroftwjcroft Mount Shasta, CA
    As mentioned before, you are just seeing aliasing effects because your 250 hz sample rate cannot represent 100 or 80 hz signals without massive distortion.

    https://en.wikipedia.org/wiki/Aliasing
    https://en.wikipedia.org/wiki/Aliasing#Sampling_sinusoidal_functions

    If you stay below 40 hz with your EEG you should be fine. What is your application?

    You may also be engaging effects due to impedance mismatch at your connection between the signal generator and the OpenBCI electrodes. The ADS1299 is expecting an input impedance somewhere between around 5K ohms and say 100K ohms.

    You may want to check this thread,

    http://openbci.com/forum/index.php?p=/discussion/637/methods-for-signal-validation-eeg-phantom-heads

    And Jeremy's paper,

    https://hal.inria.fr/hal-01328427/document

    Regards, William


  • wjcroftwjcroft Mount Shasta, CA
    Jack, I also just re-read your original post. AGND connection is not normally used. You should be using Bias instead. In other words, in a real EEG situation, a typical setup might be left and right ear lobes for Bias and SRB2, and your IN1N line on the head somewhere. Generally in EEG, Bias and SRB2 are NOT shorted together, but applied on different skin areas.

    If you saw that phantom head thread, this is what the phantoms do, they simulate realistic skin impedances, then inject simulated EEG signals into the head mass. The papers in that thread show it is not so trivial to do this.

  • jackchenjackchen vancouver
    edited October 2016
    Hi, William, 
    in my case, I saw the aliasing effect once I increased the frequency from 20Hz to 30Hz. Probably at 25Hz, distortion started to affect the signal.
    image

    But I still don't understand why the 250Hz sampling rate board cannot handle more than 50Hz waveforms? My thought is, if this is the board with 250Hz sample rate,  it should handle at most 125Hz waveforms (Nquist Limit).

    Thank you
    Jack
  • wjcroftwjcroft Mount Shasta, CA
    Jack, hi.

    With the compressed horizontal time scale you have chosen, the exact aliasing effects are somewhat hard to see, even at 20 hz. Was this latest graph still using the AGND connection instead of Bias? That may be contributing to your distortion and amplitude reduction. Have you tried verifying with another device (such as oscilloscope) that your input amplitude remains constant across frequency? As I mentioned before, there could be impedance mismatch or other factors contributing to your measurements. The phantom head links were referenced to show that simulating EEG signals and measurement has certain subtleties.

    re: 'My thought is, if this is the board with 250Hz sample rate,  it should handle at most 125Hz waveforms (Nyquist limit)"

    Try a thought experiment. With 250 hz sample rate and a 125 hz sine wave. If your sample time happens to be at the sine wave maximums, you get something like a triangle wave output. This has huge harmonics if you look at the FFT, it's not a single wavelength as the FFT would show for a sine wave. Similarly (and more likely) if the samples are NOT at the maximums, you get various types of sawtooth waves, or even nothing if the samples happen to be at the zero points. Sawtooths again have tons of harmonics in the FFT.

    So the only time you get decent FFT response minimizing the harmonics is when you have a good number of samples per waveform. And obviously EEG signals are not pure sine waves, they are very complex with many simultaneous frequencies per time period.

    Did you see the paper link by Jeremy Frey with his comparison of OpenBCI characteristics to a research grade device? We pass with flying colors. Have you tried any actual EEG measurements with your unit? What is your application?

    Regards, William

Sign In or Register to comment.