SWHarden.com

The personal website of Scott W Harden

Sound Card ECG with AD8232

Every few years I revisit the idea of building an ECG machine. This time I was very impressed with how easy it is to achieve using the AD8232, a single-lead ECG front-end on a chip. The AD8232 is small (LFCSP package) but breakout boards are easy to obtain online. Many vendors on eBay sell kits that come with electrode cables and pads for under $20. Sparkfun sells a breakout board but you have to buy the cable and electrodes separately. I highly recommend buying bags of electrodes inexpensively on eBay because having plenty will make life much easier as you experiment with this circuit. The signal that comes out of this ECG device (unlike other ECG machines I’ve built) is remarkably clean! It doesn’t require any special spectral filtering (all that is accomplished on the chip), and it can be hooked right up to an oscilloscope or sampled with analog-to-digital converter.

The breakout board is easy to use: Just supply 3.3V, hook-up the chest leads, and a great looking ECG signal appears on the output pin. I prefer using a LD33V to drop arbitrary DC voltages to 3.3V. While using a 9V battery isn’t the most power efficient option, it’s certainly an easy one. Since the AD8232 claims to only draw 170 µA, inefficient use of a linear voltage regulator probably isn’t too much of a concern for desktop experimenters. The low power consumption of this chip raises some interesting possibilities for wireless ECG analysis!

I like inspecting the output of this circuit using my computer sound card. Probing the output pin on an oscilloscope reveals a beautiful ECG signal, but not everybody has an oscilloscope. I’ve seen some project webpages out there which encourage people to use the ADC of a microcontroller (usually an Arduino) to perform continuous measurements of voltage and transmit them over the USART pins, which then get transferred to a PC via a USB-to-serial USART adapter (often built around a FTDI FT-232 breakout board or similar), only to get graphed using Java software. That sequence certainly works, and if you already have an Arduino, know its sketch language, and are happy writing software in Processing, that’s a great solution for you! However I found the sound card option convenient because everyone has one, and with a click-to-run computer program you can visualize your ECG right away. Note that I added a potentiometer to drop the voltage of the ECG output to make it more suitable for my microphone jack. Ideally you’ll find a resistance that uses a lot of your sound card’s dynamic range without clipping.

The SoundCardECG project on GitHub is a click-to-run Windows program I wrote to display and analyze ECG signals coming into the computer sound card. The screenshot above shows my heart rate as I watched a promotional video for a documentary about free-climbing. You can see where my heart-rate elevated for a couple minutes in the middle as I watched a guy free-climb a cliff a thousand feet in the air without safety gear. This software is written in C# and fully open source. It certainly works, but has many avenues for improvement (such as enhanced QRS detection). Interactive graphing is provided by the ScottPlot library.

Most of the project details are in the video, so I won’t type them all out here. However, this is an excellent first step for a variety of projects that could emerge from having an easy way to measure an ECG signal. Immediate ideas are (1) heart rate detection in circuitry (not using a PC), (2) data-logging ECG signals, and (3) adding wireless functionality. I may come back and revisit one or more of these ideas in the future, but if you’re interested and inspired to make something yourself I’d love to see what you come up with! Send me an email with a link to your project page and I can share it here.

I built this AD8232 breakout board into a nice enclosure to make it easier to experiment with it in the future. The circuity isn’t anything special: a linear voltage regulator with capacitive decoupling on the input and output, and an op-amp serving as a unity gain amplifier to buffer the output accessible through a SMA connector, and a current-limited output attached to a female 1/8" audio for easy connection to my computer sound card.

Personal update: My website posts (and YouTube videos) have slowed dramatically as I’ve been dealing with some complicated medical issues. I don’t intend on posting medical updates on this web page, but anyone interested in following my medical treatments can do so at https://swharden.com/med/


Stem Cell Collection Day

I didn’t have an out-of-body experience today, but my blood did! This morning a catheter was placed in my left internal jugular vein with two tubes to allow continuous withdraw and replacement of blood as it circulated through an apheresis machine to filter-out and collect white blood cells (leukapheresis). This procedure harvests hematopoietic stem cells which can be frozen and later used used to repopulate my bone marrow after it is destroyed by strong chemotherapy as part of my autologous bone marrow transplant. Hopefully the cells they collected today will help to create a healthy immune system in the future! The picture below shows me a little over half way through the six-hour collection procedure, with the bag of collected cells hanging on the upper-right.

