ECG Simulator

2 Hours

Soldering, Uploading Arduino Code, How to use electrocardiogram (patient monitor)

ECG simulator kit, Soldering Iron, Solder, Wire/cable cutters, Patient Monitor or Oscilloscope, breadboard and jumper wires are optional

What you will learn

By using this guide you will learn about patient monitor testing, low pass filters, microcontrollers, soldering and/or breadboards. Of course you can choose what you want to focus on – or you can simply build the patient simulator use your device to test medical devices. The patient simulator you build is meant for educational purposes only.

Patient Monitor Testing

Doctors and nurses depend on patient monitors working properly to provide patient care. Biomeds (also known as biomedical equipment technician or clinical engineers) are responsible for testing patient monitors to verify performance. Patient simulators are used to produce characteristic vital signs with known values. Patient simulator devices can generate a variety of signals depending on the make and model.

Fluke ProSim Image

Figure shows Fluke ProSim 5 

SImcube 5

Figure shows a Pronk Simcube-5

BC Group Patient Simulator

Figure shows a BC Group PS-2010

Each patient simulator device can be used to simulate patient vital signs such as different ECG waveforms, respiratory rate, and in some cases non-invasive and invasive blood pressure.


When are they used?

Typically, each patient monitor is tested annually and has specific testing conditions recommended by the manufacturer of the device. Healthcare organizations develop standard operating procedures based on manufacturer recommendations and historical data of the devices maintenance needs. A variety of testing procedures are used but we are only going to talk about the procedures that involve performance testing the ECG signal (and respiratory rate).


How are they used?

Patient simulators output a know (calibrated) ECG waveform. The patient monitor is then expected to read the same, or close to the same value. In general the tolerance for general test to verify correct measurement of the ECG waveform is usually around ±5%.For example if you create a 80 bpm signal on your patient simulator your patient monitor should read somewhere in the range between 76 bpm and 84bpm.


Testing Alarms

Technicians must also verify that the patient monitor correctly alarms under different conditions. Alarm conditions may vary slightly by manufacturer but common alarms include: low alarm, high alarm, tachycardia alarm, fibrillation alarms, and respiratory alarms.


Build your own?

Patient simulators can be expensive and they require seasonal calibration. Using properly calibrated equipment is important when using a device for a clinical setting. However using your ECG simulator kit you can build a device that can be used to learn how to test patient monitors just like these devices!

How the ECG simulator works

The ECG simulator uses an Arduino microcontroller and electronic components to generate a known ECG waveform as well as a respiratory rate. We can brake the device into four main parts parts: Mode Selector, Microcontroller, Two-Stage low pass filter, and the Output voltage-divider.The ecg-simulator-schematic file shows all of the electrical connections and components used to build the simulator and shows which components are used to create each of the four main parts.

Mode Selector

To generate different types of ECG waveforms and respiratory rates we need some way to select different modes. To do this the ECG simulator uses three slider switches.

SPDT Switch

There are three pins on each slider switch, one pin is to ground, one pin is to 5V, and the central pin goes to the microcontroller. Each slider switch has two positions it can be set too. By changing the position of the slider switch we can communicate to the microcontroller what type of signals we want to produce. If we had one slider switch we could have two modes. By using three slider switches we are able to create a total of 8 modes.


Figure shows slider switch, ECG simulator with three slide switches in the upper left hand corner, and the electrical schematic showing slider switches labeled as SW1, SW2, and SW3.


The Arduino Nano is used to create the signal that will generate the different ECG waveforms and provide the change in resistance needed to simulate the respiratory rate. The coding of the Arduino for this project is a little dense, so if you are not familiar with coding and C, I recommend skipping this part. However, If you are interested in understanding how the software for the microcontroller works you can check out this explanation

Low Pass Filter

A two stage low pass filter is used to convert a pulse width signal signal to an analog signal. A two stage low pass filter is just two low pass filter put together in series. The microcontroller we are using is going to put out a digital signal, the digital signal can approximate an analog signal with a little help from our two stage low pass filter. If you want to learn more about low pass filter – check this video out.

When you use a low pass filter (or two low pass filters in our case) on a digital signal (such as the choppy discrete signal coming out of the microcontroller) then you can smooth that signal using the signal attenuation of the low pass filter.  rejection  to approximate an analog (or continuous) signal. If you want to learn more about pulse width modulation and the two-stage filter watch this video starting at 2:30.

Voltage Divider

The purpose of a voltage divider is simple – take a voltage and reduce the voltage by a known amount. By choosing resistance values, we can control how much we reduce the voltage by. The generic schematic for a voltage divider is shown.


Where Vin is the input voltage and Vout is the output voltage. Z1 and Z2 represent the chosen resistance values (and because this is an AC signal we call these resistance values the impedance). If Vin = 5 V, Z1 =100 kOhms, and Z2 = 220 Ohms then Vout = 0.011 V or 11 mV. By using the voltage divider we have effectively divided the input by approximately 500. We use these values in our example because they are similar to the two voltage dividers we have in our schematic for the ECG simulator.

The schematic shown below pictures two voltage dividers that feed into the output terminal. R8 and R10 show one voltage divider (with LL as the Vout) and R9 and R11 as the other voltage divider (with LA as the Vout).


