Mobile EKG/ECG Project

NOTE: If you try this at home, PLEASE don't electrocute yourself!

 

I recently began designing a prototype ECG for mobile applications. My design goals for this project were mostly educational: to better familiarize myself with the facets of bluetooth connectivity and Android app development.

Analog Design:

The first prototype circuit is fairly ugly -- an INA212 (instrumentation amplifier from Texas Instruments) and two LM741 op-amps were used to amplify and bandpass filter the cardiac signal. The op-amps used here are a second order salen-key design -- making a bandpass filter with lower and upper cutoff frequencies around 1/4 Hz and 150 Hz, respectively. The INA inputs were extracted from sticky chest electrodes. I found a pack of 100 Vermed SilveRest electrodes for under 20 dollars on Amazon. They have an adhesive Ag/AgCl gel on one side, designed specifically for physiological signal acquisition. For a more detailed explanation of the circuit diagram, see "Meditating on Matlab."

 

 

A cascade of analog filters, along with the sticky silver-silver chloride electrodes used for signal acquisition.

The circuit is by no means optimized, and it takes up more space than it has to. But it works! In the first test run, I powered the op-amps with plus/minus 6 Volts from a DC power supply. After testing the circuit with an oscilloscope and confirming the gain, I swapped out the DC power supply for two coin-cell batteries (CR2032's), forming plus/minus 3 V supply rails.

Signal Acquisition/Processing:

To analyze the results, I wrote a Labview VI  to plot the output of the analog filters in real time. I used an NI compactDAQ chassis, and a single analog input module for sampling. The VI plots the signal in both the time domain and the frequency domain. Here's a screenshot from Labview:

Seeing my heart signal for the first time in a custom Labview VI.

Seeing my heart signal for the first time in a custom Labview VI.

I added a digital filter in Labview (whose results are displayed the spectrum on the top right) to smooth out any 60 Hz noise from the wall power supply, but in this screen shot the noise isn't an issue because I'm using coin-cell batteries for the op-amp supply rails. So, the digital filter isn't contributing much here. Next step: Bluetooth! 

My two cents on software implementations:

In the previous blog, "Meditating on Matlab", I performed similar digital filtering (and more advanced post processing) in Matlab/Simulink. I found that the LabView implementation mentioned above was much easier  to get up and running than the Matlab/Simulink implementation -- because, well, that's what Labview is designed for. Having said that, once I ironed out the software/hardware interface issues in Simulink, I found that the actual algorithm design and coding environment are much more welcoming than Labview's. 

 

Wireless:

Testing my transmission code for the Arduino Uno and JY-MCU with temperature sensor data.

To keep things simple, I used an Arduino Uno and Bluetooth Module (JY-MCU) to handle the analog sampling and Bluetooth transmission. I went ahead and DC shifted the cardiac signal updwards with a voltage divider and wrote a sketch that samples this value through an analog input on the Arduino.  I used the "Amarino Toolkit" written by Mark Weiser to handle the Arduino/Android Bluetooth connectivity. It can be found here:

 

http://www.amarino-toolkit.net/index.php/download.html

 

Software:

I coded the android app in Eclipse IDE.  The app uses the Amarino Library (also found in the link above) in conjunction with the AndroidPlot API to handle the Bluetooth connectivity and real-time plotting, respectively. Information on Androidplot can be found here: http://androidplot.com/ .

 

 

Pretty decent signal quality for under 30 dollars of parts! It's amazing when you stop and think about it -- there's electricity pulsing through our body! And we can measure it pretty easily. It's also amazing to think that the first practical ECG (for which Einthoven won a Nobel Prize) was only invented around 100 years ago. Meaning, for the large majority of our species' existence, this electrical signal was flowing through us entirely unnoticed. Okay, now I'm rambling.

If anyone is interested in the seeing any of the models (labview, simulink, matlab, etc), just shoot me a message. 

Happy researching,

Will