Hmm, 300ms is 1/3 of a second. 900ms is almost a complete second. Your trigger event time is indicated by the leading edge of the trigger signal, not the LENGTH of the trigger. I don't understand. Are you looking at things with a scope?
It's possible the series resistor I suggested is too large and is not being registered immediately on the leading edge at the PIC32 GPIO pin. I only suggested it in case there might be some capacitive / inductive coupling between your trigger wire and your EEG wires. Try removing the resistor. See if there is any coupling. If no noise in your EEG channels, then you can leave it out. If there is some noise, use the lowest possible resistor value you can, to reduce the current flowing in that wire.
Trigger events are signaled by the ON transition of the trigger wire. NOT by the length. As long as your software can detect the leading edge, that is all that matters. Length of trigger (as long as it is at least a few sample times), should not matter. 900ms trigger length does not make sense. Unless there is some odd thing involving the series resistor.
Please try removing the suggested series resistor and see if that works. Your length of trigger pulse should be irrelevant, as long as it is registered by a few sample times. If noise appears in the EEG channels, use the lowest possible resistor that reduces current flow in the trigger wire.
Rafia, hi. I just ran across a comment (by chance) on our internal staff Slack channel by Richard @retiutut. From early October. He is seeing some odd delays with the Cyton PIC32 Digital Read Mode, that have some similarity to what you are seeing. Asked him on Slack to comment. There could be some firmware glitches that are causing distortion of the Cyton Digital Read values. So your comment about 900ms trigger length, could be a sign you are experiencing what he did.
Here's a possible workaround, if it is the case that the Digital Read Mode for Cyton PIC32 pins, has distortion: just change over to using Analog Read Mode.
Hi William and @faheemersh,
I didn't connect any external resistance for digital external trigger.
Without trigger, eeg on c3 and c4 is around 10uv(rms)-84 uv(rms).
While, triggers are connected on D17and D18, on the GUI showing c3 and c4 is around 50uv(rms)-120 uv(rms).
But on the csv file it is showing 4 to 5 digit value . I am confused with this. Same with "EEGLab".
There may be some distortion in using "digital read mode" for the PIC32 input pins. Please switch over to analog read mode. Then do some signal processing on the Aux channel values: for example PIC ADC values less than threshold X equals trigger off. ADC values higher than threshold Y equals trigger pulse on.
I don't understand what you are getting at with the attachments. eeg4 looks like tons of mains noise. eeg3 is just showing the normal DC offsets present on Cyton. You must remove these with a high pass or bandpass filter.
As usual, things are getting more and more confusing.
"Then do some signal processing on the Aux channel values: for example PIC ADC values less than threshold X equals trigger off."
Where and how to do this ?
The "signal processing" is extremely simple. Just apply two thresholds as I already mentioned. The analog read mode values from the PIC pins, are stored in the same locations (Aux channels) as were the simple digital values. Digital values were either 0 or 1. Analog values will be in a range where low value is closer to zero, and high value is closer to max 16 (or 15) bit number representation.
My Professor suggesting to use D11/D12 for external trigger. These are suitable for both analog and digital input, right? Do I need to do any extra wiring to connect digital trigger at D12/D 13?
There may be some distortion in using "digital read mode" for the PIC32 input pins. Please switch over to analog read mode. Then do some signal processing on the Aux channel values: for example PIC ADC values less than threshold X equals trigger off. ADC values higher than threshold Y equals trigger pulse on.
Recall that we are now suggesting you connect the trigger in "analog read mode", NOT in "digital read mode". There is no extra wiring required, just connect your trigger source to the PIC32 pin, and ground to GND. These two lines are the source of your 'analog' trigger. If you happen to see noise pulses in the EEG channels corresponding to your trigger times, then try putting a resistor in series with the trigger line. I've mentioned this numerous times already.
Because the trigger values will now appear as analog ADC readouts (based on 0V to 3.3V scale), you apply a simple threshold to determine if your trigger is in the on or off state.
Richard @retiutut just tried a test wiring his digital trigger from an Arduino to Cyton, using the opto isolator as shown at the end of the external trigger doc.
This works just fine with no distortion using the Aux channel "digital read mode".
The opto-isolator produces a VERY solid logic level. based on Cyton voltages. Wiring directly from another Arduino to Cyton (with trigger and ground), may not hit exactly 0V and 3.3V to be detected correctly by Cyton. I would have thought there would be some ‘slack’ in terms of thresholds, for example 0V to 1V == false. 2V to 3.3V == true. But this may not be the case. This is my guess as to why the tests that Richard and Rafia did with your Arduinos (with no opto isolator), gave intermittent digital read results. Direct wiring of trigger would appear to be possible, but PIC may demand tighter voltage tolerances.
I can confirm @wjcroft's result using the OptoIsolator circuit with electrodes attached!
Note: Artifacts may appear in channels that are not connected properly or not connected at all. In all channels where there is a solid connection, there are no observable distortions or artifacts!
Another Note: It seems you have a choice of using Digital Mode or Analog Mode with the isolator circuit. Both will work fine, so I would stick with digital mode since it is a simple 0 or 1. In this example, I have D11 connected. No jitters or jumping, just a solid on or off message at the right time. Channels 10 and 11 were not connected to my head very well, which is why Ch10 is off, and why we see artifacts in Ch11.
Comments
Hmm, 300ms is 1/3 of a second. 900ms is almost a complete second. Your trigger event time is indicated by the leading edge of the trigger signal, not the LENGTH of the trigger. I don't understand. Are you looking at things with a scope?
It's possible the series resistor I suggested is too large and is not being registered immediately on the leading edge at the PIC32 GPIO pin. I only suggested it in case there might be some capacitive / inductive coupling between your trigger wire and your EEG wires. Try removing the resistor. See if there is any coupling. If no noise in your EEG channels, then you can leave it out. If there is some noise, use the lowest possible resistor value you can, to reduce the current flowing in that wire.
Are you looking at things with a scope? yes, with scope.
Trigger events are signaled by the ON transition of the trigger wire. NOT by the length. As long as your software can detect the leading edge, that is all that matters. Length of trigger (as long as it is at least a few sample times), should not matter. 900ms trigger length does not make sense. Unless there is some odd thing involving the series resistor.
Please try removing the suggested series resistor and see if that works. Your length of trigger pulse should be irrelevant, as long as it is registered by a few sample times. If noise appears in the EEG channels, use the lowest possible resistor that reduces current flow in the trigger wire.
Rafia, hi. I just ran across a comment (by chance) on our internal staff Slack channel by Richard @retiutut. From early October. He is seeing some odd delays with the Cyton PIC32 Digital Read Mode, that have some similarity to what you are seeing. Asked him on Slack to comment. There could be some firmware glitches that are causing distortion of the Cyton Digital Read values. So your comment about 900ms trigger length, could be a sign you are experiencing what he did.
Here's a possible workaround, if it is the case that the Digital Read Mode for Cyton PIC32 pins, has distortion: just change over to using Analog Read Mode.
Hi William and @faheemersh,
I didn't connect any external resistance for digital external trigger.
Without trigger, eeg on c3 and c4 is around 10uv(rms)-84 uv(rms).
While, triggers are connected on D17and D18, on the GUI showing c3 and c4 is around 50uv(rms)-120 uv(rms).
But on the csv file it is showing 4 to 5 digit value . I am confused with this. Same with "EEGLab".
There may be some distortion in using "digital read mode" for the PIC32 input pins. Please switch over to analog read mode. Then do some signal processing on the Aux channel values: for example PIC ADC values less than threshold X equals trigger off. ADC values higher than threshold Y equals trigger pulse on.
I don't understand what you are getting at with the attachments. eeg4 looks like tons of mains noise. eeg3 is just showing the normal DC offsets present on Cyton. You must remove these with a high pass or bandpass filter.
As usual, things are getting more and more confusing.
"Then do some signal processing on the Aux channel values: for example PIC ADC values less than threshold X equals trigger off."
Where and how to do this ?
The "signal processing" is extremely simple. Just apply two thresholds as I already mentioned. The analog read mode values from the PIC pins, are stored in the same locations (Aux channels) as were the simple digital values. Digital values were either 0 or 1. Analog values will be in a range where low value is closer to zero, and high value is closer to max 16 (or 15) bit number representation.
Hi,
I just read the followig link.
https://openbci.com/forum/index.php?p=/discussion/201/large-millivolt-data-values-fbeeg-full-band-eeg#latest
Do you my csv file large data is also a matter of DC offset ?
Yes, you must remove the millivolt DC offset. This is either done with a high pass at say .5 Hz or a bandpass say from .5 Hz to 45 Hz.
My Professor suggesting to use D11/D12 for external trigger. These are suitable for both analog and digital input, right? Do I need to do any extra wiring to connect digital trigger at D12/D 13?
There may be some distortion in using "digital read mode" for the PIC32 input pins. Please switch over to analog read mode. Then do some signal processing on the Aux channel values: for example PIC ADC values less than threshold X equals trigger off. ADC values higher than threshold Y equals trigger pulse on.
Do I need to do any extra wiring to connect digital trigger at D12/D 13?
Recall that we are now suggesting you connect the trigger in "analog read mode", NOT in "digital read mode". There is no extra wiring required, just connect your trigger source to the PIC32 pin, and ground to GND. These two lines are the source of your 'analog' trigger. If you happen to see noise pulses in the EEG channels corresponding to your trigger times, then try putting a resistor in series with the trigger line. I've mentioned this numerous times already.
Because the trigger values will now appear as analog ADC readouts (based on 0V to 3.3V scale), you apply a simple threshold to determine if your trigger is in the on or off state.
Richard @retiutut just tried a test wiring his digital trigger from an Arduino to Cyton, using the opto isolator as shown at the end of the external trigger doc.
https://docs.openbci.com/docs/02Cyton/CytonExternal#optoisolation
This works just fine with no distortion using the Aux channel "digital read mode".
The opto-isolator produces a VERY solid logic level. based on Cyton voltages. Wiring directly from another Arduino to Cyton (with trigger and ground), may not hit exactly 0V and 3.3V to be detected correctly by Cyton. I would have thought there would be some ‘slack’ in terms of thresholds, for example 0V to 1V == false. 2V to 3.3V == true. But this may not be the case. This is my guess as to why the tests that Richard and Rafia did with your Arduinos (with no opto isolator), gave intermittent digital read results. Direct wiring of trigger would appear to be possible, but PIC may demand tighter voltage tolerances.
I can confirm @wjcroft's result using the OptoIsolator circuit with electrodes attached!
Note: Artifacts may appear in channels that are not connected properly or not connected at all. In all channels where there is a solid connection, there are no observable distortions or artifacts!
Another Note: It seems you have a choice of using Digital Mode or Analog Mode with the isolator circuit. Both will work fine, so I would stick with digital mode since it is a simple 0 or 1. In this example, I have D11 connected. No jitters or jumping, just a solid on or off message at the right time. Channels 10 and 11 were not connected to my head very well, which is why Ch10 is off, and why we see artifacts in Ch11.