A pacemaker autosense algorithm with dual thresholds. one for noise or tachyarrhythmia detection (noise threshold, NT) and the other for intrinsic beat detection (sensing threshold. ST), was developed to improve the sensing performance in single pass VDD electrograms. unipolar electrograms, or atrial fibrillation detection. When a deflection in an electrogram exceeds the NT (defined as 50% of 57), the autosense algorithm with dual thresholds checks if the deflection also exceeds the ST. If it does, the autosense algorithm calculates the signal to noise ratio (SNR) of the deflection to the highest deflection detected by NT but lower than ST during the last cardiac cycle. If the SNR 2, the autosense algorithm declares an intrinsic beat detection and calculates the next ST based on the three most recent intrinsic peaks. If the SNR $\geq$2, the autosense algorithm checks the number of deflections detected by NT during the last cardiac cycle in order to determine if it is a noise detection or tachyarrhythmia detection. Usually the autosense algorithm tries to set the 57 at 37.5% of the average of the three intrinsic beats, although it changes the percentage according to event classifications. The autosense algorithm was tested through computer simulation of atrial electrograms from 5 patients obtained during EP study, to simulate a worst sensing situation. The result showed that the ST levels for autosense algorithm tracked the electrogram amplitudes properly, providing more noise immunity whenever necessary. Also, the autosense algorithm with dual thresholds achieved sensing performance as good as the conventional fixed sensitivity method that was optimized retrospectively.