The personal website of Scott W Harden
March 15th, 2019

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 http://swharden.com/med/

Markdown source code last modified on January 18th, 2021
---
title: Sound Card ECG with AD8232
date: 2019-03-15 23:50:34
tags: diyECG, csharp
---

# 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](https://www.analog.com/media/en/technical-documentation/data-sheets/ad8232.pdf), 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](https://www.ebay.com/sch/ad8232+module) sell kits that come with electrode cables and pads for under $20. Sparkfun [sells a breakout board](https://www.sparkfun.com/products/12650) but you have to buy the [cable](https://www.sparkfun.com/products/12970) and [electrodes](https://www.sparkfun.com/products/12969) 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](https://www.swharden.com/wp/2016-08-08-diy-ecg-with-1-op-amp/)) 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.

![](https://www.youtube.com/embed/sP_-f5nsOEo)

**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](https://www.sparkfun.com/datasheets/Components/LD1117V33.pdf) 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!

<div class="text-center img-medium">

[![](CIRCUIT_thumb.jpg)](CIRCUIT.png)

</div>

**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.

<div class="text-center img-border img-medium">

[![](screenshot_thumb.jpg)](screenshot.png)

</div>

**The[ SoundCardECG project](https://github.com/swharden/SoundCardECG) 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](https://github.com/swharden/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.

<div class="text-center img-border">

[![](DSC_0015_lzn-1_thumb.jpg)](DSC_0015_lzn-1.jpg)

</div>

**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.

<div class="text-center img-border">

![](AD8232-ECG-output.gif)

</div>

**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 http://swharden.com/med/
March 15th, 2019

Proceeding with a Bone Marrow Transplant

A few days ago I got the phone call I was hoping for – We are proceeding with a bone marrow transplant! An autologous bone marrow transplant is a procedure which may give me a chance at growing a new and healthy immune system (capable of fighting the cancer) from stem cells previously collected from my blood.

When I first started chemotherapy in August the hope was that it would suppress my lymphoma enough that I could safely proceed with the transplant. While the chemotherapy regimen used (CHOP) was highly effective at suppressing most of my cancer, a patch of highly active lymphoma near my left arm did not respond to the chemotherapy (it actually grew during treatment!) and the bone marrow transplant (initially scheduled for January) was cancelled.

Several weeks of daily radiation treatment was ordered that focused on the active cancer that remained. Radiation treatment turned out to be highly effective at suppressing the lymphoma at that site, but a CT taken near the end of treatment raised the suspicion that the lymphoma was coming back elsewhere in my chest (a situation which would take a bone marrow transplant off the table again). A decision was made to take a few weeks off of treatment then follow-up with a new CT to see if the cancer was still growing. For the last few weeks I didn’t know if I would be proceeding with a bone marrow transplant, starting-up a different chemotherapy regimen (GDP), or pursuing immunotherapy (CAR T). I had the follow-up CT a few days ago and the lymph nodes in my chest have stabilized, so we are proceeding with transplant. I waited to update this web page until I knew with confidence what the next step of my treatment was going to be.

The last few weeks were a nice vacation from cancer treatment. I enjoyed putting a little bit of time back into some of the activities that I had to put down when I began treatment last year (programming, electronics, and YouTube). I even grew back a little hair! I know the transplant process (which starts next Wednesday) will be rough (with much higher doses of chemotherapy than before), but I’m excited to be moving forward with treatment. My scheduled transplant day (when I’ll actually receive the stem cells which will grow my new immune system) is March 27, 2019. I hope I’ll be able to share a positive update sometime around then!

Markdown source code last modified on January 18th, 2021
---
title: Proceeding with a Bone Marrow Transplant
date: 2019-03-15 23:55:00
tags: med
---

# Proceeding with a Bone Marrow Transplant

**A few days ago I got the phone call I was hoping for – We are proceeding with a bone marrow transplant!** An autologous bone marrow transplant is a procedure which may give me a chance at growing a new and healthy immune system (capable of fighting the cancer) from stem cells previously collected from my blood.

**When I first started chemotherapy in August** the hope was that it would suppress my lymphoma enough that I could safely proceed with the transplant. While the chemotherapy regimen used (CHOP) was highly effective at suppressing most of my cancer, a patch of highly active lymphoma near my left arm did not respond to the chemotherapy (it actually grew during treatment!) and the bone marrow transplant (initially scheduled for January) was cancelled.

**Several weeks of daily radiation** treatment was ordered that focused on the active cancer that remained. Radiation treatment turned out to be highly effective at suppressing the lymphoma at that site, but a CT taken near the end of treatment raised the suspicion that the lymphoma was coming back elsewhere in my chest (a situation which would take a bone marrow transplant off the table again). A decision was made to take a few weeks off of treatment then follow-up with a new CT to see if the cancer was still growing. For the last few weeks I didn’t know if I would be proceeding with a bone marrow transplant, starting-up a different chemotherapy regimen (GDP), or pursuing immunotherapy (CAR T). I had the follow-up CT a few days ago and the lymph nodes in my chest have stabilized, so we are proceeding with transplant. I waited to update this web page until I knew with confidence what the next step of my treatment was going to be.

**The last few weeks** were a nice vacation from cancer treatment. I enjoyed putting a little bit of time back into some of the activities that I had to put down when I began treatment last year (programming, electronics, and YouTube). I even grew back a little hair! I know the transplant process (which starts next Wednesday) will be rough (with much higher doses of chemotherapy than before), but I’m excited to be moving forward with treatment. My scheduled transplant day (when I’ll actually receive the stem cells which will grow my new immune system) is March 27, 2019. I hope I’ll be able to share a positive update sometime around then!

<div class="text-center img-border">

[![](DSC_0401_thumb.jpg)](DSC_0401.jpg)
[![](DSC_0480-1_thumb.jpg)](DSC_0480-1.jpg)

</div>
January 2nd, 2019

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.

Markdown source code last modified on January 18th, 2021
---
title: Stem Cell Collection Day
date: 2019-01-02 23:22:00
tags: 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.

<div class="text-center img-border">

[![](bone-marrow-transplant-stem-cell-collection-apheresis_thumb.jpg)](bone-marrow-transplant-stem-cell-collection-apheresis.jpg)

</div>

**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. 

<div class="text-center img-border">

[![](chemotherapy-lymphoma-enhanced-words_thumb.jpg)](chemotherapy-lymphoma-enhanced-words.png)

</div>

**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.

<div class="text-center img-border">

[![](scott-harden-and-kane-barr_thumb.jpg)](scott-harden-and-kane-barr.jpg)

</div>

**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.
September 13th, 2018

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.

Markdown source code last modified on January 18th, 2021
---
title: Scott Has a New Look
date: 2018-09-13 20:55:00
tags: med
---

# 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!

<div class="text-center img-border img-small">

[![](DSC_0006_lzn_thumb.jpg)](DSC_0006_lzn.jpg)
[![](DSC_0115_lzn3_thumb.jpg)](DSC_0115_lzn3.jpg)

</div>

**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.
August 29th, 2018

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.

Markdown source code last modified on January 18th, 2021
---
title: First Round of Chemotherapy
date: 2018-08-29 19:50:00
tags: med
---

# 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.

<div class="text-center img-border img-small">

[![](IMG_3030_thumb.jpg)](IMG_3030.jpg)

</div>

**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.
Pages