Introduction: Simple ECG Recording Circuit and LabVIEW Heart Rate Monitor

"This is not a medical device. This is for educational purposes only using simulated signals. If using this circuit for real ECG measurements, please ensure the circuit and the circuit-to-instrument connections are utilizing proper isolation techniques."

One of the most fundamental aspects of modern healthcare, is the ability to capture a heart wave using an ECG, or an electrocardiogram. This techniques uses surface electrodes to measure the various electrical patterns emitted from the heart, so that the output can be used as a diagnostic tool to diagnose heart and lung conditions such as various forms of tachycardia, branch block, and hypertrophy. To diagnose these conditions, the output waveform is compared to a normal ECG signal.

In order to create a system that can obtain the ECG waveform, the signal must first be amplified, and then appropriately filtered to remove noise. In order to do this, a three stage circuit can be built using OP amps.

This Instructable will provide the information necessary to design and then build a simple circuit capable of recording an ECG signal using surface electrodes, and then filtering that signal for further processing and analysis. In addition, this Instructable will outline one technique used to analyze that signal in order to create a graphical representation of the circuit output, as well as a method for calculating the heart rate from the ECG waveform circuit output.

Note: when designing each stage, be sure to perform AC sweeps both experimentally, and through simulations to ensure desired circuit behavior.

Step 1: Design and Construct the Instrumentation Amplifier

The first stage in this ECG circuit is an instrumentation amplifier, which consists of three OP amps. The first two OP amps are buffered inputs, which are then fed into a third OP amp which functions as a differential amplifier. The signals from the body must be buffered or else the output will diminish since the body cannot provide much current. The differential amp is taking the difference between the two input sources to provide a measurable potential difference, while simultaneously canceling out the common noise. This stage also has a gain of 1000, amplifying the typical mV to a more readable voltage.

The circuit gain of 1000 for the instrumentation amplifier is calculated by the equations shown. The stage 1 gain of the instrumentation amplifier is calculated by (2), and the stage 2 gain of the instrumentation amplifier is calculated by (3). K1 and K2 were calculated so that they didn’t differ from each other by more than a value of 15.

For a gain of 1000, K1 could be set to 40 and K2 could be set to 25. The resistor values can all be calculated, but this particular instrumentation amplifier used the resistor values below:

R1 = 40 kΩ

R2 = 780 kΩ

R3 = 4 kΩ

R4 = 100 kΩ

Step 2: Design and Construct the Notch Filter

The next stage is a notch filter to remove the 60 Hz signal that comes from the power outlet.

In the notch filter, the resistor value of R1 is calculated by (4), the value of R2 by (5), and the value of R3 by (6). The quality factor of the circuit, Q, is set to 8 because that gives a reasonable margin of error while being realistically accurate. The Q value can be calculated by (7). The last governing equation of the notch filter is used for calculating the bandwidth, and is described by (8). In addition to the quality factor of 8, the notch filter had other design specifications present. This filter is designed to have a gain of 1 so that it wouldn’t alter the signal, while it removes the 60 Hz signal.

According to those equations, R1 = 11.0524 kΩ, R2 = 2.829 MΩ, R3 = 11.009 kΩ, and C1 = 15 nF

Step 3: Design and Construct the 2nd Order Butterworth Low-Pass Filter

The final stage, is a low-pass filter to remove all signals that can occur above the highest frequency component of an ECG wave, such as WiFi noise, and other ambient signals that might distract from the signal of interest. The -3dB point for this stage should be around or near 150 Hz, since the standard range of signals present in an ECG wave range from 0.05 Hz to 150 Hz.

When designing the low-pass second order Butterworth filter, the circuit is again set to have a gain of 1, which allowed for a more simple circuit design. Before carrying out any further calculations, it is important to note that the desired cutoff frequency of the low pass filter is set to 150 Hz. It is easiest to begin by calculating the value of capacitor 2, C2, as other equations depend on this value. C2 can be calculated by (9). Proceeding from calculating C2, C1 can be calculated by (10). In the case of this low pass filter, the coefficients a and b are defined where a = 1.414214, and b = 1. The resistor value of R1 is calculated by (11), and the resistor value of R2 is calculated by (12).

The following values were used:

R1 = 13.842kΩ

R2 = 54.36kΩ

C1 = 38 nF

C1 = 68 nF

Step 4: Setup the LabVIEW Program Used for Data Acquisition and Analysis

Next, the computer program LabView can be utilized to create a task that will create a graphical representation of a heartbeat from an ECG signal, and calculate the heart rate from the same signal. The LabView program accomplishes this by first accepting an analog input from a DAQ board, which also acts as an analog to digital converter. This digital signal is then both further analyzed and plotted, where the plot shows the graphical representation of the signal being input into the DAQ board. The signal waveform is analyzed by taking 80% of the max values of the digital signal being accepted, and then uses a peak detector function to detect these peaks of the signal. Simultaneously, the program takes the waveform and calculates the time difference between the peaks of the waveform. The peak detection is coupled with accompanying values of either 1 or 0, where 1 represents a peak to create an index of the location of peaks, and this index is then used in conjuncture with the time difference between peaks to mathematically calculate the heart rate in beats per minute (BPM). The block diagram that was used in the LabView program is shown.

Step 5: Full Assembly

Once you have constructed all of your circuits and LabVIEW program and ensured that everything is working properly, you’re ready to record an ECG signal. Pictured is a possible schematic of the full circuit system assembly.

Connect the positive electrode to your right wrist and one of the circled instrumentation amplifier inputs, and the negative electrode to you left wrist and the other instrumentation amplifier input as pictured. The order of electrode input does not matter. Finally, place a ground electrode on your ankle, and connect to ground in your circuit. Congratulations, you have completed all steps necessary to record and ECG signal.