Site icon R-bloggers

ECG Project

[This article was first published on BioStatMatt » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In an earlier post, I described some ECG signal processing. In fact, these recordings were from my own heart, and I had collected them using a homemade ECG. The following is a repost from my old site describing the device.

I assembled an instrumentation amplifier to measure cardiac potentials (i.e. an electrocardiograph (ECG)). The analog-to-digital converter of an ATmega168 microcontroller was used to convert the amplified potentials and transmit the values to a computer via a serial connection. The microcontroller can transmit up to 2.5k values per second, which is sufficient for cardiac potentials. The analog amplifier was a bit tricky to set up. I ended up purchasing the INA128 instrumentation amplifier after some unsuccessful trials with individual op-amps. The final amplifier circuit is given in the following diagram.

The diagram has the following components:

The gain in this amplifier is set by the R_GAIN (47 Ohm) resistor, given by G = 1 + 50000 / R_GAIN. Hence, the gain of this circuit is about 1065V/V. Since cardiac potentials on the skin surface are in the region of 1mV-3mV, this gain should be sufficient. The inputs to the INA128 must be biased to within a small voltage (+-0.5V) of VCC/2, termed the common mode voltage (VCM). AC-coupling capacitors (C1 and C2) prevent the need to apply VCM to the limb electrodes, which could result in shock if the body is grounded to earth. The limb electrodes are instead biased to GND.

The RA and LA leads in this amplifier might also be connected to a piezoelectric transducer (electric buzzer) to record audio/vibrations. However, the frequency of recorded audio is limited by the A/D conversion and the serial transmission rates. That is, audio frequencies higher than about 1200Hz (See the Sampling Theorem) cannot be recorded with accuracy. It might be possible to connect VOUT directly to the ‘line in’ jack on an audio recording device, such as a computer sound card.

Disclaimer: I do NOT recommend the circuit above for ANY specific use, or guarantee its safety. Think carefully before attaching homemade electronics to your body.

To leave a comment for the author, please follow the link and comment on their blog: BioStatMatt » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.