Un-stable timestamps in .txt file created by the openBCI GUI

edited January 2019 in Ganglion
Board: Ganglion
Recording: MacBook Pro (2018), MacOs:10.13.6 (built-in bluetooth)

In my output(s), samples seem to arrive not at all in line with a sampling rate of 200. Differences between two succeeding timestamps vary from 0 (two samples send in one packet  I guess?) up to almost 100ms.
Also, it appears that several consecutive points can have exactly the same timestamp.
In addition, there are sometimes (although not often) less than 200 samples within 1s (although the sample number 0-200 does not show any jumps (except from 200 back to zero)).
So overall the recoding holds less samples then supposed over a given time.

Please see this small snippet as an example.
99 11.7700000000000 13.5500000000000 14.0200000000000 6.37000000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.519" 1547327891519.00
100 10.3200000000000 16.1900000000000 12.9700000000000 12.8300000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.519" 1547327891519.00
101 5.90000000000000 3.18000000000000 11.2800000000000 3.26000000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.520" 1547327891520.00
102 5.36000000000000 -0.740000000000000 10.0900000000000 8.30000000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.520" 1547327891520.00
103 10.4800000000000 6.56000000000000 7.93000000000000 7.05000000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.615" 1547327891615.00
104 12.3300000000000 3.96000000000000 10.1900000000000 4.58000000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.615" 1547327891615.00
105 11.6600000000000 8.66000000000000 8.67000000000000 6.91000000000000 0.128000000000000 -0.0960000000000000 -1.00800000000000 "22:18:11.616" 1547327891616.00
106 6.48000000000000 5.03000000000000 2.65000000000000 5.74000000000000 0.128000000000000 -0.0960000000000000 -1.02400000000000 "22:18:11.616" 1547327891616.00
107 10.4400000000000 3.73000000000000 10.0400000000000 10.3800000000000 0.128000000000000 -0.0960000000000000 -1.02400000000000 "22:18:11.616" 1547327891616.00
108 12.5300000000000 3.87000000000000 10.5500000000000 12.2400000000000 0.128000000000000 -0.0960000000000000 -1.02400000000000 "22:18:11.616" 1547327891616.00

So how can I identify the timepoint(s) of the dropped samples?
Another question: 
Is (when der are no sample drops) the sample number 0 supposed to hold the "uncompressed" absolute value which is send each second and the other 200 samples (1-200) stem from the deltas?
So do I have in fact 201 sample each second?
best,
dom


Comments

  • wjcroftwjcroft Mount Shasta, CA
    Dom, hi.

    Mentioning @techsupport, @openbci, @retiutut

    I believe the timestamps shown just represent the Mac system clock when the GUI app received the sample packet. The Ganglion processor (Simblee) is indeed sampling at 200 Hz, this is crystal controlled on the Ganglion board. What your log times represent are buffering delays in the radio link or Mac Bluetooth processing. The original 200 Hz samples are still there and are intact.

    Yes, occasionally there may be slightly more or less than 200 samples received per second. This is just normal timing jitter. The clock on the Ganglion board is crystal controlled. 

    Regards,

    William

  • Hi William, thanks for your reply!
    So when I get it right, the ganglion is supposed to provide 201 samples / s (not 200)? 
    I want to compare the time series recorded by the ganglion to one recorded in parallel by another amp.
    My first test recordings with the ganglion always gave me less datapoints than it should within a given time window. E.g. i got less than 201x60sx60min samples within 1 hour of recording. Do you have a suggestion how to pin down the times when samples are lost in order to interpolate them or fill them with nans so that I still can (directly) compare both streams to each other?
    best, dom
  • wjcroftwjcroft Mount Shasta, CA
    edited January 2019
    Can you share your actual numbers (computed samples/sec over long time interval?) Is this consistent over multiple trials?

    How far is the Ganglion from the Mac during operation? It's possible for some reason this may be affecting radio connectivity and hence probability for lost or garbled packets. Also, processor load on the Mac could affect packet reception, since the BLE stacks sometimes have limited buffering.

    One possible solution to radio connectivity issues on Mac, would be to use the BLED112 dongle instead of the native Bluetooth hardware in your Mac. Then further, use a usb cable to situate the dongle closer to Ganglion. And finally, minimize processor load on the Mac during data collection.

    The only practical way to sync your two amps is with a periodic external trigger mechanism. Ganglion has Aux input pins on the board that can be used for this.

    Regards,

  • Hi William,
    sorry for my delayed reply. The ganglion was basically next to my MacBook..so i'd guess less than 30 cm distance.
    I uploaded a long recording (in fact just start the a stream without any attached electrodes) to
    I hope you can access it.
    Can you please also shortly confirm that ganglion is capturing 201 datapoint a second, not 200..
    I will have a look at the aux thingy in the meanwhile.
    best, dom
  • wjcroftwjcroft Mount Shasta, CA
    Dom, hi.

    For your info, your download file above is over 500 megabytes in size. I did not download it.

    As I mentioned before, the timestamps in the txt file are generated NOT by the Ganglion hardware / firmware, but by the GUI app when it receives the packets. Thus these times are subject to buffering delays on the host processor and do not accurately reflect 'real'-time of the samples capture.

    All EEG amplifiers are subject to slight degree of what is called sample rate 'drift' and 'jitter'.


    The Ganglion crystal clock controlled sample rate is set at 200 Hz. 0.5% accuracy would be 1 Hz drift. If there is indeed some drift (and this text file may not confirm that), it should remain relatively constant with little jitter. You could try some experiments with OpenViBE and Ganglion with the page above. To feed OpenViBE from Ganglion you will need to send LSL LabStreamingLayer. This can be generated either from the GUI, or from OpenBCI_Python. Note that this additional buffering could possibly introduce additional jitter, but likely not additional drift.

    I have already cc-ed you on an email with more details on how to achieve external trigger with Ganglion, using an Aux channel from one of the Simblee digital or analog pins. This trigger signal would appear on each 18 bit radio packet, but these packets are sent at about a 100 Hz rate, not 200 Hz. So even with the external trigger you are going to have a bit of jitter.

    Regards,

    William
  • wjcroftwjcroft Mount Shasta, CA
    Here is a related post, but pertaining to Cyton. It still has some valid points,


    This OpenViBE page discusses the drift correction available in the LSL acquisition module.

  • Thank..I'll get through all links.
    My point with the 201samples per second was a way more trivial one and is probably just a misunderstanding from my side.
    I got from the homepage that each second a package with an uncompressed data sample is send. Following this first sample/package (sample 0), there will follow samples 1-200 (with samples 1&2, 3&4,..199&200 being send in one package) etc. So in total 201 datapoints are supposed to be send / stored within 1s (disregarding any inaccuracies for the moment)?



  • wjcroftwjcroft Mount Shasta, CA
    Dom, hi. No, you should consider the EEG sample rate, 200 Hz, to be independent from the radio packet transmission rate, which is only approximately 100 Hz. My guess is that the radio rate is slightly more than 100, so as to accommodate the mix of primarily compressed packets (2 samples per packet) with the occasional (around 1 Hz, containing one sample) uncompressed packet. The Ganglion is crystal controlled, so sample rate should be very close to 200 Hz.

  • hi William,
    it seems that RFD77101 is not produced any more? At least the links to the getting started guide and the library does not work anymore.
    can you please provide me the necessary simblee files for Arduino ice..
    best, dom
      
  • wjcroftwjcroft Mount Shasta, CA
    This thread shows how to do external trigger from a photoresistor, on Cyton. I sent you an email with details on how you might adapt this approach to Ganglion.


Sign In or Register to comment.