Introduction: Electrocardiograph & Heart Rate Monitor

Picture of Electrocardiograph & Heart Rate Monitor

This instructable shows you how to make an electrocardiograph and a heart rate monitor. It is intended to be a fun science project only. Of course, it should not serve as a medical purpose.

PLEASE NOTE : To avoid any risk of electric shock, only use battery alimentation. Electrodes are theorically isolated from the circuit by the instrumentation amplifier, but play safe. I'm not responsible for any accident that may happen. 

This is a simple design that fits on a single breadboard. You are free to experiment and to custom it for your needs.

Since it's my first Instructable and also since English is my second langage, don't hesitate to contact me if you find an error or if you want some clarifications about a section or another. I will be happy to edit my project for the better!

Step 1: List of Materials

Picture of List of Materials

- (1) Instrumentation amplifier INA128
- (1) Operational amplifier 741
- (1) Arduino Uno
- (1) 16x2 characters Liquid crystal display
- (1) Voltage regulator 7805
- (1) 8 ohms mini speaker
- (1) Brigth LED (I use a 10 mm one)
- (1) Diode 1N3064
- (2) 9V Batteries with connectors
-  Breadboard
-  Jump wires
Resistors :
- (2) 100 ohms, 1/4W
- (1) 470 ohms, 1/4W
- (1) 1 kiloohms, 1/4W
- (2) 10 kiloohms, 1/4W
- (2) 100 kiloohms, 1/4W
- (1) 1 Megaohms, 1/4W
Capacitors :
- (1) 10 nF
- (1) 47 nF

For the electrodes :
- About one meter of speaker wire
- Antistatic wrist strap
- Medical tape
- Aluminum paper
- (2) metallic paper clips
- Shower gel (a substitute for electrocardiogram gel)

Optional but recommended:
-Oscilloscope, for the electrocardiography part of the device

Step 2: Build the Circuit

Picture of Build the Circuit

Here is the schematic of the circuit and a suggestion of the breadboard implementation. The two electrodes will be plugged on pin 2 and 3 of the INA128. An additionnal reference electrode (an antistatic wrist placed on your right leg) will be plugged in ground. This configuration allows you to use unshielded cables.

The best signal is just after the low-pass filter (between the two 100kOmhs resistors). I suggest that you plug the oscilloscope probe at this point for demonstration, although you might want to check other points to see if everything is working properly.

Step 3: Download Code on the Arduino

Download the attached file on your computer, open it with the arduino IDE, plug your arduino, dowload the sketch and you're ready to go!

Step 4: Make the Electrodes

Picture of Make the Electrodes

Firmly attach the two paper clips on the pair of denuded speaker wire. Cut pieces of aluminum paper and clip them in the paper clips. The result should look like the picture. You might also want to experiment to find a better design.
When everything is ready, put some shower gel on the electrodes and use some medical tape in order to stick the result on your chest.

Step 5: Place Electrodes and Play!

Picture of Place Electrodes and Play!
Put the antistatic wrist around your right leg and connect it to the circuit ground. 

Place the electrodes on your chest and play with them until you get a signal. It could take some time, as the electrical connection is fluctuating. Be patient!

Here is a demonstration of my electrocardiograph :

An interesting thing to do is to experiment with electrode location as you will get a different signal. Professional electrocardiographs use 10 electrodes to map the signal (see the 3rd picture). On the first picture you can see my average electrode placement. This configuration works well because I essentially pick up the ventricular spike that I use for frequency measurement.

Another effect that you can see is the noise caused by movements. The electrodes can pick up electric signals of your muscles. If you want a clean signal, stay still!

Here is the video I've made (in French, sorry!) for my YouTube channel! Enjoy!


UfukB4 (author)2017-12-10

Hello birdyberth,

I constructed the circuit by following whole steps. The led flashed, but lcd screen showed " <30 bpm You are dead ". I think that there is a problem on arduino code. Could you help me please ?


birdyberth (author)UfukB42017-12-10

No, it's because you're dead! :p Do you have a scope to check the signal? Does the LED flash at a constant heart rate interval? Check your electrode connection, the problem is generally there.

22dab95 (author)2017-11-19

Why was the SB Freeduino used instead of other Arduino boards?

birdyberth (author)22dab952017-11-21

