As health care becomes popular, daily monitoring of health-status related parameters, including the heart rate (HR), is getting more and more valued. An easy, comfortable and robust solution is therefore an important issue. Phonocardiogram (PCG) is a physiological signal reflecting the cardiovascular status. It could be recorded by microphone-equipped on-hand devices, like the smartphone, even without direct skin contact. However, high inter- and intra-variance of PCG make its processing challenging. For PCG-based HR measurement, a robust method is still strongly required. In this paper, we propose a HR measurement algorithm on the processing of PCG that uses on-line template extraction and matching. Through several experiments where traditional methods cannot effectively handle, the robustness of our method is verified by its accurate HR measurement results.