The monitoring and processing of electrocardiogram (ECG) beats have been actively studied in recent years: new lines of research have even been developed to analyze ECG signals using mobile devices. Considering these trends, we proposed a simple and low computing cost algorithm to process and analyze an ECG signal. Our approach is based on the use of linear regression to segment the signal, with the goal of detecting the R point of the ECG wave and later, to separate the signal in periods for detecting P, Q, S, and T peaks. After pre-processing of ECG signal to reduce the noise, the algorithm was able to efficiently detect fiducial points, information that is transcendental for diagnosis of heart conditions using machine learning classifiers. When tested on 260 ECG records, the detection approach performed with a Sensitivity of 97.5% for Q-point and 100% for the rest of ECG peaks. Finally, we validated the robustness of our algorithm by developing an ECG sensor to register and transmit the acquired signals to a mobile device in real time.