Introduction: Automated ECG Circuit Simulator

An electrocardiogram (ECG) is a powerful technique used to measure the electrical activity of a patient’s heart. The unique shape of these electric potentials differs depending on the location of recording electrodes and has been used to detect many conditions. With early detection of a variety of heart conditions, doctors can provide their patients with a multitude of recommendations addressing their situation. This machine is made up of three main components: an instrumentation amplifier followed by a notch filter and a band pass filter. The goal of these parts is to amplify the incoming signals, remove unwanted signals, and pass all relevant biological signals. Analysis of the resultant system proved that the electrocardiogram, as expected, performs its desired tasks to produce a useable ECG signal, demonstrating its usefulness to detect heart conditions.


  • LTSpice Software
  • ECG signal files

Step 1: Instrumentation Amplifier

The instrumentation amplifier, sometimes abbreviated INA, is used to amplify the low-level, biological signals being observed from the patient. A typical INA consists of three operational amplifiers (Op Amps). Two Op Amps should be in the non-inverting configuration and the last Op Amp in the differential configuration. Seven resistors are used alongside the Op Amps to allow us to vary gain by changing resistor value sizes. Of the resistors, there are three pairs and one individual size.

For this project, I will use a gain of 1000 to amplify the signals. I will then choose arbitrary R2, R3, and R4 values (it is easiest if R3 and R4 are equivalent in size because they would cancel to 1, paving way for easier calculations). From here, I can solve for R1 to have all necessary component sizes.

Gain = (1 + 2R2/R1) * (R4/R3)

Using the gain equation above and values R2 = 50kΩ and R3 = R4 = 10kΩ, we get R1 = 100Ω.

To check that the gain is in fact 1000, we can run the circuit with a .ac sweep function and observe where the plateau occurs. In this case, it is 60 dB. By using the equation below, we can convert the dB into dimensionless Vout/Vin, which ends up being 1000, as expected.

Gain,dB = 20*log(Vout/Vin)

Step 2: Notch Filter

The next component to be designed is the notch filter. The value of components for this filter largely depends on what frequency you wish to notch out. For this design, we want to cut out the 60 Hz frequency (fc) that is released by medical instrumentation.

A twin-t notch filter with be used in this design to ensure only the desired will be cut out and that we will not accidentally attenuate wanted biological frequencies near the 60 Hz mark. The component values were found by selecting arbitrary resistor values, of which I chose to use 2kΩ for the low pass filter (top T) and 1kΩ for the high pass filter (bottom T). Using the equation below, I solved for the necessary capacitor values.

fc = 1 / (4*pi*R*C)

The Bode plot was found once again using the .ac sweep function that LTSpice offers.

Step 3: Band Pass Filter

The final component to the automated ECG system is needed to pass biological frequencies since that is what we are interested in. The typical ECG signal occurs between 0.5 Hz and 150 Hz (fc), therefore two filters could be utilized; either a band pass filter or a low pass filter. In this design, a band pass filter was used as it is a little more precise than the low pass, though that one would still work since biological frequencies generally don't have high frequencies anyways.

A band pass filter contains two parts: a high pass filter and a low pass filter. The high pass filter comes before the Op Amp and the low pass is after. Remember that there are a variety of band pass filter designs that could be used.

fc = 1 / (2*pi*R*C)

Once again, arbitrary values much be chosen to find the required values of other parts. In the last filter, I chose arbitrary resistor values and solved for the capacitor values. To demonstrate that it doesn't matter which one you start with, I will now choose arbitrary capacitor values to solve for the resistor values. In this case, I chose a capacitor value of 1uF. Using the equation above, I use one cutoff frequency at a time to solve for the respective resistor. For simplicity, I will use the same capacitor value for both the high pass and low pass parts to the band pass filter. The 0.5 Hz will be used to solve for the high pass resistor and the 150 Hz cutoff frequency is used to find the low pass resistor.

A Bode plot can once again be used to see if the circuit design worked appropriately.

Step 4: Full System

After each component has been verified to work on its own, the parts can be combined into one system. Using imported ECG data and the PWL function in the voltage source generator, you can run simulations to ensure that the system properly amplifies and passes the desired biological frequencies.

The top plot screen shot is an example of what the output data looks like using a .tran function and the bottom plot screenshot is the respective bode plot using the .ac function.

Different input ECG data can be downloaded (two different ECG input files have been added to this page) and brought into the function to test the system on different modeled patients.