Questions regarding serial stream format & others

Hello there i've built a cyton without the RFDuino module, leaving its TX,RX, and PGC pins as breakout.
So far i'm able to interact with the board using the RFduino's Rx/Tx pins normally (not D11/12 mind you) to program the PIC. now i'm trying to figure out how the PIC send its data and process it myself, since using labstreaminglayer & OpenBCI_python seems to not working for me (keeps getting disconnected/reconnected)
i''ve figured out the layout of of the data stream format after reading "Cyton Data Format", checking its application in sendChannelDataSerial() function and Serial.print-ing the streams from opening byte "A" to the stop byte 0xC0 (accel standard)
now i'm trying to figure out how to process these byte arrays into eeg/accel data, do i just convert the 24-bit signed channel data to 32-bit signed integer as specified here :
https://docs.openbci.com/docs/02Cyton/CytonDataFormat#24-bit-signed-data-values
and multiply the result with the scale factor? or is there any other processing that needs to be done?
Thanks in advance, and sorry if this was asked previously
Hanif

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited September 2020

    https://docs.openbci.com/docs/02Cyton/CytonDataFormat#interpreting-the-eeg-data

    Scale factor is set in hardware registers, as well as appearing in above algorithm.

  • Alright i tried to multiply that default scale factor with the 32bit integer after conversion using unconnected channel and got around 79 mV, is that normal? granted it's not connected to electrode

  • wjcroftwjcroft Mount Shasta, CA

    Hanif, hello.

    granted it's not connected to electrode

    Reading from a channel without all three wires: INxN, SRB2, and Bias, will just produce noise and random values.

    William

  • hanif777hanif777 Indonesia

    Hey there @wjcroft sorry to ask again, but is there any infos about the default processing for the Raw data?
    https://openbci.com/forum/index.php?p=/discussion/2156/viewing-raw-data-from-cyton-in-open-bci-gui in this one you said there is a DC offset that was filtered, is there any filtering/other processes that were applied to the raw signal before being shown in the GUI? i'm trying to replicate it but am kinda clueless

  • wjcroftwjcroft Mount Shasta, CA

    The GUI just applies the 24 bit sample conversion formula, no filtering in raw data. But GUI displayed graphs do have the filters you specify.

    https://docs.openbci.com/docs/02Cyton/CytonDataFormat#interpreting-the-eeg-data

  • hanif777hanif777 Indonesia
    edited January 2

    Thanks. another quick question @wjcroft what is the "usual" value in the GUI for EMG data? the GIF from the "Getting Started" section is too blurry to see

    oh and do you think there will be complications if the processing of raw data (24bit signed -> 32 bit signed & scale factor multiplication) were done on the PIC? there must be a reason why this wasnt done

  • wjcroftwjcroft Mount Shasta, CA

    EMG is typically in millivolt range. EEG microvolts.

    Since the radio packets limit bandwidth, only 24 bits are sent over the air.

  • The ADC hardware is, per channel and sampling rate times per second, measuring a voltage difference. The hardware expresses this voltage difference as a 24-bit signed integer. See https://www.ti.com/product/ADS1299#:~:text=ADS1299 ACTIVE&text=The ADS1299-4, ADS1299-,reference, and an onboard oscillator.

    Once the hardware produces that 24-bit signed integer, changing this to 32-bit just adds zero bits without improving precision, and multiplying by a scale factor might lose precision. So the firmware leaves those decisions up to the software.

  • hanif777hanif777 Indonesia
    edited January 4

    @Billh said:
    Once the hardware produces that 24-bit signed integer, changing this to 32-bit just adds zero bits without improving precision, and multiplying by a scale factor might lose precision. So the firmware leaves those decisions up to the software.

    Ach so, alright then, thanks for the info Billih!
    i decided to minimize the change to Cyton PIC code and just do the processing on my python code , which lead me to another question, do you know what type of digital filter used to filter the DC offset? i know DSP basics but only tried to do it once or twice (barely)

  • I would look at scipy.signal.butter(). I would adjust the settings based on what you need to see, but to me a highpass of 0.5 and lowpass of 40 Hz looks nice.

  • hanif777hanif777 Indonesia

    Alright thanks. i manage to get a similiar response like from the documentation...
    now i wonder whether to rectify and/or integrate the EMG data realtime or later on analysis, any thoughts?
    (tbh i actually wanted to test my board using EEG, but EEG electrodes are a tad expensive here, so i decided to test with EMG instead)

Sign In or Register to comment.