Electronics > Projects, Designs, and Technical Stuff
Trigger signal in software like an oscilloscope
(1/2) > >>
bushjavier:
Hi

I am working on a C software running on a BeagleBone Black to capture data from a USB DAQ. The data acquisition is working ok, I am sampling at 1M samples per second for x amount of seconds, so right now i have all the samples in a array in memory. In my requirements i need to split that signal in cycles using a trigger level in volts exactly like an oscilloscope, the problem is my algorithm is having problems when the signal is noisy is not detecting correctly the index in the array where i need to "trigger". My background is in software so I do not have any experience in signal processing.


The algorithm try to detect the rising edge of the signal when the samples go above the trigger level, also for more robustness i am getting like 10 samples in a sliding window and doing a linear regression of the points in the whole window so if the slope is positive I am on a rising edge, if the slope is negative I discard the index. After some testing my naive approach is having problems with the noise, so I need a better way to trigger the signal i appreciate if someone could help me with some ideas or code (java, matlab, c, c++, pseudocode, does not matter) to trigger and split my signal correctly, attach is an example how the signal looks like.

Thanks!
_Wim_:
What is exactly your problem, are you also triggering on the negative edge around the trigger level?

If yes, you could add some hysteresis, where you first remember the sample where the trigger level was crossed, but only consider it as a rising edge if in the next "n" samples a level is reached equal to the trigger level + hysteresis.
bushjavier:
 _Wim_ I am triggering only on the rising edge of the signal, you think that with only adding some hysteresis when the trigger level was crossed is sufficient to have a robust rising edge triggering in my software?
DaJMasta:
Well a precision hardware edge trigger is typically a fast comparator and a threshold voltage, so I think it is likely to be effective.  For hysteresis you have all sorts of options in software, but two easy options would be to trigger at a level and then check the next few samples to see if they stay over/under the trigger level (for rising or falling), and if you get one that isn't, you just restart the check at the next point past the trigger level.  You could also have a primary trigger level and a secondary one, so that only when you pass the secondary trigger does the first one get counted as a trigger point.  You could, of course, do a bunch of data processing on the raw values before feeding them into either, but software triggers can effectively have arbitrarily complex evaluations so long as the system can keep up with the number of waveforms needed per second.
_Wim_:

--- Quote from: bushjavier on November 30, 2018, 05:35:56 pm --- _Wim_ I am triggering only on the rising edge of the signal, you think that with only adding some hysteresis when the trigger level was crossed is sufficient to have a robust rising edge triggering in my software?

--- End quote ---

Hi bushjavier, want I meant was what exactly is your problem currently with the noise signal. Do you have too much jitter when triggering, or is it triggering both on rising and falling edges. The hysteresis will not help for the jitter (for that it is probably better to low pass the signal first by making a moving average and then set your trigger of the result of the moving average).
Navigation
Message Index
Next page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod