connect external audio signals to Cyton

RafiaRafia USA
edited September 2019 in Cyton

Hi,
I am generating external audio signal by pic24 microcontroller and connecting with any 2 pin of cyton board for event information .( Say eeg are at c3 and c4 and two audio signals at o1 and o2). The stimulus signal is analog. How can I see those two audio signal as digital ( high or low) ?

In attached signal, odd and regular are external audio signal. How can I covert them in digital ? I want to see on openBCI Gui panel .
Rafia

Comments

  • wjcroftwjcroft Mount Shasta, CA

    There are two ways to connect an external trigger to the Cyton. You can use a two resistors to make a voltage divider, this will reduce the audio level into microvolts, for example + or - 50 microvolts, that will be within range of EEG channels.

    The other way is to, again, ensure your voltage levels are not too high, at most 3.3 volts (DC power supply level of Cyton). Then use the Aux channel feature to connect to the PIC32 pins. Analog Input ('/2') is probably better for your audio signal.

    https://docs.openbci.com/docs/02Cyton/CytonExternal

    The signal.jpg file you posted appears to show the audio trigger channels as overdriving the inputs, the signal is too strong.

    Regards, William

  • Is it possible to convert digital ?

  • wjcroftwjcroft Mount Shasta, CA

    Rafia, please clarify your comment, I don't understand what you are asking. The audio signals you are using as external trigger signal(s), indeed do get converted from analog form into digital. By either of the two methods I described in my post.

  • Hi,
    I am confused...
    I have connected External trigger(17) to cyton board as described in the pdf. Pin d17 reading 0 all the time and D18 all the time 1( I haven't connected D18). I think I have to edit /upload/? arduino IDE ? What are the stpes .... Please explain.

  • Hi,
    I am going to use external signal as I mentioned earlier. Not doing any more mess, I need to clear one thing: For using external trigger , I just need to follow https://docs.openbci.com/docs/02Cyton/CytonExternal.
    But for my own trigger, do I have to upload any file to my board and then start to measure ? I meant to say what are the steps ? Do I need to use arduino ? Upload to my board ?

  • wjcroftwjcroft Mount Shasta, CA

    Rafia, what do you mean by: "But for my own trigger, do I have to upload any file to my board and then start to measure ? I meant to say what are the steps ? Do I need to use arduino ? Upload to my board ?"

    Are you referring to your PIC24 / Arduino that sends the audio and external trigger? Obviously you will upload to that.

    re: uploading to Cyton. NO. Just follow the instructions on the link you just provided. You may want to use analog read rather than digital read, since this is an audio signal. Digital only works for 3.3V 0V digital input. Be sure to use a voltage divider if your signal is outside this range. Is your PIC24 a 3.3V system? If so, you could use a GPIO output pin to send the trigger.

  • okay. I understand.
    I will my micromedia board with pic24 for generating audio signal. On cyton board, I will not upload anything. I will D17/ D18 for audio input with voltage divider.

  • Hi William,
    @tzvet, @biomurph
    On D11 external trigger is connected. It is ranging some value 200 to 900 on Analog ReadOn. I am confused ... What does the ranges meaning ; And which value will be my event marker ? Do u have any csv/txt eeg recordided file with analog external trigger ?
    Rafia

  • wjcroftwjcroft Mount Shasta, CA

    The Cyton analog read is done with the onboard PIC32 / chipKIT GPIO pins, operating in analog mode. I assume you are using a voltage divider network to reduce (audio) input voltage to the 0 to 3.3 volt range that is acceptable to the ADC. Sample value 0 represents zero volts. Samples are 16 bits in width. So max 16 bit value would represent 3.3V.

    To be honest, your best approach might be instead to use digital read, and modify your PIC24 / Arduino code to output a digital value at the time of your trigger event. That would also allow you to use an optoisolator, if you want more safety isolation between the Cyton and external equipment. And a clear digital level representing "trigger on" would be easier to interpret than trying to do pattern recognition on an AC audio waveform.

  • tzvettzvet Hefei, China

    Hello @Rafia! I am sorry but what exactly is your question to me ? From your posts it seems that you do have a "working" analog input (out of the voltage issues mentioned by @wjcroft). You need to define carefully the "trigger" input you want to put for your own use (eg a simple "on" signal of 100ms length, voltage height you decide) and how you interpret it (eg. you take the time of the rise part as trigger start).
    And yes, I do have a csv/txt file using an external trigger (see the comments I put on the forum). But this file is not "recorded", it is obtained by converting the real recorded binary file on the SDcard (my case), or you use the data saved by the OBCI-GUI software (the EEG/AUX signals you see in the window during "online" streaming; saved in a directory called smthg like "/SavedData/"). But these data, you must be careful using it; ~2years ago the Dongle system - which i use - could only stream at 125Hz with the 16 channels system; it was not the raw signal; check carefully your system hardware configs and what you can record.
    I found all the infos about the different configs i needed on the OpenBCI web site, and some interesting infos also on the forum. But i have not checked the recent improvements that OBCI's guys have made on the software & hardware. I bought mine 2 years ago, and used the GUI software from 1st half of 2018 for my recordings for online monitoring, and the real data I was interested in are the one recorded on the SDcard (raw EEG/AUX values). It worked. Though I had to use the trigger with the simple text commands sent to the Daisy+Cyton board (16 channel system), i have data and trigger signals that allow interesting measures.

    regards, tzvetomir

  • @tzvet
    Actually , I meant to say my D11 reading was from 200 to 900 . So I am not sure... My input analog. So, what is it's unit? Is it digital? I meant to say, on event marking, is it digital or analog range? If analog, how can I mark the event.... Input analog. On D11, which I want to use as event marking, it is what? Analog, digital, pw?.... Can you send me any of your file/ Files so that I can use it or read it as tutorial. My email :smile: [email protected]

    Please...

  • wjcroftwjcroft Mount Shasta, CA

    @Rafia, please re-read my last comment. Analog sample is a voltage value between 0 and 3.3 V, represented by a 16 bit number that ranges from 0 to the max represented in a 16 bit value, either 0x7FFF or 0xFFFF. I don't recall off hand the max ADC value if it is 15 or 16 bits. (signed or unsigned 16 bit number.)

    AGAIN, I recommend you will find it easier to just generate a DIGITAL trigger signal from the GPIO output of your Arduino sound generator. Using the analog output will be much harder in terms of the signal processing, threshold, etc.

  • tzvettzvet Hefei, China
    edited October 2019

    @Rafia : if you have already a recorded file it is digital. the cyton/daisy boards are ADCs. For the units, It is normally uV.

    For a trigger - you need to find your "time stamp of interest". For the "square wave" example i gave, a simple derivative and search of the positive deviations of the slope gives you the "start time" of the time stamp. Then you're done. BUT you need a clean trigger signal, i.e. a nice square wave. This is an electronics+data processing problem that needs to be solved by you, for your own measurement/experimental system !
    the issue about analog input "trigger" i commented on the forum was special. For me the "analog" trigger input turned out not working because it created (induced) trigger signals on other channels, the 16 "EEG" channels, where i did not want trigger signal ! I could not use the analog input signal as a trigger system! if i give you my useless files, it would be at best a useless "tutorial" for you, but even worse, i think it will be misleading you and making you loose time (though showing a wrong way of doing is a good example of what not to do - this is why i think my comment on the forum is worth smthg). Personally, I finally decided to use the commands to the Cyton/Daisy, sent to them as trigger information by the software i used for running my experiments.

    How you use the final data recorded in the file (which includes the trigger), it is to you to decide.

    If you don't have experience with this, please find a colleague at your work place/institution that can help you and direct you/or tutor you for this part; especially the issue about creation/recording/extracting clean trigger signals and how to avoid the analog input of the Cyton/Daisy (pins D11 etc.), which you use as "trigger" signal, messing with your signal of interest, the other 8/16 EEG channels.

    I am sorry but my impression is that your problem cannot be solved in a simple manner on the forum.

    regards, tzvetomir

  • wjcroftwjcroft Mount Shasta, CA

    re: induced capacitive / inductive coupling of trigger signal into EEG channels.

    This should be able to be reduced, by using the proper cabling and current reduction. For example with a digital trigger signal, using an in line 100K or 1M resistor from the GPIO output pin on the Arduino, to the digital input pin on the PIC32. Similarly if an opto coupler is involved. Shielded wire can also be employed with the shield connected to ground.

    re: ADC units.

    ADC units for the Cyton EEG channels are indeed microvolts. However the PIC32 GPIO pin ADCs operate on 0 to 3.3V scale as mentioned.

  • tzvettzvet Hefei, China

    I am happy that the openBCI team can help ! I have not tested the suggestions of @wjcroft here or the previous suggestions on the thread i created more than one year ago (or may be even older).
    But i would suggest that one checks at the end, when the system is "ready", whether there is any induced "trigger" waveform on your EEG channels of interest. simply by plotting your raw signals (after taking out the 50/60Hz noise) together with the "trigger" signal.

  • @tzvet
    Sorry I didn't find the file you referred. [a directory called smthg like "/SavedData/"). ]

Sign In or Register to comment.