Issues with V2 firmware and lead off detection

edited November 2016 in Cyton

Hello.

I uploaded the version 2 of radios and board code (example "DefaultBoard") and the signal seems to be streaming ok (I just tried with open leads, not acquiring EEG signal).
However, I wanted to send the lead off detection signal by default (FS/4 Hz). In the previous version I could do it (writing on the setup() method). Now, when I implement a similar solution, what happens is:
- When I execute the GUI, I can only see the 50 Hz peak and not the 62.5 Hz (Fs/4)
- Then I touch the pins until the GUI freezes
- I click "Stop Data Stream"
- I click "Start Data Stream"
- The signal streams as desired (peak at 50Hz and 62.5Hz).
Do you know what might be happening here?

I tried to write the command for lead off detection in the following levels, never with the desired results:
- "setup" method, after "board.useAccel = true;"
- "OpenBCI_32bit_Library::boardBegin" method, after "boardReset();"
- "OpenBCI_32bit_Library::boardReset" method, after "configureLeadOffDetection(........);"

Thanks in advance,
João

Comments

  • wjcroftwjcroft Mount Shasta, CA
    Mentioning the V2 firmware developer, AJ Keller @pushtheworld .

  • edited November 2016
    @sardet sounds Are you trying to write firmware code to automatically check the impedances? 

    Do you have any links to the firmware you are trying to write so I can check it out? I'm sure we can figure this out.

    The main function that runs impedance checking is https://github.com/OpenBCI/OpenBCI_32bit_Library/blob/master/OpenBCI_32bit_Library.cpp#L668 where each character comes in one at a time.

    If you want to directly fire impedance checking from the `.ino` file I would suggest using this function:
  • Thanks for feedback.

    @pushtheworld yes, that's what I was trying to do.

    I tried to use your suggestion, using the 'streamSafeLeadOffSetForChannel' method on the '.ino' file, but I was not successful.
    For instance, if I wanted to automatically check the impedance on channel 1, I think I could change the 'setup' function as:

    void setup() {
    // Bring up the OpenBCI Board
    board.begin();

    // Notify the board we want to use accel data
    board.useAccel = true;

    //Impedance
    board.streamSafeLeadOffSetForChannel(0x00, OFF, ON); 
    }

    I also tried the following way without good results.

    void setup() {
    // Bring up the OpenBCI Board
    board.begin();

    // Notify the board we want to use accel data
    board.useAccel = true;

    byte N_setting = board.RREG(LOFF_SENSN,BOARD_ADS);
    board.leadOffSettings[0][NCHAN] = ON;
    bitSet(N_setting, 0);
    board.WREG(LOFF_SENSN,N_setting,BOARD_ADS);

    }

    Could you tell me what I am doing wrong?

    thanks!
  • edited November 2016
    @sardet, reading the comment above the function (https://github.com/OpenBCI/OpenBCI_32bit_Library/blob/master/OpenBCI_32bit_Library.cpp#L1175) it says "@param `channelNumber` - [byte] - The channel you want to change" Meaning you need to send this 1-8, not 0-7. 

    Tip: When you see "channelNumber" in the docs, that indicates that you should not zero index.

    Do you have github? I would like to make an example out of what you are trying to do and add it to the main repo!

    For channel 1, your code should look like:
    //Impedance
    board.streamSafeLeadOffSetForChannel(0x01, OFF, ON);

    Important to note you must be streaming for impedance to be measured.
  • Thanks @pushtheworld .

    In OpenBCI_FirmwareV2/DefaultBoard/DefaultBoard.ino, I added, on the setup() method, the line "board.streamSafeLeadOffSetForChannel(0x01,OFF,ON);" and below (commented) another option of code for impedance checking in the 8 channels. but none of the options did what I wanted.

    So, if you could make that example (how to automatically check impedance), it would really be great.
    Thanks!
  • edited November 2016
    Hey @sardet

    There is an open issue for this feature here https://github.com/OpenBCI/OpenBCI_32bit_Library/issues/39

    To better plan this out, please tell me what information you want back from the board on that issue page. In other words, what is your work flow? We can make this an API feature.

    We can allocate a stop byte for this data and send all the info in a packet or one channel at a time. Now that another person wants it, I will push to get this into 3.0.0.
Sign In or Register to comment.