Introduction: ECG and Heart Rate Digital Monitor
An electrocardiogram,or ECG, is a very old method of measuring and analyzing heart health. The signal that is read from an ECG can indicate a healthy heart or a range of problems. A reliable and accurate design is important because if the ECG signal shows a deformed waveform or incorrect heartbeat, a person may be misdiagnosed. The goal is to design an ECG circuit that is able to acquire, amplify and filter the ECG signal. Then, convert that signal through an A/D converter into Labview to produce a real-time graph and heartbeat in BPM of the ECG signal. The output waveform should look like this image.
"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."
Step 1: Designing the Circuit
The circuit needs to be capable of acquiring and amplifying an ECG signal. In order to do that, we will combine three active filters; an Instrumentation Amplifier, a Second Order Butterworth Low-Pass filter and a Notch Filter. The design of these circuits can be seen in the images. We will go though them one at a time, then put them together to complete the full circuit.
Step 2: Instrumentation Amplifier
The gain of the instrumentation amplifier needs to be 1000 V/V in order to get a good signal. Amplification through the instrumentation amplifier happens in two stages. The first stage consists of the two op amps on the left and resistor R1 and R2 and the second stage of amplification consists of the op amp on the right and resistors R3 and R4. The gain (amplification) for stage 1 and stage 2 are given in equation (1) and (2).
Stage 1 Gain: K1 = 1 + (2R2/R1) (1)
Stage 2 Gain: K2 = R4/R3 (2)
An important note about gain in circuits is that is multiplicative; e.g. the gain of the overall circuit in Figure 2 is K1*K2. These equations produce the values shown in the schematic. The materials needed for this filter are three LM741 op amps, three 1k ohm resistors, two 24.7 kohm resistors and two 20 kohm resistors.
Step 3: Notch Filter
The next stage is a Notch Filter to cut out noise at 60 Hz. This frequency needs to be cut out because there is lots of extra noise at 60 Hz due to power line interference, but it will not take out anything significant from the ECG signal. The values for the components used in the circuit are based on the frequency you want filtered out, in this case 60 Hz (377 rad/s). The component equations are as follows
R1= 1/ (6032*C)
R2= 16 / (377*C)
R3 = (R1R2)/ (R1 + R2)
The materials required for this were one LM741 op amp, three resistors with values 1658 ohm, 424.4 kohm and 1651 ohms and 3 capacitors, two at 100 nF and one at 200 nF.
Step 4: Low Pass Filter
The final stage is a Second Order Butterworth Low-pass filter with a cutoff frequency of 250 Hz. This the the cutoff frequency because a ECG signal only ranges to a max of 250 Hz. The equations for the values of the components in the filter are defined in the following equations:
R1 = 2/ (1571(1.4C2 + sort(1.4^2 * C2^2 - 4C1C2)))
R2 = 1 / (1571*C1*C2*R1)
C1 < (C2 *1.4^2) / 4
The materials required for this filter were one LM741 op amp, two resistors of 15.3 kohm and 25.6 kohm, and two capacitors of 47 nF and 22 nF.
Once all three stages are designed and built, the final circuit should look like the photo.
Step 5: Testing the Circuit
After the circuit is built, it needs to be tested to ensure it is working properly. An AC sweep needs to be run on each filter using a cardiac input signal at 1 Hz from a voltage generator. The magnitude response in dB should look like the images. If the results from the AC sweep are correct, the circuit is finished and ready to be used. If the responses are not correct, the circuit needs to be debugged. Start by checking all connections and power inputs to ensure everything has a good connection. If this does not solve the problem, use the equations for the components of the filters to adjust the values of resists and capacitors as needed until the output is where it should be.
Step 6: Building a VUI in Labview
Labview is a digital data acquisition software that lets a user design a VUI, or virtual user interface. A DAQ board is an A/D converter that can convert and transmit the ECG signal into Labview. Using this software, the ECG signal can be plotted on an amplitude vs. time graph to clearly read the signal and then convert the signal into a heartbeat in BPM. The first thing required for this is a DAQ board which acquires data and converts it to a digital signal to send to Labview on the computer. The first thing that needed to be added to the Labview design was DAQ Assistant, which acquires the signal from the DAQ board and defines the sampling parameters. The next step is connecting a waveform graph to the output of the DAQ assistant on the VUI design which plots the ECG signal showing the ECG waveform. Now that the waveform graph is complete, the data also needs to be converted to produce a numerical output of the heart rate. The first step in this calculation was finding the maximum of the ECG data by connecting the max/min element to the output of the DAQ data in the VUI, and then outputting this to another element called peak detection and to an element which would find the change in time called dt. The peak detection element also needed a threshold from the max/min which was calculated by taking the maximum from the max min element and multiplying it by .8, to find 80% of the maximum value, then inputted into the peak detect element. This threshold allowed the peak detect element to find the maximum of the R wave and the location the max occurred at while ignoring the other peaks of the signal. The locations of the peaks were then sent to an index array element added next on the VUI. The index array element was set to store on array with and index starting at 0, and then another starting with an index of 1. Then, these were subtracted from each other to find the difference of the two peak locations, which corresponds to the number of points between each peak. The number of points multiplied by the time difference between each point provides the time it takes for each beat to occur. This was accomplished by multiplied the output from the dt element and the output from the subtraction of the two arrays. This number was then divided by 60, to find the beats per minute, and then outputted using a numerical indicator element on the VUI. The setup of the VUI design in Labview is shown in in the Figure.
Step 7: Put It All Together
Once the VUI is finished on Labview, the final step is to connect the circuit to the DAQ board, so the signal runs through the circuit, into the board, then to Labview. If everything works properly, a 1 Hz signal should produce the waveform shown in the figure and a heartbeat of 60 beats per minute. Now you have a functioning ECG and Heart Rate Digital Monitor.