There are several heart rate detection and display designs in the BrainBay example configuration files, but I have found that the technique that they use to detect heart rate — a threshold element that goes into a counter — is a bit problematic. On the sample data I tested with, I wasn’t able to tweak the threshold value so that it would both avoid false positives and catch all of the target signal spikes, because the amplitude of the signal was varying over time.
I tested an alternate design, with a 5-sample delay on a copy of the signal, and then an addition and comparator. This approximately measures the rate of change of the signal, and detects when it is above a certain range, triggering a threshold event and a frequency timer. It seems to be much more robust and capable of detecting the target in a noisy signal than the techniques in the sample BrainBay config files, at least on the data I was testing with. Here’s the .con file if anyone else wants to try it out: openbci_ekg_brainbay_heart_rate5.con (10.3 KB)
Eventually I’d like to include this in a bio/neurofeedback setup, but for now I’m just experimenting and learning about how the signal processing works.
One other issue I ran into is that the threshold element can only be adjusted using a GUI slider. Unfortunately the slider range seems to be set based on the total signal range, so for a signal with some motion artifacts in it, the range was so huge I couldn’t set the slider in increments of less than 375! My work around was to open the BrainBay .con file in a text editor, find the threshold element, and manually set the slider values as text.
What techniques have you used for detecting heart rate?