OpenBCI enslaving Teensy 3.6 for signal processing ?

edited July 2018 in Other Platforms
Hi there,
I was wondering whether the OpenBCI boards could enslave via the SPI bus: 
-the little Teensy 3.6 (seems a little powerhouse) or even
-the Arduino FPGA boards (MKR Vidal 4000, XLR8,...) 
...if we need on board to implement demanding real time multichannel signal processing (time-frequency representations, spatio-frequency/temporal filtering, information measures/entropy, ICA, artefacts rejection & feature extraction,...) and/or classification / data processing (LDA, SVM, MLP, RNN, CNN,...(*)). 
Jeff
(*) using models already trained (machine learning done on a PSG database) only in prediction mode for the real time

Comments

  • Hi Jeff,

    Are you trying to connect Cyton, 32 bit board?
    Any luck with SPI and Teensy, so far? I like this idea.

    Another approach would be to modify the firmware slightly to run UART on pins D11, D12 (breaks SPI, so I assume, you'll have 8 channels only):

    The same link has references to the on board calculations.

  • Hi s_arty,
    I just received a Ganglion board and I am assembling a headband for sleep monitoring, 
    my first step will be to transmit EEG/acc data via BLE to a laptop for post night processing, to benchmark sleep scoring algorithms. 
    my second step will be to implement the chosen algorithm for real time on a laptop. 
    my third step will be to use a Teensy 3.6 controlled by the PC via BLE too to implement an audio stimulation controlled by the sleep staging algorithm (step 2). 
    my fourth step will be to implement the sleep staging algorithm on the Teensy 3.6 (along with the acoustic stimulation algorithm) in slave mode with the Ganglion as a master (no more PC/BLE in the loop, full on board processing).
    I will be happy to complete the step 1. 

  • Hi Jeff,

    I like your plan :) 

    To be honest, I have similar plan :)
    I've received a Cyton board and trying to use it as a sensor for sleep research as well. In my case it's lucid dreaming.
    Luckily for me, my board has a debug mode (in v3.x.x firmware), where D11, D12 is an external UART and it mirrors all the communication. 

    In your case, I would start here:
    It should help you with step1

    I went through similar process with Cyton board and it was quite strait forward.


  • Hi s_arty,
    I think one of the Neuroon Open backers on Facebook (Tibor Pajer) has designed an interesting board for that purpose (lucid dreaming).
    The main challenge of my step 1 is to implement an offline, reliable sleep scoring algorithm. Ideally, it would be specialized on my signals, but I would need to have them annotated / scored. 
    Have you produced hypnograms yet ? 
    Jeff
  • Hey Jeff,

    Thank you for the hint! Tibor's project looks really promising, 
    I'll take a look and I'm so excited that somebody else has done some heavy lifting :D
    You really made my day, thank you!

    Please, take a look at the following post here:

    The author suggests https://www.spisop.org/openbci/ 
    This might be the starting point.

  • edited September 2018
    Hello s_arty,
    My fist step is near completion:
    - The OpenBCI_GUI streams directly to OpenViBE & all OBCI packages are now running smoothly (still a remaining problem with the content of the LSL stream outputed by the NodeJS/noble package though, but will not impair step 2).
    - A powerful CNN+LSTM classifier (built over tensorflow & Keras) has been successfully trained on a large part of the physionet database (https://physionet.nlm.nih.gov/pn4/sleep-edfx) running on my GPU (5 hours on a GE Force GTX 980M, 2 days on my i7 CPU). Just now needs to displays some additional sleep analytics: 
    image
    I may find a shortcut for the completion of step 2 if I can get this CNN+LSTM classifier running within the Python scripting box in OpenViBE in real time.
    To complete step 1, I just need to validate the offline processing chain OBCI_GUI --- LSL ---> OpenViBE ---EDF file---> CNN+LSTM --- csv file ---> Matlab  (OV to prepare step 2)
    ... and the transfert of the classifier performances (or the augmentation the training database) on other sleep databases.
    Best,
    Jeff
  • Is that the final classifier output you have in the graphic?

    It looks like the hypnogram red versus blue lines indicate the classifier is good at detecting S2 but less accurate with S1 versus REM. If this will affect the accuracy of timing of your audio tone intervention you may need to tweak the classifier more.


  • edited September 2018
    Hello Billh,
    Yes, the classification in red is the one of the CNN-RNN. It is its first training, in a 5-fold cross validation, on 39 individuals of all ages drawn from the physionet database, which is not so much, and with an electrode set-up different of mine: I would like to train it on a larger, more specialized (males within +/- 15 yrs from my age) data set, with electrode montages compatible with mine. I would also like to review the chosen signal features retained for the classification, which are a strong choice in the classifier design (for example the output of tools like Spinky, K-complex & spindle detections, could become new features to learn on)... will see what I can do in a limited time (my free time).
    Jeff
    PS) The 5-fold procedure produced 5 weights configurations with different accuracies on the varied sleep stages, it's only one of them.  
  • Hi there,
    I won't be able to complete my sleep monitoring device, not being allowed to access the MASS sleep database (only for institutional scientific projects, requiring to be accredited by an ethics review board). I haven't anticipated that the access to an open-access database could be a problem, too bad.
    Jeff
Sign In or Register to comment.