The invention relates to an optical device for measuring a heart rate of a user. Said optical device comprises: —two light sources (1,2) for emitting light into the skin of the user, —a sensor (3) for sensing the light signals emitted by each of the two light sources and reflected through the skin of the user so as to determine the heart rate of the user. The two light sources (1,2) are situated at different distances from the sensor such that the light signals received from each of the two light sources have a different penetration depth into the skin.