Login processing...

Trial ends in Request Full Access Tell Your Colleague About Jove

Biomedical Engineering

Acquisition and Analysis of an ECG (electrocardiography) Signal


Source: Peiman Shahbeigi-Roodposhti and Sina Shahbazmohamadi, Biomedical Engineering Department, University of Connecticut, Storrs, Connecticut

An electrocardiograph is a graph recorded by electric potential changes occurring between electrodes placed on a patient's torso to demonstrate cardiac activity. An ECG signal tracks heart rhythm and many cardiac diseases, such as poor blood flow to the heart and structural abnormalities. The action potential created by contractions of the heart wall spreads electrical currents from the heart throughout the body. The spreading electrical currents create different potentials at points in the body, which can be sensed by electrodes placed on the skin. The electrodes are biological transducers made of metals and salts. In practice, 10 electrodes are attached to different points on the body. There is a standard procedure for acquiring and analyzing ECG signals. A typical ECG wave of a healthy individual is as follows:

Figure 1
Figure 1. ECG wave.

The "P" wave corresponds to atrial contraction, and the "QRS" complex to the contraction of the ventricles. The "QRS' complex is much larger than the "P" wave due to the relative dfference in muscle mass of the atria and ventricles, which masks the relaxation of the atria. The relaxation of the ventricles can be seen in the form of the "T" wave.

There are three main leads responsible for measuring the electrical potential difference between arms and legs, as shown in Figure 2. In this demonstration, one of the limb leads, lead I, will be examined, and the electrical potential difference between two arms will be recorded. As in all ECG lead measurements, the electrode connected to the right leg is considered the ground node. An ECG signal will be acquired using a biopotential amplifier and then displayed using instrumentation software, where a gain control will be created to adjust its amplitude. Finally, the recorded ECG will be analyzed.

Figure 2
Figure 2. ECG limb leads.


The electrocardiograph must be able to detect not only extremely weak signals ranging from 0.5 mV to 5.0 mV, but also a DC component of up to ±300 mV (resulting from the electrode-skin contact) and a common-mode component of up to 1.5 V, which results from the potential between the electrodes and the ground. The useful bandwidth of an ECG signal depends on the application and can range from 0.5-100 Hz, sometimes reaching up to 1 kHz. It is generally around 1 mV peak-to-peak in the presence of much larger external high frequency noise, 50 or 60 Hz interference, and DC electrode offset potential. Other sources of noise include movement that affects the skin-electrode interface, muscle contractions or electromyographic spikes, respiration (which may be rhythmic or sporadic), electromagnetic interference (EMI), and noise from other electronic devices that couple into the input.

First, a biopotential amplifier will be produced to process the ECG. Then, electrodes will be placed on the the patient to measure the potential difference between two arms. The main function of a biopotential amplifier is to take a weak electric signal of biological origin and increase its amplitude so that it can be further processed, recorded, or displayed.

Figure 3
Figure 3. ECG amplifier.

To be useful biologically, all biopotential amplifiers must meet certain basic requirements:

  • They must have high input impedance so that they provide minimal loading of the signal being measured. Biopotential electrodes can be affected by their load, which leads to distortion of the signal.
  • The input circuit of a biopotential amplifier must also provide protection to the subject being studied. The amplifier should have isolation and protection circuitry so that the current through the electrode circuit can be kept at safe levels.
  • The output circuit drives the load, which is usually an indicating or recording device. To obtain maximal fidelity and range in the readout, the amplifier must have low output impedance and be capable of supplying the power required by the load.
  • Biopotential amplifiers must operate in the frequency spectrum in which the biopotentials that they amplify exist. Because of the low level of such signals, it is important to limit the bandwidth of the amplifier to obtain optimal signal to noise ratios. This can be done using filters.

Figure 3 is an example of an ECG amplifier, and Figure 4 is the circuit of the ECG amplifier that is built during this demonstration. It has three main stages: the protection circuit, the instrumentation amplifier, and the high pass filter.

Figure 4
Figure 4. Biopotential amplifier.

The first stage is the patient protection circuitry. A diode is a semiconductor device that conducts current in one direction. When a diode is forward-biased, the diode acts as a short circuit and conducts electricity. When a diode is reverse-biased, it acts as an open circuit and does not conduct electricity, Ir ≈ 0.

When diodes are in the forward-biased configuration there is a voltage known as the threshold voltage (VT = approximately 0.7 V) that must be exceeded in order for the diode to conduct current. Once the VT has been exceeded, the voltage drop across the diode will remain constant at VT regardless of what Vin is.

When the diode is reverse-biased the diode will act as on open circuit and the voltage drop across the diode will be equal to Vin.

