Introduction: A Heartful ECG
An ECG, or electrocardiogram, is a commonly used medical device used to record the electrical signals of the heart. They are simple to make in the most basic form, but there is plenty of room for growth. For this project, an ECG was designed and simulated on LTSpice. The ECG had three components: an instrumentation amplifier, a low-pass filter, and finally, a non-inverting amplifier. This was to ensure there was enough gain coming in from a relatively weak source of a biosignal, as well as a filter to remove noise in the circuit. The simulations showed that each component of the circuit performed successfully, as did a total integrated circuit with all three components. This shows that this is a viable way of creating an ECG circuit. We then explored the vast potential for improvements to the ECG.
Step 1: Introduction/Background
An ECG or electrocardiogram is used to record the electrical signals of the heart. It is quite common and a painless test used to detect cardiac problems and monitor cardiac health. They are performed in doctor’s offices - either clinics or hospital rooms and are standard machines in operating rooms and ambulances . They can show how fast the heart is beating, if the rhythm is regular or not, as well as the strength and timing of the electrical impulses going through the different parts of the heart. About 12 electrodes (or fewer) are attached to the skin on the chest, arms, and legs and are connected to a machine that reads the impulses and graphs them . A twelve-lead ECG has 10 electrodes (to give a total of 12 views of the heart). The 4-lead goes on the limbs. Two on the wrists, and two on the ankles. The final 6 leads go on the torso. V1 goes on the 4th intercostal space to the right of the sternum, while V2 is on the same line, but on the left of the sternum. V3 is placed midway between V2 and V4, V5 goes at the anterior axillary line at the same level as V4 and V6 go on the midaxillary line at the same level .
The objective of this project is to design, simulate, and verify an analog signal acquisition device - in this case, an electrocardiogram. Since the average heart rate is at 72, but while resting it can go as low as 90, the median can be considered at about 60 bpm, giving a fundamental frequency of 1Hz for the heart rate. Heart rate can range from about 0.67 to 5 Hz (40 to 300 bpm). Each signal consists of a wave that can be labeled as P, QRS complex, and a T portion to the wave. The P wave runs at about 0.67 - 5 Hz, the QRS complex is at about 10-50 Hz, and the T wave is at about 1 - 7 Hz . The current state of the art ECGs has machine learning , where arrhythmias and the like can be classified by the machine itself. For simplification, this ECG will have only two electrodes - a positive and a negative one.
Step 2: Methods and Materials
To begin the design, a computer was used for both research and modeling. The software used was LTSpice. First, to design the schematic for the analog ECG, research was done to see what the current designs are and how to best implement those into a novel design. Pretty much all the sources started with an instrumentation amplifier to begin. It takes in two inputs - from each of the electrodes. After that, a low pass filter was chosen to remove signals above 50 Hz, since power line noise comes at about 50-60 Hz . After that, was a noninverting amplifier to amplify the signal, since biosignals are quite small.
The first component was the instrumentation amplifier. It has two inputs, one for the positive and one for the negative electrode. The instrumentation amplifier was used specifically to protect the circuit from the incoming signal. There are three universal op-amps and 7 resistors. All the resistors but R4 (Rgain) are of the same resistance. The gain of an instrumentation amplifier can be manipulated with the following equation: A = 1 + (2RRgain)  The gain was chosen to be 50 since biosignals are very small. The resistors were chosen to be larger for ease of use. The calculations then follow this set of equations to give R = 5000Ω and Rgain = 200Ω. 50 = 1 + (2RRgain) 50 2 * 5000200
The next component used was a low pass filter, to remove frequencies above 50 Hz, which will keep just the PQRST wave in this frequency range and minimizes noise. The equation for a low pass filter is shown below: fc= 12RC Since the chosen frequency for cut off was 50 Hz, and the resistor was chosen to be 1kΩ, the calculations yield a capacitor value of 0.00000318 F. 50 = 12 * 1000 * C
The third component in the ECG was a non-inverting amplifier. This is to ensure that the signal is large enough before (potentially) being transferred to an analog to digital converter. The gain of a noninverting amplifier is shown below: A = 1 + R2R1 Like before the gain was chosen to be 50, to increase the amplitude of the final signal. The calculations for the resistor is as follows, with one resistor chosen to be 10000Ω, giving a second resistor value of 200Ω. 50 = 1 + 10000R1 50 10000200
To test the schematic, analyses were run on each component and then on the final overall schematic. The second simulation was an AC analysis, an octave sweep, with 100 points per octave, and running through frequencies 1 through 1000 Hz.
Step 3: Results
To test the circuit, an octave sweep was performed, with 100 points per octave, starting with a frequency of 1 Hz, and going until a frequency of 1000 Hz. The input was a sinusoidal curve, to be a representation of the cyclic nature of the ECG wave. It had a DC offset of 0, amplitude of 1, frequency of 1 Hz, T delay of 0, theta (1/s) of 0, and phi (deg) of 90. The frequency was set to be 1, since an average heart rate can be set to about 60 bpm, which is 1 Hz.
As seen in Figure 5, the blue was the input and the red was the output. There was clearly a massive gain, as seen above.
The low pass filter was set to 50 Hz, to remove power line noise in a potential ECG application. Since that does not apply here where the signal is constant at 1 Hz, the output is the same as the input (Figure 6).
The output - shown in blue - is clearly amplified in comparison to the input, shown in green. In addition, since the peaks and valleys of the sine curves match up, this shows that the amplifier indeed was non-inverting (Figure 7).
Figure 8 shows all of the curves together. It clearly shows the manipulation of the signal, going from a small signal, amplified twice, and filtered (although the filtration has no effect on this specific signal).
Using the equations for gain and cutoff frequency [10, 11], the experimental values were determined from the plots. The low pass filter had the least error, while both amplifiers hovered with an error of about 10% (Table 1).
Step 4: Discussion
It appears that the schematic does what it is supposed to do. It took a given signal, amplified it, then filtered it, and then amplified it again. That being said, it is a very ‘small’ design, consisting of only an instrumentation amplifier, low pass filter, and a non-inverting filter. There was no clear input of an ECG source, despite countless hours surfing the web for a proper source. Unfortunately, while that didn’t work out, the sin wave was an appropriate substitute for the cyclic nature of the signal.
A source of error when it comes to the theoretical and the actual value of the gain and low pass filter could be the chosen components. Since the equations used have a ratio of the resistances added to 1, while doing the calculations, this one was neglected. This can be done so if the resistors used are large enough. While the resistors chosen were large, the fact that the one was not taken into calculations will create a small margin of error. Researchers at San Jose State University in San Jose CA designed an ECG specifically for cardiovascular disease diagnosis. They used an instrument amplifier, 1st order active high pass filter, 5th order active Bessel low pass filler, and a twin-t active notch filter . They concluded that the use of all these components resulted in the successful conditioning of a raw ECG wave from a human subject. Another model of a simple ECG circuit done by Orlando Hoilett at Purdue University consisted solely of an instrumentation amplifier. The output was clear and usable, but it was recommended that for specific applications, changes would be better - namely amplifiers, bandpass filters, and a 60 Hz notch filter to remove power line noise. This shows that this design of an ECG, while not all-encompassing, is not the most simple method of taking in an ECG signal.
Step 5: Future Work
This design of an ECG would require a few more things before being put into a practical device. For one, the 60 Hz notch filter was recommended by several sources, and since there was no power line noise to deal with here, it was not implemented into the simulation. That being said, once this is translated to a physical device, it would be beneficial to add a notch filter. In addition, instead of the low pass filter, it might work better to have a bandpass filter, to have more control of the frequencies that are being filtered out. Again, in the simulation, this sort of issue does not come up, but it would appear in a physical device. After this, the ECG would require an analog to digital converter, and likely a device akin to a raspberry pi to collect the data and stream it to a computer for viewing and use. Further improvements would be the addition of more leads, perhaps starting with the 4 limb leads and graduating to all 10 leads for a 12 lead diagram of the heart. A better user interface would also be beneficial - perhaps with a touchscreen for medical professionals to be able to easily access and focus on certain parts of an ECG output.
Further steps would involve machine learning and AI implementation. The computer should be able to alert medical personnel - and possibly those around - that an arrhythmia or the like has occurred. At this point, a doctor must review an ECG output to make a diagnosis - while technicians are trained to read them, they cannot make an official diagnosis out in the field. If the ECGs that are used by first responders have an accurate diagnosis, it could allow for quicker treatment. This is especially important in rural areas, where it could take upwards of an hour to get a patient who can’t afford a helicopter ride to the hospital. The next stage would be adding a defibrillator to the ECG machine itself. Then, when it detects an arrhythmia, it can figure out the proper voltage for a shock and - given that the shock pads have been placed - can attempt to get the patient back into sinus rhythm. This would be useful in hospital settings, where patients are already hooked up to various machines and if there is not enough medical personnel to immediately provide care, the all in one heart machine could take care of it, saving precious time needed to save a life.
Step 6: Conclusion
In this project, an ECG circuit was successfully designed and then simulated using LTSpice. It consisted of an instrumentation amplifier, a low pass filter, and a non-inverting amplifier to condition the signal. The simulation showed that all three components worked individually as well as together when combined for a total integrated circuit. The amplifiers each had a gain of 50, a fact confirmed by the simulations run on LTSpice. The low pass filter had a cutoff frequency of 50 Hz, to reduce noise from power lines and artifacts from the skin and movement. While this is a very small ECG circuit, there are plenty of improvements that could be made, going all the way from the addition of a filter or two, up to an all in one heart machine that could take the ECG, read it, and provide immediate treatment.
Step 7: References
 “Electrocardiogram (ECG or EKG),” Mayo Clinic, 09-Apr-2020. [Online]. Available: https://www.mayoclinic.org/tests-procedures/ekg/about/pac-20384983. [Accessed: 04-Dec-2020].
 “Electrocardiogram,” National Heart Lung and Blood Institute. [Online]. Available: https://www.nhlbi.nih.gov/health-topics/electrocardiogram. [Accessed: 04-Dec-2020].
 A. Randazzo, “The Ultimate 12-Lead ECG Placement Guide (With Illustrations),” Prime Medical Training, 11-Nov-2019. [Online]. Available: https://www.primemedicaltraining.com/12-lead-ecg-placement/. [Accessed: 04-Dec-2020].
 C. Watford, “Understanding ECG Filtering,” EMS 12 Lead, 2014. [Online]. Available: http://ems12lead.com/2014/03/10/understanding-ecg-filtering/. [Accessed: 04-Dec-2020].
 R. K. Sevakula, W. T. M. Au‐Yeung, J. P. Singh, E. K. Heist, E. M. Isselbacher, and A. A. Armoundas, “State‐of‐the‐Art Machine Learning Techniques Aiming to Improve Patient Outcomes Pertaining to the Cardiovascular System,” Journal of the American Heart Association, vol. 9, no. 4, 2020.
 W. Y. Du, “Design of an ECG Sensor Circuitry for Cardiovascular Disease Diagnosis,” International Journal of Biosensors & Bioelectronics, vol. 2, no. 4, 2017.
 “Instrumentation Amplifier Output Voltage Calculator,” ncalculators.com. [Online]. Available: https://ncalculators.com/electronics/instrumentation-amplifier-calculator.htm. [Accessed: 04-Dec-2020].
 “Low Pass Filter Calculator,” ElectronicBase, 01-Apr-2019. [Online]. Available: https://electronicbase.net/low-pass-filter-calculator/. [Accessed: 04-Dec-2020].
 “Non-inverting Operational Amplifier - The Non-inverting Op-amp,” Basic Electronics Tutorials, 06-Nov-2020. [Online]. Available: https://www.electronics-tutorials.ws/opamp/opamp_3.html. [Accessed: 04-Dec-2020].
 E. Sengpiel, “Calculation: Amplification (gain) and damping (loss) as factor ( ratio) to the level in decibels (dB) ,” dB calculator for amplification gain and damping (loss) factor of an audio amplifier calculation decibel dB ratio - sengpielaudio Sengpiel Berlin. [Online]. Available: http://www.sengpielaudio.com/calculator-amplification.htm. [Accessed: 04-Dec-2020].
“Low Pass Filter - Passive RC Filter Tutorial,” Basic Electronics Tutorials, 01-May-2020. [Online]. Available: https://www.electronics-tutorials.ws/filter/filter_2.html. [Accessed: 04-Dec-2020].
 O. H. Instructables, “Super Simple Electrocardiogram (ECG) Circuit,” Instructables, 02-Apr-2018. [Online]. Available: http://media.nbcmontana.com/Super-Simple-Electrocardiogram-ECG-Circuit/. [Accessed: 04-Dec-2020].
 Brent Cornell, “Electrocardiography,” BioNinja. [Online]. Available: https://ib.bioninja.com.au/standard-level/topic-6-human-physiology/62-the-blood-system/electrocardiography.html. [Accessed: 04-Dec-2020].