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!