The heart functions to pump blood to the lungs and the body. In order to pump, the heart requires an electrical impulse just like any other muscle in the body. The electricity for the heart originates from the sinus node in the upper right corner of the right atrium. Electricity then spreads across both atria before reaching the AV node where it momentarily pauses. From the AV node, electricity then rapidly passes through the right and left bundle branches to reach the ventricles. As electricity passes through the ventricles, the muscle is stimulated to contract.
The sinus node is the pacemaker for the heart. The heart rate depends on how fast the sinus node fires. Many things can affect the firing of the sinus node. Adrenaline, the hormone the body releases in response to exercise, stress, or emotion, typically causes the sinus node to fire faster and the heart rate to increase. Other nerves can cause the heart rate to slow down, for example during sleep.