Figure 5 is an example of a simple protection circuit based on diodes that will be used in this demonstration. The resistor is used to limit the current flowing through the patient. If a fault in the instrumentation amplifier or diodes short-circuits the patient's connection with one of the power rails, the current would be less than 0.11 mA. The FDH333 low-leakage diodes are used to protect the inputs of the instrumentation amplifier. Whenever the voltage in the circuit exceeds 0.8 V in magnitude, the diodes change to their active region or "ON" state; the current flows through them and protects both the patient and the electronic components.

Figure 6
Figure 5. Protection circuit.

The second stage is the instrumentation amplifier, IA, which uses three operational amplifiers (op-amp). There is one op-amp attached to each input to increase the input resistance. The third op-amp is a differential amplifier. This configuration has the ability to reject ground-referred interference and only amplify the difference between the input signals.

Figure 7
Figure 6. Instrumentation amplifier.

The third stage is the high pass filter, which is used to amplify a small AC voltage that rides on top of a large DC voltage. The ECG is affected by low frequency signals that come from patient movement and respiration. A high pass filter reduces this noise.

High pass filters can be realized with first-order RC circuits. Figure 7 shows an example of a first order high-pass filter and its transfer function. The cut-off frequency is given by the following formula:

Equation 1Equation 2
Equation 3  Figure 8
Figure 9

Figure 7. High pass filter.


1. Acquiring an ECG Signal

  1. Adjust the voltage of the sources to +5 V and -5 V and connect them in series.
  2. Build the circuit shown in Figure 4. Calculate the values of the resistors and capacitors. For the high pass filter, the cut-off frequency should be 0.5 Hz. The capacitor value should be chosen from the table below (according to availability).
Available Capacitor Values (µF )
0.001 1 100
0.022 2.2 220
0.047 4.7 470
0.01 10 1000
0.1 47 2200

Equation 4

  1. Place electrodes on the right arm, left arm and right leg (this is reference) of the patient, and connect them to the circuit.
  2. Use the oscilloscope to view the ECG signal (Vo). Press Auto Set and adjust the horizontal and vertical scales as needed. You should be able to see the R peaks despite of the noise in the signal.

2. Displaying the ECG signal using Instrumention Software

  1. In this demonstration we used LabVIEW. Write a program that displays the ECG signal using a graphical interface for configuring measurements and a waveform graph. Once an analog input has been selected, configure the program with the following settings:
  • Signal input range >> Max = 0.5; Min = -0.5
  • Terminal Configuration >> RSE
  • Acquisition mode >> continuous
  • Samples to read = 2000
  • Sampling rate = 1000
  1. Acquire the ECG signal and observe the waveform. You will see a signal similar to Figure 1.
  2. Adjust the scale of the x-axis to show time in seconds.
  3. It is often necessary in instrumentation to amplify the signal of interest to a specific amplitude. Create a gain control and set it so that the amplitude of the ECG is 2 Vp.

3. Analyzing the ECG signal

In this section, an ECG signal will be filtered and analyzed to determine the heart rate. The following block diagram shows the components of the program.
Figure 10

  1. Use a waveform graph to display the signal.
  2. Evaluate the spectrum of the signal using the Amplitude and phase spectrum subvi (in Signal processing → Spectral) and display its magnitude using a waveform graph. The horizontal axis corresponds to frequency. It is discrete because the computer uses a Fast Fourier Transform (FFT) algorithm to calculate the spectrum of the signal. The frequency goes from k = 0 to k = (N-1)/2, where N is the length of the sequence, in this case 4000. To calculate the corresponding analog frequency, use the following formula:
    Equation 5
    where fs is the sampling frequency. Note that most of the energy of the signal is in the low frequency range and also that there is a peak of high intensity in the medium frequency range. Calculate the frequency of that peak using the formula provided above.
  3. Implement a low-pass filter using Butterworth of Chebyshev functions. Choose a cut-off frequency equal to 100 Hz. Make sure that the filter provides an attenuation of at least -60 dB/decade in the stopband.
  4. Connect the output signal of the read from spreadsheet subvi to the input of the low-pass filter.
  5. Implement a stop-band filter using Butterworth or Chebyshev functions. The objective is to reduce the 60 Hz interference without modifying the other frequencies. Try border frequencies close to 60 Hz.
  6. Connect the output of the lowpass filter to the input of the stopband filter.
  7. Find the peaks using the peak detector subvi (it is located in Signal processing → Sig Operation). For the threshold, look at the signal's amplitude and choose the most appropriate value.
  8. Extract the locations of the peaks using the index array subvi (in Programming → Array).
  9. Subtract the lower position from higher position, then, multiply by the sampling period T = 1/fs to obtain the RR interval.
  10. Calculate the reciprocal and adjust units and place an indicator to display the BPM.

