Book of Errant Pages

Having a (non-lethal) cardiac event? Then build your own ECG!

Les Wilhelm

I have a well documented arrythmia related to my mitral valve prolapse and mitral regurgitation. Basically these defects in my heart mean it sometimes does not beat normally. On rare occasion, a few times a year, the arrythmia will appear while getting out of bed in the morning. This results in blood rushing out of my head (normal for getting up in the morning) but my heart cannot counteract the effect. On seeing this condition the brain decides to trigger its 'I want O2 and I want it now' response. Nausea begins to steadily grow until it becomes intolerable while being accompanied by profuse sweating.

Two choices are available. You can choose to lie down and the symptoms will subside quickly, or your autonomic nervous system will choose to lie down for you by causing you to pass out (syncope). Having been through this a few times I went with the first option. In my case the triggering arrythmia will not degenerate into a lethal rhythm, so I just need to wait it out. It will take a few hours to pass and a bit longer to feel normal again.

I have my annual cardiologist visit next week, so I thought it would be great to get an ECG waveform of this event. Like most problems this one has a habit of not wanting to show itself when you look for it. In the past I have had a monitor stuck to my chest continuously for a week so the doctors could catch what was happening. I probably should have thought of building this rig before, but now is better than never.

I remembered I bought an OpenBCI Cyton over 7 years prior. I don't remember why that project got scrapped but I still had the hardware. The Cyton is intended for measuring brain activity (hence BCI) but since muscle contractions are easier to detect than neurons firing it should work fine for this application. After some consultation with Claude I had the layout of parts I needed. Getting the parts from around the house was a fun game of taking strategic breaks where I could lie down to keep the nausea at bay.

The final setup is extremely simple. My greatest difficulty was placing pins with shaky hands.

OpenBCI Cyton setup for single lead ECG

Determining how to place and wire the leads was a bigger issue where Claude helped again since I was not in the best condition. As I got the software setup I noticed I was able to stay upright longer than before. I thought maybe having a task was distracting me from the symptoms. In fact the arrythmia was clearing. I did capture some of it as seen below.

OpenBCI UI

Danger Squiggles!

It appears, like many engineering issues, when you attach a debugger the problem goes away. I have found the balance of 'my heart is working like it should and I feel much better' vs 'I didn't get the data I wanted' to be an interesting tension.

Since I did get a little data the next step was analysis. The OpenBCI app is not intended for ECG work so I would need something else. Again, AI to the rescue. About an hour and 13.5M Opus tokens latter I had Pulse Palette, my very own ECG analysis app.

OpenBCI UI

I originally choose to use Fable, but I hit Anthopic's guardrails and was kicked back to Opus. A lot more work needs to be done but I think I have a good base to build from. One more project to add to my stack.