The heartbeat sensor consist of two major parts, one is a LED light and other is light sensor. The LED emits light on the finger and the light sensor senses the intensity of returned light. The light usually passes through the finger, unless the heart is pumping the blood through it. When the blood passes through the finger, it acts as a opaque layer and the intensity of light passing through becomes less, but the LED has to be super bright in order to this to work. The LED works as a Infrared emitter and the light sensor works as receiver. Now as to measure the heartbeat, the light sensor figures out the fluctuating intensity emitted light of and form a pattern, and this pattern gets converted into an electric pulse. This electric pulse gives an output of +5V logic level signal through a amplifier thus making the output LED to blink. Hence the output LED blinks on each heartbeat, giving us data to measure the heartbeat rate.