Electrocardiographs record cardiac activity of the heart and are used to diagnose disease, detect abnormalities, and learn about overall heart function. Electrical signals are produced by contractions in the heart walls which drive electrical currents and create different potentials throughout the body. By placing electrodes on the skin, one can detect and record this electrical activity in an ECG. ECGs are non-invasive, making them a useful tool to assess how well a patients heart is performing, such as by measuring how well blood flows to the organ.

This video will illustrate the principals of ECGs and demonstrate how to acquire, process, and analyze a typical ECG signal using a biopotential amplifier. Other biomedical applications that utilize electrical signal processing to diagnose disease will also be discussed.

To understand the principles of an ECG, let's first understand how the heart produces electrical signals. For a normal, healthy heart, at rest, an ECG displays a series of waves that reflect the different phases of a heartbeat. The ECG starts in the sinoatrial node, also known as the SA node, which is located in the right atrium and acts as a pacemaker in the heart. The electrical signals cause atrial contraction forcing blood into the ventricles. This sequence is recorded as the P wave on the ECG. This signal then passes from the atria across the ventricles, causing them to contract and pump blood to the rest of the body. This is recorded as the QRS complex.

Finally, the ventricles relax and this is recorded as the T wave. The process then begins again and is repeated for every heartbeat. Notice that the QRS wave is much larger than the P wave, this is because the ventricles are larger than the atria. Meaning they mask the relaxation of the atria or the T wave. Other processes in the body, like respiration or muscle contractions, can interfere with the ECG measurement. As can currents from the circuitry used to obtain them. Often, the electrical signals that the ECG is attempting to record are quite weak. Therefor, a biopotential amplifier is used to increase their amplitude which allows them to be further processed and recorded.

There are three main components to the biopotential amplifier, the patient protection stage, the instrumentation amplifier, and the high pass filter. As the main suggests, the patient protection circuit uses a combination of resistors and diodes to protect, both, the patient and the machine and equipment. The resistors limit the current that flows through the patient, where as the diodes keep the current flowing in the correct direction.

The next stage is the instrumentation amplifier, which amplifies the difference between the inputs from each electrode. It is composed of three operational amplifiers. Two to increase the resistance from each input, and the third to amplify the difference between the input signals.

The last stage is the high pass filter, which reduces the noise and filters out low frequency signals arising from patient movement or respiration. Now that you know how an ECG is measured, let's see how to construct a biopotential amplifier and process the data to get a clean ECG signal.

Having reviewed the main principals of electrocardiography, let's see how to build a biopotential amplifier and acquire an ECG signal. To begin, first gather a proto-board, an AD-620 instrumentation amplifier, and all necessary circuit components. Then, calculate the values of all of the resistors and capacitors in the circuit using the following equation.

For the high pass filter, the cut off frequency should be 0.5 hertz.

Then, plug in the capacitor value to determine the resistance. Next, build a biopotential amplifier according to the provided diagram. Here is what the final circuit should look like. Attach three wires with alligator clips to the binding posts of a DC power supply, then turn on the power source. Adjust the voltage to plus five volts and minus five volts, and connect the the wires, in series, to the circuit.

Now, use an alcohol prep pad to wipe the patients right wrist, left wrist, and right ankle. Add conductive adhesive gel to the electrodes before placing them on the patient. Then, connect the electrodes to the circuit using wires with alligator clips. Turn on the oscilloscope and acquire the ECG signal. Adjust the horizontal and vertical scales as needed. With these adjustments, you should be able to see the R peak of the wave form.

Connect the circuit to the PXI chassis, then open the instrumentation software and, either, use or write a program that will display the ECG signal and a wave form graph.

Configure the data acquisition interface with the following settings. Label the scale of the x-axis to display time and seconds, then display the ECG signal as a waveform. If the signal needs to be amplified, create a gain control and set it so that the amplitude of the ECG is two VP.

Now that we have demonstrated how to acquire an ECG signal, let's see how to analyze the results. Here is a representative ECG signal. The P, QRS, and T waves are barely discernible because they are obscured by noise and fluctuations. This signal needs to be filtered. To transform this signal, first, select Signal Processing then Spectral on the menu. A Fast Fourier Transform algorithm calculates and plots the spectrum of the signal displaying the frequency as discreet values on the horizontal axis. Most of the energy in the signal is at low frequencies.

