This document presents a novel algorithm for automated detection of heartbeats in an electrocardiogram (ECG) signal using morphological filtering and Daubechies wavelet transform. The algorithm consists of three stages: 1) preprocessing using mathematical morphology operations to remove noise and baseline wander, 2) Daubechies wavelet transform decomposition to facilitate heartbeat detection, and 3) feature extraction to identify the QRS complex and detect heartbeats by analyzing the wavelet coefficients. Morphological filtering preserves the original ECG signal shape while removing impulsive noise, and wavelet transform aids in analyzing the non-stationary ECG signal. The algorithm aims to provide accurate and reliable heartbeat detection for diagnosing cardiac conditions.