I like to first start off with a thank you to the original project designer birdyberth here on Instructables. I have taken his idea and modified for some of the ideas I had. His original design can be viewed here: https://www.instructables.com/id/Electrocardiograph...
*** Disclaimer *** *** This project is just for fun and to learn more about circuits and codes. This is not a medical device nor should it be used to try and diagnose heart problems. For any heart problems or medical concerns see a medical doctor right away for proper diagnostics. ***
So why did I build this project? Well after working many years in healthcare and now changing careers into electronics engineering, I wanted to combine the best of both worlds.
This project can be little bit challenging and complex, but worth it in the end once you see your finished project working.
Before I begin explaining how to build this project, let me explain how an ECG works. First the human heart is basically like a biological battery. With each contraction of the heart muscles to create a heart beat, it also produces voltage. While this voltage is in an extremely low amount (ranging from 1mV up to 100mV) and ECG can pick this voltage up and displays the wave of voltage the heart creates, showing the polarization and depolarization as it happens.....which in the medical community we use to detect numerous conditions and problems in the heart and human body.
Step 1: Gather Your Supplies
What you will need for this project:
- (1) Instrumentation amplifier
- (1) Operational amplifier 741
- (1) Arduino Uno
- (1) 16x2 characters Liquid crystal display
- (1) Voltage regulator 7805
- (1) 8-ohm mini speaker
- (1) Bright LED
- (1) Diode 1N3064
- (1) 9V Batteries with connectors
- Jump wires
- (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
- (2) 1 Megaohms, 1/4W
- (1) 10 nF (ceramic)
- (1) 47 nF (ceramic)
Oscilloscope ( I used the DSO138, for its affordability, but any oscilloscope will work)
3 Alligator clip wires (Red, White and Black)
ECG Electrodes with conductivity gel
Step 2: Schematic and Source Code
As you can see on the schematics, this can be a complexed circuit. I have labeled the point at which you will want to connect your red lead from the oscilloscope to, as well as the two leads to read the heart signal that will go either on the chest or on each wrists. The black lead on the oscilloscope can connect any wheres to the ground of your breadboard, as well as the third lead (black lead) of the ECG electrodes.
Step 3: Assembly Tips
When building your circuit, there are a few things to keep in mind. The polarity of the 9v battery going into your bread board must be reversed when being fed into the 5v regulator. Failure to do so will cause the battery to over heat, increasing the chance of exploding. As well it can damage some of the components. At the 5v regulator the hot lead of the battery connector will attach at the first pin of the regulator. The ground lead of the battery connect will go to the middle pin. the third pin will be connected to the ground column of the bread board. This allows the current to flow to a +/- 5V to the instrument amp.
Another tip as you may have seen in the pictures is using 1 large breadboard for the main circuit, and I also used a second smaller board to build the circuit for the speaker input/output and the servo motor. This is just so that your main board isn't clustered with many wires and can be easier to troubleshoot. Just make sure if you use a second board that you feed your 5V out from the arduino into your small board and then jump it with a ground into your main board.
Step 4: How the Circuit Works
Once you have the three leads attached to you ( location of placement is explained in the next step), the circuit will work in 2 different ways. First, since your red and white leads are connected to pins 2 and 3 of the instrument amp it gets fed through the amp and is processed into values.
This information then splits two ways. The signal that was picked up through the leads and processed in the instrument amp is sent out Pin 6 of the amp and goes into the oscilloscope to be viewed on the screen in a typical heart wave. The signal will also travel out of Pin 6 and travels through the 10nF Capacitor, a 47 nF and through several resistors in order to filter out interference and magnify this very low signal into something that can be read.
This is why we have the op amp. This low signal after being filtered and magnified goes into the op amp, gets magnified to an amount that can be read by our Arduino processor and code. This signal comes out of pin 6 of the op amp and travels through some resistors, flows into a diode and then is transferred to D7 of the arduino so that our program can calculate the heart rate and perform the functions that we requested.
Once the information is processed your project comes to life. You will start to hear the speaker giving a bleep sounds. This sound represents and approximate audio tone for each heart beat. Dont worry if you hear that classic flat line sound. You are not really dead, the program calculates based on a normal heart rate without no interference like movement, or extra heart beats called PVC. The next feature you will see is the LED will also flash on and off with each beat of the heart giving you a clear visual reference. The addition that I added from the original schematics from the original designer was the servo motor. This acts like the older analog multi-meters. It will take the heart rate calculated, and map it out to work on a range of 180 degrees. The servo will then continuously move with each new calculation to the point of reference based on its limits in the map function. At the same time our LCD display will give a digital reading of what the heart rate is. If the calculations fall <30 BPM you will get a flat line sound and a message will be displayed below the BPM saying "You are dead!"
Have a look at the ECG working!!
Step 5: How to Start Up Your ECG
-First plug in your oscilloscope in a wall outlet with its DC adapter
- Next connect the 9V battery to the connector
- Connect the arduino to your computer with the usb cable and upload the code to it
- Attach you Red and White ECG leads to pins 2 and 3. I used jumper wire to plug into the beard board and attached one end of the alligator clip to the exposed wire
- Attach the black ECG lead in the same fashion but into the ground of the board
- Attach your red lead of the oscilloscope to pin 6 of the instrument amp just like you did with the ecg leads and the black lead to ground
- Place one electrode pad to the left side of the chest, and the other about 4-5 inches to the right of the first pad making sure not to go past the middle of the chest. You may have to play with the placement to find the right spot.
- Adjust your oscilloscope till you can pick up a clear signal. Make sure you are on DC, and I found that setting the scope between 1v with a 1x multiplier or 0.1V with a 5x multiplier works best.
- Give it a minute to register the signal on the scope and you should start seeing your heart waves.The heart rate should be displaying on both the LCD and your servo should be moving accordingly.