I finished chemotherapy (for now) and begin daily radiation treatment next week. While the chemotherapy did an excellent job at suppressing most of the lymphoma around my body, a pocket of highly active disease remains under my left arm. Below is a PET CT indicating the extent of the lymphoma before and after CHOP chemotherapy. Note that the heart, submandibular glands, and lingual tonsils are all active at rest so it is normal for them to appear dark in images like this, but dark lymph nodes depict disease.

The current plan is to undergo radiation treatment every day for five weeks. I anticipate the short-term side effects from radiation treatment will be less severe than those I had during the last few months of chemotherapy, so I’m looking forward to the break! If radiation treatment is successful in getting this difficult site under control, and if the rest of the cancer doesn’t come back between now and then, I’ll proceed with a bone marrow transplant some time around March. At that time they’ll start me on a much higher dose of chemotherapy to kill as much of my bone marrow as they can, then repopulate my immune system with the stem cells they collected today. If all goes well, the immune system that grows from those stem cells will be healthier than the one I have today.

My hair will start growing again now that I’ve stopped chemotherapy. It’s surprising how used to it I got over the last few months! Although the chemo they will give me during my bone marrow transplant will cause my hair to fall out again, I probably won’t be that squeaky-scalped again for a couple months.


Scott Has a New Look

I decided a while back that I’d shave my hair off as soon as I first noticed it falling out, and that day has come! Almost every day before I go to sleep I give it a little tug and think, “still in there!”, but this morning I noticed it falling out in the shower. By lunch I was getting annoyed as hair kept landing on my keyboard at work. My coworker Jeff offered to shave it off at his place after work, and I couldn’t get it off fast enough!

My hair will start growing back a few months after chemotherapy ends, but I don’t think I’ll mind it being gone too much in the mean time. I’ve had several years to consider that “one day” I’ll be walking around without hair for a little while, so the fact that the day has finally come isn’t much of a surprise. For now I’m happy enough to save money at the barber and have a simpler morning routine.

The treatment plan for the next few few months is to get additional rounds of chemotherapy every three weeks. This website will probably be dormant for the next few months while I undergo these infusions, and I will start updating it again when I know more about the bone marrow transplant I will probably be having.


First Round of Chemotherapy

I started my first round of chemotherapy today! I expect to feel pretty lousy for the first few days after each infusion (the next one being 3 weeks from now), but I’m very happy that treatment has begun.

The chemotherapy regimen I am undergoing is called CHOP, an acronym for the combination of drugs used: The C (cyclophosphamide) is an alkylating antineoplastic agent which damages DNA by promoting the formation of interstrand and intrastrand crosslinkages leading to cell death. The H (hydroxydaunorubicin, or doxorubicin) is another DNA damaging drug which inserts itself between DNA bases and prevents the progression of topoisomerase II (which relaxes super-coils of DNA so it can be read or replicated), leading to cell death. The O (Oncovin, or Vincristine) binds to tubulin (the primary molecule comprising the cytoskeleton). During metaphase (when all the chromosomes are lined up and about to separate) the separation of chromosomes into two daughter cells is prevented, and an apoptotic pathway is activated killing the cell. Finally, P (prednisone) is a glucocorticoid immunosuppressive and anti-inflammatory drug commonly used alongside antineoplastic agents to reduce the likelihood of allergic reactions and to alleviate some of their side effects. Although these drugs seem like blunt instruments (broad spectrum DNA and cytoskeleton-damaging chemicals), rapidly growing cells (such as the tumors being targeted by this chemotherapy) are preferentially targeted for damage, resulting in the efficacy of this treatment. Other fast-growing cell types are damaged as the result of these drugs, one of which live within hair follicles. As such I expect to begin losing my hair at some point over the next couple of weeks.


Port Placed Today

I got my port placed today! A port is a medical appliance surgically implanted beneath the skin which is attached to a a tube which goes into a large blood vessel (a central venous catheter, CVC). Instead of poking my arms to draw blood, deliver chemotherapy medication, or inject IV contrast dye during medical imaging, my port can be accessed instead.

Update (2018-12-13): A chest X-ray taken today displays my port quite nicely! The white objects under my opposite arm are staple-like sutures used during my last surgical biopsy.

Update (2018-12-14): A CT taken today shows my port nicely too! This CT series was re-sliced, maximum projected, then windowed to maximize bone visibility and hide soft tissue. The port is visible on the left side of the image, but the contrast dye used during the CT is also visible coming through an IV line. If you look closely you can see where the IV line turns into a needle, enters my arm, fills the veins, and clears once it enters my heart.