The Pan, Tompkins algorithm is quite simple to implement and gives reasonable results.
As far as I remember, the general ideas were something like this:
The characteristic form of the ECG is called the QRS complex, where the main burst in the ECG (the so-called "R-spike") has a clear shape, and this is what most people focus on. The R-spike is amplified by a “matched filter” (a filter with an impulse response resembling a spike). I think that after this the signal went through a differentiator. Then there was the simplest three-point search after the highest peak. I also remember that in algoritm there was a "blanking period" where the R-spike search was not performed, as the heart can beat so fast ...
Take a look at this: QRS QRS Detection (PDF)
source share