Figure show voltage divider used in ECG simulator 

What you will do

Now that you understand the basics of how the ECG simulator works let’s build it! You have two options 1) you can build it by using the provided PCB board or you can build it on a breadboard. The PCB board works best – however lacks customization. The breadboard version is more flexible but is unable to accurately simulate the respiratory rate due to parasitics associated with breadboards.


Printed Circuit Board – version

To create your PCB ECG simulator you will need to be able to solder. We also recommend a PCB board holder. You will need all the components listed below (these are included in your kit)

  • 1 Arduino Nano with USB cable
  • R1 1 kOhm
  • R2, R3, R4, R5, R6 10 kOhms
  • R7 330 kOhms
  • R8, R9 100 kOhms
  • R10, R11 220 Ohms
  • R12 22 kOhms
  • 3 SPDT switches
  • 1 LED
  • C1, C2 220 nF
  • 1 Screw Terminal for 3 pins

The locations of each component are labeled on your PCB board. For example R1 is listed as 1 kOhm therefore you would place the 1 kOhm resistor from your kit in the location of R1 on the PCB board. 

Figure shows image of PCB board with component locations

You should take special care to orient the LED (cathode connects to ground) and Arduino correctly since their orientation matters (the Arduino’s orientation is clearly marked on the PCB board by the USB port location).

The LED cathode is the short leg of the component and connects to the square pad on the PCB board

Figure shows close up of square pad on PCB Board

The board will look something like this when finished (may vary slightly depending on where components are sourced from)

ECG Simulator

Assembled ECG Simulator

We recommend using black, white, and red wires in pins 1, 2, 3 respectively. That way you can use the color codes on your patient monitor leads (assuming they provide them).

Breadboard – version

If you want to build the same circuit on a breadboard you can. You will need jumper wires and breadboard plus the ECG simulator kit. You can build the breadboard from the electrical schematic – or you can also look at the working example below to see one example of how to connect your breadboard version. You should take special care to orient the LED correctly (cathode on the negative).

ECG Simulator Built on Breadboard

Using your ECG simulator

Assuming your ECG simulator is now working properly it’s time to test a patient monitor. We recommend testing each possible case – using the switches to change cases (8 total cases). Record what happens on the patient monitor. Makes sure to note the BPM reading and waveforms. Record any alarms or messages you see on the patient monitor. The different modes should be as follows

  • Normal 80 BPM
  • Low 40 BPM
  • High 120 BPM
  • High 160 BPM
  • Normal 80 BPM with respiratory rate off*
  • Normal 80 BPM with apnea*
  • normal sinus rhythm, BPM 80, hyperventilation*
  • Ventricular Fibrillation

*respiratory rate functionality only works consistently with the PCB version

each patient monitor is slightly different and some patient monitors may give you different messages depending on the the different cases/test conditions.

Tips and Troubleshooting

Common issues/mistakes include:

  • LED is not blinking – make sure the LED anode (connected to the microcontroller) and the cathode (connected to ground) are in the correct orientation
  • No power – make sure Arduino is connected to USB cable and computer or a portable USB power supply with batteries in the correct orientation
  • ECG working but no respiratory rate showing – make sure that your patient monitor is measuring the respiratory rate between the correct leads
  • ECG not working – make sure Arduino is on, LED indicator is blinking, and the correct leads are connected RA, LL, and RL.
  • Arduino code does not load properly – try using the older bootloader – ATmega328P (Old Bootloader)


Here are some examples of ways to challenge yourself even further with this kit and activity

  • Modify the Arduino code and change the output heart rate for certain cases – for instance can you make the 80 BPM signal into a 10 BPM signal.
  • Change the code of the Arduino so that it only needs one switch for all 8 cases.
  • Most modern patient monitors use at least 5 lead ECG – create a way simulate signal on all 5 leads
  • Change the Arduino code so that there are more ECG waveform cases
  • Add a second LED to the circuit that can indicates the respiratory rate
  • If you have an oscilloscope this can be a great way to check out what is going on in your circuit. Investigate and describe the ECG signal when leaving the microcontroller at pin D9? You can investigate the signal by grounding your probes alligator clip on digital ground and using the probe to check pin D9. What about after the first low pass filter and after the entire two stage low pass filter (hint: you will need to check the schematic for location on where to test).


Answer these questions to check your understanding of the material

  • Find an example of a patient simulator used in a clinical setting by biomeds. Identify and describe the types of signals that can be generated by the simulator.
  • Describe a normal ECG waveform and BPM?
  • Describe Respiratory Rate waveform and breadths per minute?
  • When does the low alarm, high alarm, and tachycardia alarm go off on the patient monitor you are using? What are the clinical reasons for this?
  • Can you change when the alarms go off on a patient monitor? If so, how?
  • Draw a schematic for a low pass filter. Then calculate the cutoff frequency for the low pass filter (only the first stage) used in the ECG simulator circuit.

Show off!

Show off your achievements by sharing your ECG simulator – make sure to tag us on posts with #HTMWorkshop. 

Also, if you successfully build your ECG simulator you can earn our digital badge! Email with a picture or other documentation of your ECG simulator and get awarded a digital badge that can be stored and shared on profesional platforms such as LinkedIn.