OpenBCI triggers with RPi [resolved]

sudarshanj645sudarshanj645 Bangalore, India
edited May 2021 in Cyton

Hello,

I am facing some issues in interfacing my Raspberry Pi 400 with my OpenBCI. The Raspberry Pi is powered on by means of a 5V, 3A adaptor from a wall socket.

I have created an experiment on my Raspberry Pi to which I have synchronized three GPIOs as output. I need these triggers to observe the response to the stimulus I am providing. These are working fine, as I have tested them with the experiment, first with LEDs and then with the OpenBCI itself.

However, there are some issues I am facing with the interface between the two systems:

1.) Firstly, when I connect the ground of the Raspberry Pi 400 to the ground of the OpenBCI, the LED of the OpenBCI switches off and the system powers down. There have been a couple of times this has not happened and I was able to read the Digital pins on the OpenBCI GUI. However, more than 90% of the time, the OpenBCI powers down when I connect the grounds of the two. Both GPIOs run at the same voltage of 3v3.

2.) Whenever I connected any pin from the Raspberry Pi 400 to the OpenBCI, be it a GND or a GPIO, the EEG waveforms immediately stop giving any meaningful data. The channels go from 'Not Railed' to 'Railed' and the signal I see is 100% noise.

Like I said in point 1, there have been a couple of occasions that the OpenBCI has not powered off when I made a connection between RPi and OpenBCI. During one of these occasions, I have tested the triggers along with the experiment on the OpenBCI GUI using the ‘Digital read’ option (without making the connections for the EEG acquisition) and the triggers worked fine. I have taken a video of this. Similarly, when the triggers are not connected, the EEG acquisition is happening.

Is there any suggestions or possible resolutions you could offer me for this problem, as I have tried everything at my disposal including a resistor divider the circuit between the two grounds.

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Sudarshan, hi.

    You DO NOT want to be connecting the Cyton pins directly to another computer's power, ground, or GPIO. Instead use optical isolators, as shown in this document,

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

    You may also want to see the other sections of the document regarding general use of external triggers, and recording them in the 3 'Aux' data channels.

    Regards, William

  • sudarshanj645sudarshanj645 Bangalore, India
    edited May 2021

    Hey William,

    Apologies for the late response, wanted to try out what you suggested. Due to the lockdown in my country, I was unable to source the exact part, but I got what I think is an equivalent SMD (Here is the part details - CNY17-2X019T SO 6Pin TRIOS Phototransistor Optocoupler by INFINEON technologies). Is this acceptable?

    I made the circuit as per the link that you have shared and it does not recognize the GPIO triggers from my RPi on the OpenBCI GUI. Do you have any suggestions on how I can move past this?

    EDIT: I should also probably include: The OpenBCI does not power down like before when I connect it through the Optocoupler. But it does not recognize the GPIO trigger either.
    Best,
    Sudarshan

  • wjcroftwjcroft Mount Shasta, CA

    Sudarshan, hi.

    Here are some substitutes for the CNY17 part used in the schematic. It sounds like either your part or your wiring does not meet the requirements.

    https://www.google.com/search?q=cny17+substitute

    William

  • sudarshanj645sudarshanj645 Bangalore, India

    Hello William,

    Thanks for the info. I checked the wiring and it seems fine. Could be the IC as you say. I will try to source a compatible part and keep you posted on the developments. Thanks again!

  • sudarshanj645sudarshanj645 Bangalore, India
    edited June 2021

    Hello, William.
    I obtained the suggested part (CNY17F-3) and made the circuit. There are still no noticeable triggers from RPi. I have tried everything possible including checking the wiring, the wires etc., but it does not seem to work.
    This is extremely strange, because I saw some aberration in the OpenBCIs behavior:

    • When I connect the output from the optoisolation circuit into the input pin for triggering on D12, D13, D18 - the OpenBCI switches off (ie, the blue LED powers off) when I click on the 'Turn on Digital Read' option in the GUI. I don't understand why this happens.
    • When I connect the optoisolation circuit to D11, OpenBCI does not switch off. Instead, the blue LED switches off and switches on exactly in the intervals that it is supposed to according to my external trigger program. For example, if I do a Digital Write operation every 500ms on the pin connected to OpenBCI pin D11 on my microcontroller (RaspberryPi), I can see the Blue LED becoming dimmer and brighter every 500ms exactly. However, none of these triggers are recorded on the GUI or in the txt file. I don't understand this behavior and I have checked everything I can wrt to this.

    If I try to trigger using an Arduino, it works fine, without any issues. It is the RPi causing the problem, and even when I power the RpI using a DC source (like a power bank for instance), it does not help as no triggers are seen.

    Hope this information helps to zero in on the issue!

  • wjcroftwjcroft Mount Shasta, CA

    If I try to trigger using an Arduino, it works fine, without any issues.

    Just to clarify, when your Arduino is sending triggers using the setup in,

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

    Everything works as expected. Is that correct? If that is the case you have some power or ground loops issues with your RPi.

  • sudarshanj645sudarshanj645 Bangalore, India

    Hello William,

    No, the Arduino triggers

  • wjcroftwjcroft Mount Shasta, CA

    I think you intended to answer my question: "yes, the Arduino works perfectly with the optoisolator". Is that correct. Your use of the word 'no' is confusing.

  • sudarshanj645sudarshanj645 Bangalore, India

    Hey William,
    Sorry about the previous comment, my screen froze when I was typing and I don't know how the comment got posted, I intend to remove it.
    To answer your question, NO, the Arudino did not work through the optoisolation system, either. Since the Arduino is powered through a DC source, I connected it directly to the OpenBCI, and this is when the triggers are showing up, albeit with a slight jitter of about 5-6ms. I didn't pay much attention to Optoisolation with Arduino because the External triggers document said that it is to be used when the external triggering device is being powered through a wall socket.

  • wjcroftwjcroft Mount Shasta, CA

    If the optoisolation works with neither Arduino, nor RPi, then I would suspect something is 'off' in your wiring of this circuit. Do you have some way to monitor voltage / logic levels, to check?

  • sudarshanj645sudarshanj645 Bangalore, India

    Hey William,
    I have checked the wiring and the continuity of the circuit and verified it with the picture and the schematic in the documentation. I can verify that once again, to be sure.
    I can obtain a multimeter on short notice, and perhaps a logic analyzer as well? Is this what you had in mind?

  • wjcroftwjcroft Mount Shasta, CA

    Logic analyzer or oscilloscope would be ideal.

  • sudarshanj645sudarshanj645 Bangalore, India

    Understandable! I will acquire one of these tomorrow and observe the output trigger from the Optoisolator under an oscilloscope to verify this as per your suggestion. Thank you.

Sign In or Register to comment.