But, there is a high intensity peak in the medium frequency range, which is assumed to be noise. Frequency is plotted as k on the horizontal axis and goes from zero to N minus one over two, where N is the length of the sequence. For this experiment, N equals 2,000. Calculate the analog frequency for each k value using the following equation, where f s is the sampling frequency and determine the frequency of the high intensity peak based on the FFT graph.

Then, create a low pass filter with a cutoff frequency of 100 hertz. Use, either, the Butterworth or Chebyshev function to filter the signal, which should attenuate at least 60 decibels per decade in the stop band. Connect the output signal of the data sub VI to the input of the low pass filter. This filter removes the extraneous high frequency waves of the ECG. Now, create a Bandstop filter and set the cutoff frequencies at around 55 and 70 hertz.

To remove the noisy signal, around 60 hertz. Then, connect the output of the low pass filter to the input of the Bandstop filter. Try border frequencies that are close to 60 hertz. This will reduce interference without effecting other frequencies. The ECG signal should now be clear with distinct P, QRS, and T complexes.

Now, let's determine the heart rate using the filtered ECG signal. First, use the peak detector sub VI to find the peaks of the signal. Choose the most appropriate value based on the signals amplitude of the R wave for the threshold. Then, use the Index Array sub VI to determine the location of the peaks.

Subtract the lower peak position from the higher position, then multiply this value by the sampling period, T, which is equal to one over f s. This value is the length of time between two R waves. Adjust the units to determine the beats per minute.

In this demonstration, the measured heart rate was approximately 60 beats per minute.

ECG and signal processing have important applications in, both, medicine and research. In addition to being non-invasive, ECGs are relatively inexpensive. Making it a useful and accessible tool in hospitals. ECGs can even be adapted to more complex and longterm monitoring of patients who are being treated for Acute Coronary Syndrome.

For this, 12 ECG leads are used, which can identify transient myocardial ischemia in asymptomatic patients. Signal sampling and processing is also used in electroencephalography to measure electrical signals from the brain. EEGs are commonly used in conjunction with functional MRI as a multimodal imaging technique.

The method noninvasively generates cortical maps of brain activity for many neuroimaging applications, such as after visual or motor activation.

You've just watched Jove's introduction to acquiring and analyzing ECG signals. You should now understand how an ECG signal is produced and how to create a biopotential amplifier to detect weak electrical signals. You have also seen some biomedical applications of signal processing for medical diagnosis.

Thanks for watching.


In this demonstration, three electrodes were connected to an individual, and the output passed through a biopotential amplifier. A sample ECG graph prior to digital filtering is shown below (Figure 8).

Figure 13
Figure 8. ECG signal without digital filtering.

After designing the filters and feeding the data to the developed algorithm, the peaks on the graph were detected and used to calculate heart beat rate (BPM). Figure 9 displays the raw data an ECG signal (before any filtering) in time and frequency domain. Figure 10 shows the result of filtering that signal.

Figure 11

Figure 9. ECG signal before filtering.

Figure 14
Figure 10. Filtered ECG signal.

The original ECG plot had slightly visible P, QRS, and T complexes that presented many fluctuations from the noise. The spectrum of the ECG signal also showed a clear spike at 65 Hz, which was assumed to be noise. When the signal was processed using a low-pass filter to remove extraneous high frequency portions and then a band-stop filter to remove the 65 Hz signal component, the output appeared significantly cleaner. The ECG shows each component of the signal clearly with all noise removed.

In addition, the measured heart rate was approximately 61.8609 beats per minute.

Applications and Summary

Contraction of cardiac muscle during the heart cycle produces electric currents within the thorax. Voltage drops across resistive tissue are detected by electrodes placed on the skin and recorded by an electrocardiograph. Since the voltage is weak, in the range of 0.5 mV, and small compared to the magnitude of noise, processing and filtering the signal is necessary. In this experiment, an electrocardiograph device consisting of a two part analog and digital signal processing circuit was designed to analyzing the resulting ECG signal, and calculate the heartbeat rate.

This demonstration introduced the fundamentals of electronic circuitry and filtering of ECG signals. Here, practical signal processing techniques were used to extract a weak signal from a noisy background. These techniques can be used in other similar applications where signal amplification and noise reduction is required.

Materials List

Name Company Catalog Number Comments
Power supply B&K Precision 1760A
4 FDH333 diodes
1 AD620
3 47k resistor
2 100nF capacitors
3 ECG electrodes
Several alligator clips and Tektronix probe.
Acquisition and Analysis of an ECG (electrocardiography) Signal
Play Video
View Video

Get cutting-edge science videos from JoVE sent straight to your inbox every month.

Waiting X
simple hit counter