OpenEEG mode emulation / 256 vs 250 sps

edited April 2015 in Software
Hi,

Will there be a device driver for OPENEEG? so that this new device can be used with third party applications (like BioExplorer and OpenVibe) that work with OPENEEG device driver? or, will you provide OPENBCI device driver for BioExplorer and OpenVibe alike, established third party applications?

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited April 2015
    Explorer, hi. Chip has a demo of this, see his BrainBay post on this forum and his own blog,<br><br>http://eeghacker.blogspot.com/2014/01/openbci-driver-in-brainbay.html<br><br>However unfortunately, the sample rate differences mean this will never be a practical solution.<br>
  • Thanks William! but Chip didn't actually post the OPENEEG code to instruct Arduino to write the data in OPENEEG format (instead of the default OPNBCI output format), he only mentioned that's what he did.

    That externally developed BrainBay driver from the above link on your reply is only specific to BrainBay software, what we need is to have that OPENEEG output instruction code built into OPENBCI hardware configuration software, to allow end users to select the option to have the hardware output to OPENEEG format, which basically would temporarily turn this hardware into an OPENEEG hardware to be used with all the OPENEEG supported applications, and through the configuration option end users can return the hardware to OPENBCI default output. Basically it would be a radio button with two options in setting/option configuration menu, that would be my suggestion.
  • Hello Explorer,

    Chip here. I've now figured out the GitHub thing. I've pushed my updated OpenBCI library to GitHub. I've pushed up my Arduino code to the OpenBCI space so that you can elect (by choosing the "writeChannelDataAsOpenEEG_P2" in the "ADS1299Manager" class) to output the data in the OpenEEG format.

    Note that this has only been tested on OpenBCI V1 and V2 boards. The kickstarter boards will be V3. When they're ready, I'll work to make an OpenEEG format for those as well...though they will be constrained by the same OpenEEG P2 limitations...6 channels at 16 bits...whereas OpenBCI is actually capable of 8 channels at 24-bits.

    Still, with a little bit of time for me to write and debug the V3 version of the driver, it'll be there.

    Chip
  • Hi Guys,

    I wanted to revive this thread and say how cool it would be if there were an OpenEEG driver for the OpenBCI board. Given the suite of software applications already supporting OpenEEG, I bet it would motivate a lot of people to consider OpenBCI as a "production" brain training platform, not just a research platform.

    Frank
  • Nothing new in the compatibility between openeeg and openbci?

    I heard that Bioexplorer are not paying attention to OpenBCI team. 
    It would be great to have bioexplorer avaiable since most of my studies have been based on bioexplorer and I cant use openbci as far as i would like :-(


  • wjcroftwjcroft Mount Shasta, CA
    edited August 2015
    @SirLouen , hi.

    I know a couple people that have been lobbying Larry Janow asking for OpenBCI driver support in Bioexplorer. I encourage you to do so as well, to add to the chorus. I think if enough people mention the tie in to Pete Van Deusen's brain-trainer neurofeedback designs, he'll see more of the money making potential.


    There is unlikely to ever be an OpenEEG 'emulation' mode for OpenBCI, here's why:

    OpenEEG runs at 256 samples per second (sps) and we are 250 sps. So that is a pretty large monkey wrench. In other words, Bioexplorer using such emulation would only be getting 250 samples each second, but expecting 256. All kinds of things break in such circumstances, all the filters, FFTs, etc.

    Chip had his OpenEEG emulation running and talking to Brainbay at one point. But this worked because Brainbay allows you to tweek the sample rate beyond what the OpenEEG supports. Bioexplorer has no such adjustment; and many other packages assume device defaults as well. No one has source access for Bioexplorer.

    William
  • edited August 2015
    I would think that it would not really be that hard to convert 250 to 256 sps.  Every 42 samples you pad with an interpolated sample.
    You could spline it or use some other fancy method (I'm no math expert).  Or you could probably come up with a simple method to skip over samples that would likely interpolate badly.

    I see that the ADS1299 can be clocked at 1.25-2.25 MHz, which would be easy enough to change for 256 sps.  Kind of odd that a 2.048 clock produces 250 sps.

    Has anyone tried to see what happens if you just feed OpenEEG programs 250 sps data?  I'd have to imagine that there is some way to deal with missing, or extra, samples.  With everything free-running and not clock-locked you're never going to get exactly 256 sps in the first place.

    Just throwing some ideas out there.  I'm sure someone with more of a math background can come up with some simple way to do it.
  • wjcroftwjcroft Mount Shasta, CA
    edited August 2015
    Jake, hi. The queries on OpenEEG are largely from users wanting to purchase Bioexplorer and use it with neurofeedback designs such as Pete Van Deusen's Brain Trainer. Costs for both items are roughly in the $400 range. More if you add other components.

    Resampling and interpolation cause various "artifact" errors in the resulting EEG. I'm just guessing here but I don't believe Pete would be very happy supporting his protocols and analysis package with artifact prone data coming in.

    Other than Bioexplorer, I've not heard of any other apps written for OpenEEG that have that strong a pull for usage. In addition to the sample rate problem, OpenEEG is also only 6 channels of 10 bit data samples. Contrasted with OpenBCI 8 or 16 channels of 24 bit samples.


    ... Resampling has two drawbacks that require consideration: first, it may under some conditions create frequency artifacts (called aliasing), which can be amplified by the adaptive information-extracting nature of later stages in most BCI paradigms; in the worst case, this can lead to scientifically invalid conclusions...

    That EEGLAB function is not doing your suggested padding, but a complete spline based interpolation, inside MATLAB. A padding based approach would produce even more artifacts.

  • So what happens at the end of 1 sec when the program has received 250 instead of 256 samples?
    I'd think it would be pretty lame if it just crashed and burned from that.

    I still think you're overstating the difficulty of padding a lousy 6 samples per sec.  It would be very easy for the firmware to find samples that can be straight interpolated without difficulty.  You're not going to get "frequency artifacts" from proper interpolation, even with a simple implementation.  Any aliasing will be well above the low pass filter cutoff.  I don't see any problems with the typical EEG setups people will want to do.

    In any case it would be easy enough to test the supposition.  We're not really talking about resampling, just padding a few samples with interpolation.  And it is to emulated a lesser data source, so I'd be willing to bet that you'd be able to get better data out of it than the original hardware.

    Not that I'm volunteering to write the firmware, but it might be best to tell people that the project is open source and they can feel free to try a few different techniques, rather than suggesting insurmountable difficuties.
  • wjcroftwjcroft Mount Shasta, CA
    edited August 2015
    Jake, actually Jeremy @jfrey was testing an early version of his OpenViBE acquisition server, and it ran at 256 sps, not 250. So he had to interpolate some extra samples. But I'm recalling that he found some difficulties with that. Perhaps he'll comment here. That early test was just a stopgap until the final driver which runs at 250 sps with drift correction.

    I tend to go along with what UCSD is saying (above links): even when optimal, resampling can produce undesirable artifacts. When someone pays $400+ for Bioexplorer, they would expect to get pristine EEG; not a 'simulated' EEG. The other VPLs already talk to OpenBCI: BioEra, BrainBay, OpenViBE, neuromore, (VVVV and PD via OSC), etc. So this discussion only really applies to hypothetical Bioexplorer users. I do think @SirLouen has it already, but I'm sure he has previous hardware such as Pocket Neurobics, from his original purchase.

    The more people email to Larry Janow at Cyberevolution, the more likely a native driver will be produced.

    Chip's original firmware code is available. Do you have a running ADS1299 setup there?

    William

  • I'm just doubting the difficulty of padding 6 samples into 250.  It wouldn't be re-sampling as every data point, except the extra 6, would be real, unchanged data.  Only 6 would be interpolated from the nearest points.

    The straight line interpolation on the padded packets would be an accurate approximation for any signal over 125 Hz.  You certainly wouldn't be able to see it on a trace, and on the FFT it would simply be a 1/250th attenuation of frequencies over 125 Hz.  At least that's my understanding of how the math would work out.


    I'm curious about the "drift correction" you speak of?  Is this to correct for the ADS1299 clock tolerance and temp. drift?
  • wjcroftwjcroft Mount Shasta, CA
    edited August 2015
  • "When a drift is detected, you will see a progress bar moving on the left or right (not enough or too many samples). When the drift reaches a threshold, an automatic correction is done : the Acquisition Server removes or duplicates some samples, and sends stimulation(s) to any acquisition client connected, so you know in the signal that a correction just occured."
    That sounds like a *terrible* idea.  I guess I don't understand what the problem with drift is.  Who cares if your frequencies are off by a percent or two, and why would it matter if your hour long session ends up being recorded as 59 or 61 minutes?  Seems like a non-issue to me.

    It certainly can't hurt to know if your sampling clock is off, but munging up the data to correct it doesn't make sense to me.
  • wjcroftwjcroft Mount Shasta, CA
    Did you read the pdf mentioned above? It's from the DOD.

    http://www.dtic.mil/get-tr-doc/pdf?AD=ADA561715

    Drift is important if you are synchronizing multiple realtime data streams, as is common in BCI. LabStreamingLayer can also be a part of the solution in these cases.


  • I skimmed it.  Seems like BS to me.  Check out the graphs on their simulation of drift.  Seems like they're claiming that a TINY percentage of drift will somehow distort a square wave into a trapezoid.

    Doesn't make any sense to me. Maybe I don't have the math background to understand what they're trying to say, but simple drift isn't going to cause any of those problems.  Perhaps they're actually talking about jitter and are just doing a piss poor job of explaining things.

    Thanks for the info and discussion, I speak critically because I like to learn new things and hope to be corrected if I'm not understanding something.
Sign In or Register to comment.