ECG (also called EKG) signal measures the electrical control signals from the sympathetic and para-sympathetic nervous systems that regulate heart beat. If measured at suitable location, it also provides useful signals on inhaling (excitation) and exhaling (relaxation) phases of breathing. For medical diagnoses and treatments, please be directed to medical professionals. Here we only provide simplified descriptions.
Unlike the steady average pulse/heart rate (averaged over a few minutes), the instantaneous heart rate (HR) from beat to beat does change significantly, and is modulated by breathing phases. The instantaneous heart rate variation (HRV) provides useful indicators for body's involuntary self-regulation conditions, as well as voluntary training of breathing exercises. Whenever higher energy consumption is required, such as excitation of brain (including REM dreaming) or body activities, the HR will raise rapidly to provide increased blood flow and oxygen to desired locations. Therefore HRV patterns provides good correlation to many sleep stages, including the REM dreaming stage.
HRV is tightly related to the workings of autonomic nervous system (ANS). The organs (the "viscera") of our body, such as the heart, stomach and intestines, are regulated by a part of the nervous system called the autonomic nervous system (ANS). The ANS is part of the peripheral nervous system and it controls many organs and muscles within the body. In most situations, we are unaware of the workings of the ANS because it functions in an involuntary, reflexive manner. For example, we do not notice when blood vessels change size or when our heart beats faster. However, some people can be trained to control some functions of the ANS such as heart rate or blood pressure. The ANS is most important in two situations:
1) In emergencies that cause stress and require us to "fight" or take "flight" (run away)
2) In nonemergencies that allow us to "rest" and "digest."
For more fun and insightful readings, follow these links below. http://faculty.washington.edu/chudler/auto.html
Some interesting research work has correlated HRV with emotional states and heart-brain coherence, and proposed methods and techniques to manage and improve our own well-being. You may do Google search yourself, or follow the links below for more free information. http://www.heartmath.org/research/science-of-the-heart/introduction.html
Example ECG(HRV): dramatic RR (inverse of Heart Rate in BPM) changes during sleep and other activities.