I recently went to see my doctor as something was not right with my
heartbeat, of course by the time I got to see the doctor it had returned to
normal so he could only really guess as to what was going on. He
suggested that if it happen again I go to casualty to get an ECG done but of course if it happens again it will in
all probability be back to normal by the time I get there.
This set me wondering if it would be possible to buld myself an ECG and thus
be able to present a printout if it happens again, it also seemed like it
would be a very interesting project!
BTW - My doctor doesn't think it anything life threatening so I am
not risking my safety or anything here but it may help to figure out
exactly what is going on if it happens again.
See a short video HERE
which explains what an ECG is measuring.
After a bit of searching I found THIS page detailing how to build a very basic E.C.G.
and so I quickly set about building it, I already had most of the required
parts.
I was having some sucess with this design but I then spotted on eBay THIS ready made "E.C.G. front end" by
100randomtasks.com and I figured this will be much better than the ultra
basic one I have built and it should have some decent filtering built in,
for £13.50 it has to be worth a try so I ordered myself one.
BTW - This project gave me the excuse I have always wanted and I finally
bought myself an oscilloscope :-) This is already proving to
be a most useful tool to have.
The front end soon arrived and I have also purchased myself some of the
proper stick on electrodes from eBay costing £5 for 60.
At first I was a bit disappointed as I was not getting a signal much
better than I had with my basic home made one but with some experimenting
I soon discovered where best to stick the electrodes on my chest and most
importantly that the circuit's zero volt line needs to be linked to earth
(this makes a massive difference), also if I hold an earth connection in
my hand this can help to remove some of the mains interference from the
signal. I was now reliably getting a most excellent signal :-)
Example of the signal I was getting on my
oscilloscope
I was now getting a pretty good signal via my oscilloscope so my next task
was to get this signal into my PC so I could save and print it. I
experimented with doing this via the sound card but I had little succcess
and so I decided to instead use a trusty Arduino
to capture the data and transfer it to my PC via the USB. This I
eventually got working very well, I captured the raw data on the PC and
then later plotted this data in a spreadsheet. This worked ok but I
wanted something a bit better....
I also built a small circuit to go between the "front end" board and the
arduino as shown on the 100randomtasks.com
web page, this has a simple filter to help reduce mains interference and
also a pot' to adjust the voltage level of the signal. This was not
necessary but improves the signal.
My final task now was to create a program on the PC to display this raw
data in real time, I used Processing
to do this. I had not used Processing before, I found it to be very
easy to use (helped a lot by being used to programming an Arduino which is
very similar), I found a sample charting sketch HERE which gave me a good starting point and I had a
working app surprisingly quickly....
The Arduino's sketch is pretty basic, it just reads an analog input and
sends it to PC via serial port every 10 milliseconds (with a bit of code
added to send beats per min info every time a pulse is detected) - the
Arduino sketch can be seen HERE
and the Processing sketch can be seen HERE.
so, here is how my ECG now displays the data on the PC screen in real time
as it comes in:
Here is the finished ECG unit it's self (In the case you can
see the Arduino top right, small filter board to the left and the ECG
board bottom):
It turned out to be a reasonably simple project and very interesting so I
would recommend giving it a try. Not only was making this project
very rewarding but what I learned along the way about E.C.G., what the
signal I am receiving is and how the heart works etc. was also very
interesting.....