External trigger question on photodiode [resolved]

GalindoGalindo México
edited July 2021 in General Discussion

Hi! I am trying to replicate the method explained here:
https://docs.openbci.com/docs/02Cyton/CytonExternal
"External Triggering The Harder Way (Firmware 1.x.x)" once I am using a photodiode as a trigger.
But without success, I woul like to know if the code explained in the last box
"The code to read this trigger input is quite similar to the previous button code. In this case, we need to use a different pin (pin 18) and watch for the falling edge of the trigger."
Should it be entered smomewhere? (I am using windows).
Thank you!!

Comments

  • retiututretiutut Louisiana, USA

    Here is a more complete example of what is possible using a photodiode as an external trigger for Cyton.

    Please review the following repository and example carefully.

    https://github.com/OpenBCI/OpenBCI_Experiment
    https://docs.openbci.com/docs/07Examples/VideoExperiment

  • GalindoGalindo México

    Great, thank you for the fast help.
    About hardware:
    As long as I read, in this circuit, there is no need to use an optocoupler?
    About the software end,
    Should I download and paste somewhere the files in the indicated link?
    https://github.com/openbci-archive/OpenBCI_32bit_TriggerTimingTests

    Thank you!

  • GalindoGalindo México
    edited July 2021

    I've tested the solutions presented in the examples, but still missing something. I can not see changes in the sensing signal coming from the photodiode, maybe expected if there is not a graphical channel for this during the data stream. But in the output I can't find it either, only changes I notice are in Analog Channels 0,1, but the values are constant.
    Eg.
    Analog Channel, Analog Channel 1
    257, 256
    257, 256
    257,256
    I've tryed disconnecting the power to the photodiode (once it is a photodiode not a photoresistor), but can't see no changes. I've also tryed by using the "digital read" function, and pressing the PROG button on the Cyton, but no success either.!
    Am I missing something in the software?
    Thank you.


  • wjcroftwjcroft Mount Shasta, CA

    Gilberto, hi.

    Do you have a digital voltmeter? Measure what you are sending to the analog input pin in both light and dark conditions. What do you see? The analog pins can measure between 0V and 3.3V only. That voltage range is mapped to a 10 bit value from 0 to 1024.

    William

  • wjcroftwjcroft Mount Shasta, CA

    As a side note, the photos you are posting are around 7 megabytes each. Please read:

    https://openbci.com/forum/index.php?p=/discussion/comment/11483/#Comment_11483

  • GalindoGalindo México
    edited July 2021

    Thank you wjcroft,
    I've changed the photodiode for a photoresistor, as indicated https://github.com/OpenBCI/OpenBCI_Experiment.
    But I can see no changes in the stream, neither in the output values.
    Voltmeter indicates 1.4 in light mode, and 1.2 in dark mode.
    What is the output channel for D13?

    I am very sorry for the pictures, seems like I can no longer edit the comment to erase them.

  • wjcroftwjcroft Mount Shasta, CA

    Did you use the Widget in the GUI to select Analog Board Mode? There are separate controls for Analog and Digital modes.

    https://docs.openbci.com/docs/02Cyton/CytonExternal#using-the-openbci-gui

    [paragraph at above link:] Once you have connected, you may selected the "Digital Read" for one of your widgets. Then select start digital read mode button in the top left of the newly populated widget. This will activate and send the proper commands to your Cyton. Note that the accelerometer will no long be turned on because the trigger data is now sent instead.

    You mention:

    Voltmeter indicates 1.4 in light mode, and 1.2 in dark mode.

    That is not much of a difference. Should be larger. Are you sure you have the correct photo part? Even so, the analog mode would show a difference with these two values.

    William

  • wjcroftwjcroft Mount Shasta, CA

    1.4 / 3.3 * 1024 = 434
    1.2 / 3.3 * 1024 = 372

  • GalindoGalindo México

    Thank you William,
    Did you use the Widget in the GUI to select Analog Board Mode? There are separate controls for Analog and Digital modes.
    R: Yes, I've done this according to tutorial. I was expecting to see some color or value changes in the circles of the widget, but no changes.
    That is not much of a difference. Should be larger. Are you sure you have the correct photo part? Even so, the analog mode would show a difference with these two values.
    R: Agree, but I tryed with the photodiode and the photoresistor, having no changes as well.
    Thank you for the values conversion,
    In what channel of the output should I look to find these values anyway?
    Could it be something wrong with the channel?

    Thank you again.

  • wjcroftwjcroft Mount Shasta, CA

    If you are NOT seeing the analog values showing up in the widget, then likely your wiring is wrong. Yes you want the analog version of the widget. Why? Because digital mode logic expects only TWO values: zero volts for logical zero. And 3.3V for logical one. Your diode output does not produce digital values.

    Check your recording in the Aux fields. That is where the analog board mode values are stored.

  • GalindoGalindo México

    RESOLVED.
    The input for the Cyton was not D13, as indicated in: https://openbci.com/community/measuring-stimulus-timing-with-a-photoresistor/
    but D12 as indicated in picture in: https://github.com/OpenBCI/OpenBCI_Experiment
    Thank you!

  • wjcroftwjcroft Mount Shasta, CA

    From this section,

    https://docs.openbci.com/docs/02Cyton/CytonSDK#board-mode

    Analog mode is storing these pins into the three Aux values:

    Analog mode - Reads from analog pins A5(D11), A6(D12) and if no wifi shield is present, then A7(D13) as well.

    Glad that you figured it out.

Sign In or Register to comment.