Hahaha :) This is my first arduino board I purchased in my life (I think it was in 2011, I don't remember)... I'm still using it! (although I had to change the atmega chip once because I blew it with too a short circuit and also I broke the RX diode on it by accidentally dropping it in the snow while it was working) At that time, arduinos were hard to find in canadian shops and the freeduino was a great alternative, and fun to build too (because it was sold in a semi-kit). But yeah, any arduino board will do.

RanD14 (author)2017-11-15

Hello again
i can't find the INA 128 and the diode :'( can i replace it?

birdyberth (author)RanD142017-11-21

Yes, try to experiment with any other instrumentation amplifier and standard low-voltage low-current diode.

birdyberth (author)2017-11-06

dude the circuit is up here, go to step 2, there is the schematic and the breadboard placement of components

birdyberth (author)2017-10-19

I don't offer coaching on how to make this project, everything is up here, if you have specific questions put them here in the comments section.

AshiqA (author)2017-08-14

is there any alternative for Diode 1N3064 and Instrumentation amplifier INA128

birdyberth (author)AshiqA2017-10-19

yes pretty much any small diode and any low-cost instrumentation amplifier will work

Fatemezare (author)2017-08-12

Hi. Would u please send me the coding? Thank you

SangeethaK7 (author)2017-02-08

Sir please send the clear circuit diagram and coding .

birdyberth (author)SangeethaK72017-03-11

Dude everything is up here, if you have more specific questions I'll answer them.

Saad Shakir (author)2017-02-04

hey there. i'm using the whole instructions provided in this blog. but get stucked in making connections for 7805. since the CKT diagram provided has its 7805's GND connected to battery's (-ve) terminal. while 7805's o/p pin goes to general GND of the CKT. its mean generally every element's GND has 5V supplied. but i think it shouldn't be. it might be the reason my CKT doesn;t respond.


birdyberth (author)Saad Shakir2017-03-11

Yes I'm using the 7805 to get -5V relative to circuit ground, to form a dual power supply. The circuit is designed to work with 5V, 0V (GND) and -5V mainly because of the instrumentation amplifier.

bluehawkecg (author)2017-01-08

can you use an electrode instead of the anti-static strip? As I am not picking any signal!


birdyberth (author)bluehawkecg2017-03-11

Yes using an electrode might improve the signal because anti-static strip has a fair amount of impedance. It was just a quick and cheap way to make a grounding electrode.

Hudson samuel (author)2016-12-21

Is there any way to use a PC or android as oscilloscope?

birdyberth (author)Hudson samuel2017-01-04

Yes, sure because the frequency content of the signal is very low so with a normal sound card sampling at say 44kHz you'll easily get a perfect sampling. There is plenty of info on the internet on how to use a pc or cellphone as an oscilloscope.

ColinD38 (author)2016-11-27


I used the code provided, added a few modifications to add a filter, as well as a servo motor to act as a analog BPM scale in a 180 degree range. The lcd displays whats programmed but stuck at 30 BPM, and LED does not flash.....which may work once arduino display the proper BPM. Can anyone check the attached code to verify if everything is ok or if there may be something causing these problems? I do get the wave form on my oscilloscope but thats about it right now. You can reply here or email me:

Many thanks!!


// This program reads the incoming signal from the electrocardiograph and outputs the heart rate

// Pin D7 is connected to the signal input

// Pin D6 is connected to a mini-speaker

// For the connection to the liquid crystal display, see the LiquidCrystal Librairy

// External variables

const int signal = 7; // Pin connected to the filtered signal from the circuit

unsigned long time;

unsigned long frequency;

int angle;

// Internal variables

int period = 2000;

int starttime = 2000;

int input = 0;

int lastinput = 0;

unsigned long death = 0;

// include the library code:

#include <LiquidCrystal.h>

#include <Servo.h>

#include <Filters.h>

Servo myServo;

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte heart[8] = {










void setup() {



pinMode(signal, INPUT);

lcd.createChar(1, heart);

// set up the LCD's number of columns and rows:

lcd.begin(16, 2);

// Print a message to the LCD.


lcd.setCursor(1, 0);

lcd.print(" bpm : ");

lcd.setCursor(0, 1);

lcd.print("You are ");


void loop() {

lcd.setCursor(1, 0);

time = millis();

input = digitalRead(signal);

if ((input != lastinput) && (input == HIGH)) {

// If the pin state has just changed from low to high (edge detector)

period = time - starttime; // Compute the time between the previous beat and the one that has just been detected

starttime = time; // Define the new time reference for the next period computing

death = time;

tone(6, 800, 100); // Output a short "bip" through the speaker


lastinput = input; // Save the current pin state for comparison at the next loop iteration

if (period < 0) {

frequency = 0;


else {

frequency = 60000 / period; // Compute the heart rate in beats per minute (bpm) with the period in milliseconds


if ((time - death) > 2000) { // Detect if there is no beat after more than 2 seconds

tone(6, 900); // Output a continuous tone to the speaker

// filters out changes faster that 40 Hz.

float filterFrequency = 40;

// create a one pole (RC) lowpass filter

FilterOnePole lowpassFilter( LOWPASS, filterFrequency );

while ( true ) {

lowpassFilter.input( analogRead( 7 ) );



lcd.setCursor(8, 1);

lcd.print("dead! ");


else {

char freq[3];

if (frequency / 100 == 0) {

freq[0] = 32; // Print a space to the first character if the frequency is below 100 bpm


else {

freq[0] = frequency / 100 + 48; // Sort the hundreds character and convert it in ASCII


freq[1] = (frequency / 10) % 10 + 48; // Sort the thents character and convert it in ASCII

freq[2] = frequency % 10 + 48; // Sort the units character and convert it in ASCII

angle = map(frequency, 0, 1023, 29, 179);


lcd.print(freq);//if doesnt work try input or revert back to freq

lcd.setCursor(8, 1);

lcd.print("alive! ");


Serial.print("Beats per Minute: ");




DakyL1 (author)2016-05-07


Can you tell me if i can use INA 118P?



birdyberth (author)DakyL12016-05-11

Yes I think it should work fine. Maybe you'll have to adjust the gain.

ColinD38 (author)birdyberth2016-11-24

I added filter code to the arduino library, wrote the filter code prior to frequency calculation in the loop and was able to finally acquire a clear signal....take some palying around with the ds0138 to get the right settings. my problem now is the lcd is still stuck show BPM less then 30. I also added serial monitor to the program and that as well is stuck on 30. I have the input onto digital pin 7 just like the instructions says but not sure what else to do now. I now its probably something simple in the program to correct it. Can you provide some thought on how to fix this. As well i have a servo motor mapped to give a analog scale reading of BPM and mapped out the frequency to a 180 degree range. that as well is not working so it has to do with getting the input back out of the arduino to both servo and lcd.

OsmanC14 (author)2016-11-24

Hey Birdy,

Could you please give an explanation of the schematic so that I may understand the circuit better? Also since I do not have the voltage regulator could I just use 5 V from a power supply and get the same output?



NegoitaP (author)2016-04-06

Hi birdy,

I have an issue with my circuit as it powers up correspondingly, I must mention that I followed your guide exactly, but unfortunately the LCD display does not show anything, besides the background light. I am using a 3 lead electrode that is connected to the breadboard by an audio jack input, but I added additional cables to the 2,3 pins of the INA128 and the ground electrode to the ground. Can you please tell me what I'm doing wrong ?

Thank you kindly,


birdyberth (author)NegoitaP2016-04-28

I can't see well on the picture but first I suggest you to check your wiring to the lcd, try the example code on the arduino library, like printing hello world on the lcd or I don't remember, something like this, just to isolate the troubleshooting and make this part of the circuit working. Then for the other part maybe check points with an oscilloscope/voltmeter to see if you can get a signal? Often what is happening is that your INA saturates, try to lower the gain first, see if you can get a signal. Sometimes electrodes are not well enough in contact with your skin, try to adjust them till you get something. Good luck!

ColinD38 (author)birdyberth2016-11-18

you may also want to introduce a potentiometer into the circuit that is being fed in the 3rd pin on the lcd. wire your two front pin of the potentiometer for your polarity. this will act as a contrast adjuster. i had the same issue and once i did this i could adjust the contrast of the text on the lcd.

ColinD38 (author)2016-11-18

I just recently built this project following the diagram shown. however i am having an issue with the 9v battery that is feeding into the breadboard by the regulator. it is over heating and producing a burning smell. i am wondering if this is a common problem or how i should go abouts fixing this. I am also introducing a servo motor into this project to also create a analog BPM meter but currently trying to figure why its not operating.

SophieR23 made it! (author)2016-07-29

If you have any questions. Ask me!

Taha1371 (author)SophieR232016-11-06

May you send the integrated circuit about this project.
Thanks for your help.

Taha1371 (author)SophieR232016-10-23

Hi,what's this oscilloscope (monitor )model?

LuisZ26 (author)Taha13712016-11-05

DSO Nano oscilloscope V2

sangs5 (author)SophieR232016-11-01

hi sophieR23. i had made the project the same way, but the lcd show <30 heart. how to solve this?

what should i do in troubleshooting?

already checked the circuit and used same coding..

birdyberth (author)SophieR232016-08-05

WOW! It looks awesome! :) Is that gorgeous TFT screen only used for displaying the heart rate? Because you could try to modify my design to sample the ECG signal with the arduino and display it live on the screen! Anyway, I'm interested with the mods you've brought, can you send me a private message? I would love to add your build to my project as an update or something like that, with your permission and attribution of course!

sangs5 (author)birdyberth2016-08-29

hi author and SophieR23,

can i use laptop as replace the LCD or oscilloscope? what application i used to display the beat n wave? can i save the data?

thanks in advance.

SophieR23 (author)birdyberth2016-08-19

Hey birdyberth. The TFT also gives a diagnosis after displaying your BPM.

Taha1371 (author)2016-10-28

I don't have diode 1N3064, may I use diode 1N4148 or 1N914?

Taha1371 (author)2016-10-25

Hi dear friend.
May you send me the arduino code you used for this best project, because I'm going to make it for my school project, please help me, thanks
It's my email address.

Taha1371 (author)2016-10-25

Hi dear friend.
May you send me that arduino code you used for this best project. I want exactly that cod because I making this for my school project, please help me. Thanks
It's my email

Taha1371 (author)2016-10-23

Hi, may you say the monitor full name, what's its model?

birdyberth (author)Taha13712016-10-23

The oscilloscope is a DSO-nano V2 made by seeedstudio, the LCD is a standard 16x2 character LCD

Taha1371 (author)birdyberth2016-10-23

Thanks sir

Taha1371 (author)2016-10-23

Hi,may you say the monitor full name، what's the model?

VeeriyaA (author)2016-09-12

thamnks dude

JimishF (author)2016-09-05

Ahh, I've followed and checked each step.. but i want to know that what could be the problem behind <30 bpm infinitely beaming output ??

projectabc (author)2016-05-13

Hi!! Can you tell me what is the INA128 used for? I mean, what its function in the project?

birdyberth (author)projectabc2016-08-05

As SophieR23 says (special thanks to her) the heart rate signal is really small, in the order of 1mV peak-to-peak. The main problem is the noise coming in the circuit through the body, typically in the order of 100mV peak-to-peak or even more, so if you use a standard amplifier, you'll only get noise at the output. The instrumentation amplifier is a badass amplifier who does an amazing job at removing common-mode noise (i.e when the same noise is present on both electrodes), so it amplifies the differential ECG signal while decreasing the noise.

SophieR23 (author)projectabc2016-07-06

It's the instrumentation amplifier. The instrumentation amplifier, is an amplifier that is particularly built for measurement. This will be measuring your heart rate. The other amplifier (operational amplifier) is to amplify the signal that the heart rate is giving off. The signal is so small that it needs to be larger in order for it to be read and later displayed on the LCD.

GwennL (author)2016-07-05

what is the purpose of 10nf capacitor? why is it placed in between the output and low pass filter? does 30hz cut off frequency too big for ecg signal from the body? why not make the cut off 10 or lower which is close to heart's frequncy (1-4 hz)? Im sorry if I have a lot of question, just trying to understand the circuit before making it. :P

birdyberth (author)GwennL2016-08-05

the 10nf capacitor is used to cut pure DC from the signal. You can add a resistor to make a high-pass filter with a really low cutoff frequency (<1Hz) instead, it'll work better.
I chose 30Hz for cutoff because I wanted a good time resolution for my signal, and even this is a bit low. If you put the cutoff too low the signal will become strongly distorted, it might still work for finding the heart rate but the characteristic ecg signal features will be removed from the signal by your filter. I suggest you read a bit about Fourrier math if the topic interests you. ECG signal is not a sine wave at 1-4Hz, it's a mix of an infinite number of sine waves of all frequencies with different amplitudes, when you put a filter to remove specific frequencies you alter the temporal shape of the signal, because time and frequency are Fourrier pairs.

About This Instructable




Bio: I have a degree in engineering physics. I like to make crazy scientific experiments.
More by birdyberth:3D Contactless Mouse (Interactive 3D Position Sensor)Electrocardiograph & Heart Rate Monitor
Add instructable to: