Quantified Living: Fight or Flight

Can biometric data help shed light on panic and anxiety?

Favorited Favorite 2

I adjust my seating position and lean forward against the steering wheel trying to catch my breath. My face is cold and drenched in sweat, my fingertips are tingling. Just a few miles before I'm safe at home, at least I'm moving. The signal light ahead turns red and as I roll to a stop I reach for my phone, dial 91 and then cancel... wait for the light to turn green. About this time I notice that my mouth tastes like radio static and I'm starting to become nauseous, I roll down the window to get some air. It's been this way every day for 3 weeks...

The return of my panic symptoms was sudden and unexpected. Arriving on the shoulders of seasonal depression and further exacerbated by social stress, it handily rendered my medication ineffective. Agoraphobia set in quickly as my avoidance behaviors swiftly pared down the list of places, times and situations in which I could feel comfortable. With considerable effort, encouragement from friends and understanding from my employer, I've been able to slowly reclaim territory and rejoin parts of the social world. Essential functions such as grocery shopping and buying gas were uncomfortable but eventually became routine again. Spending time at the office is possible and becoming a less intense experience as I replace my memory of anxious, stressful experiences with productive, fun and engaging experiences. I still spend a lot of solitary time at home, but this gave me time to get fed up and start brainstorming how I might avoid these pitfalls in the future.

Vital Data

Panic attacks are often aggravated by hypervigilance. This sort of narrow-band hypochondria can make it difficult to properly gauge one's physical wellbeing and lead to irrational concerns about one's immediate health, further fueling the sensations of panic. The first thing that I needed to do was assure myself that my body was in good condition. After seeing my doctor and having a few simple blood tests and an ECG, I felt reassured that there wasn't anything seriously wrong with me but this rational perspective could be hard to maintain with a head full of adrenaline. I decided that I would need some diagnostic equipment so I could objectively measure key aspects of my physical health. Eventually, it would occur to me that I need to design and build a body-worn device for collecting biometric data but before I hooked myself to a bunch of homebrew diagnostic gizmos, I wanted to play with the commercially available options:

Heads Up!
You should not attempt to diagnose or treat any disease without consulting your doctor. I don't endorse any of the products below; if you have legitimate need for any of the devices I'm about to describe, please please spend more money than I did and buy quality diagnostic tools.

Blood Pressure

Because it's regulated by the nervous and endocrine systems, blood pressure can be an immediate indicator of acute stress. It's also the metric that most people relate to stress. Beyond being an indicator of stress, abnormalities in blood pressure due to a disease state could cause symptoms similar to panic disorder. Not long ago, the only way to get a snapshot of arterial pressure was the auscultatory method and it remains the gold standard for non-invasive blood pressure monitoring. This is the method your doctor uses during a routine examination. Ever wonder how that works? It's actually pretty straight-forward:

You inflate the cuff (or sphygmomanometer if you're not into that whole brevity thing) while listening to the brachial artery with a stethoscope. As the cuff pressure increases, you'll start to hear wooshing sounds in the artery, called Korotkoff sounds. Once the cuff is inflated to beyond the arterial pressure, the sounds will stop because blood flow has been completely occluded. The upper transition pressure from silence to Korotkoff sound is your arterial pressure during ventrical contraction (aka systolic pressure). This is because you're hearing intermittent arterial flow as the systolic portion of the cardiac cycle overcomes the cuff pressure. The lower transition pressure where the Korotkoff sounds go away is your arterial pressure in between ventrical contractions (diastolic pressure). This is because you've reached a cuff pressure where arterial flow is no longer occluded and it becomes quiet again.

Of course I don't want to whip out a sphygmomanometer and a stethoscope every time I want a blood pressure reading, so I went to the internet to see what I could find. And for $20 I found this:

blood pressure cuff

Wrist worn blood pressure monitors don't measure blood pressure the same way that your doctor does. Instead of listening for blood flow to determine the relationship between the cuff pressure and arterial pressure, the electronic sphygmomanometer uses pressure transducers to record oscillations in cuff pressure. These pressure oscillations are similar to Korotkoff sounds in that they can only occur when the cuff pressure is high enough to partially occlude the artery but low enough to still allow intermittent flow. Because it relies on measuring oscillations in cuff pressure, this is known as the oscillometric method. Microcontrollers are also capable of counting the period of these oscillations in order to calculate pulse rate. Finally, because the controller isn't having to listen to blood flow, readings can be taken from the quieter but more conveniently located radial artery above the wrist.

When you take these devices apart, you're likely to run into something like this:

pressure sensor

This is the MPS20N0040D-D pressure sensor. If we look at the datasheet, we can see that this sensor operates up to 40kPa (about 300mmHg), which is a good range for sphygmomanometry as healthy adults should have a systolic pressure no higher than 120mmHg. Referring again to the datasheet, we see that the device outputs a voltage relative to the measured pressure which should make it easy to interface with. It even has a little nipple on the package for attaching a piece of 3mm hose.

Oxygen Saturation

Blood oxygen saturation refers to the ratio of saturated vs. unsaturated hemoglobin in the blood. This saturation level isn't particularly indicative of stress or panic because it stays relatively constant in healthy people, even during hyperventilation (when oxygen saturation remains healthy but CO2 levels drop). Still, it can be helpful to have reassurance that oxygen flow to my bloodstream isn't being impeded.

The non-invasive method for measuring oxygen saturation is Pulse Oximetry. This process works on the principle that blood's transmission and absorption spectrum changes depending on whether the hemoglobin is loaded with oxygen. LEDs, light sensors and a microcontroller... that shouldn't cost too much, right? Well... it doesn't! I bought this guy for $18:

pulse oximeter

As far as hardware goes, there isn't a lot here to talk about. This clip is applied to the tip of the finger where it shines red and infrared light through the finger and into a light intensity sensor. Analyzing the light intensity on the other side of the finger not only allows you to calculate O2 saturation, but also pulse rate (via photoplethysmography).

There are a few really nice DIY Pulse Oximeter projects out there. I'm fond of this Arduino-based project by Mike at Tinkerish.

Blood Glucose

Blood glucose, the measure of sugar present in the blood, may not be a good indicator of panic but it may vary after a panic attack due to the amount of energy burned up during an adrenaline rush. Most importantly, both hypoglycemia (low blood sugar) and hyperglycemia (high blood sugar) could account for a number of the symptoms attributed to panic and anxiety. It was important to rule those out.

Unfortunately for diabetics, non-invasive methods for monitoring blood glucose levels are still under development and not yet accessible commercially. Blood glucose monitoring still requires a blood sacrifice. Luckily, the amount of blood required is very small and can be attained via lancing. Shopping around on the web, I was able to dig up this diabetic testing kit for $30! Once again I feel the need to urge that if you're going to be relying on this equipment, for instance in order to know when to administer insulin, please do not buy the cheap kit. The reviews on this product indicate that it may have a tendency to read low. Although I will add that mine seems to test appropriately against a control solution of glucose.

blood glucose kit

The magic behind electronic blood glucose monitors is actually in the test strips. Test strips are essentially tiny electrochemical cells which use blood (or the glucose in the blood) as a fuel. A small capillary in the test strip exposes a blood sample to enzyme electrodes which react to glucose in the blood. This oxidation reaction creates a small electric current. By measuring this current, a blood glucose meter can determine the amount of sugar present in the blood sample. The cool thing about this method is that with some smarts in electrochemistry, test strips for other blood chemicals could be developed and read using meters identical to blood glucose meters.

It wouldn't be hard, in theory, to amplify the electrical current in the test strip using an instrumentation amplifier built from op-amps and then measure that using the ADC on an Arduino. I may write a tutorial on glucometer hacking, depending on how easy that turns out to be.

Collecting Data

Over the course of a few days, I measured these metrics at fairly regular intervals along with subjective notes about my wellbeing. I made myself a Google Docs form and saved it to the home screen on my Android phone so I could easily enter the data into a spreadsheet. Here is a sample of the data I collected:

Obviously, there's nothing revolutionary about the story that this data tells. Blood glucose fluctuates normally, blood pressure correlates to pulse rate and oxygen saturation varies but stays in the healthy region. But the process of collecting and analyzing this data gave me an idea, and it's an idea that's going to require a lot more data collected a lot faster...

Moar Data

As it turned out, simple heart rate was one of the most useful metrics that I monitored during this process and it was helpful to look back on the notes and identify spikes in heart rate and what might have triggered them. In fact, this evaluation of behavior is a key step in something called Cognitive Behavioral Therapy, a type of therapy used to treat mental disorders such as depression and anxiety. This got me thinking: How much could practices like Cognitive Behavioral Therapy benefit from continuous, non-invasive monitoring? If a patient were able to wear a monitoring device which logged a few key biometrics and then review that data with a therapist, it could be beneficial to identifying avoidance behaviors and quantifying progress.

With even larger amounts of data, you could potentially train Artificial Neural Networks to analyze and tag data, identifying panic attacks and correlating them to other factors. With sufficiently granular data, one might even be able to detect the onset of panic attacks in realtime! These types of analysis require heaps of good data, however, so it would be important for the device to constantly monitor and record. Biometrics like heart-rate, HRV, GSR and even EEG patterns are all good candidates for non-invasive realtime monitoring, and could potentially tell an informative story about panic and anxiety.

I'll write soon about my experience playing with some of our biometric sensors and products, such as the Bitalino and the MindWave, and hopefully share some insight from the process of designing and building my own diagnostic wearables!

Until then, thanks for reading. If you have any thoughts on Quantified Living, any tips about biometric datalogging or just want to share your experience with anxiety, feel free to yell at me in the comments section!


Comments 18 comments

  • Once again, there are two kinds of people: those who know about these topics and those who don't. For those people who don't know about it, this topic may come as a surprise. I was in the 'don't know' crowd up to a few months ago. The first place I read about this topic was Wil Wheaton's blog. He has had depression and panic attacks for several years and he has written detailed accounts about living with it.

    As he says often - 'depression lies'. And as usual, knowing what's up is half the battle in over coming it. Thanks for sharing your demons with us. The more they are brought out into the broad light of day, the easier it becomes to chase them away.

  • Oh, also kudos on being willing to talk about this very personal issue.

  • I've suffered from anxiety disorders since I was 14, but for me they've morphed in and out of clarified disorders over that time, and I developed Panic Disorder sometime during mid 2013. I've gone through my own littany of health-monitoring hardware but never recorded the findings nearly as complete as you've shown above. Thanks for the awesome article and ideas, as well as shedding light on a seriously under-discussed and misunderstood health topic. The more exposure and understanding anxiety disorders get, the better it gets for both the people who suffer for them and the people who interact with those who suffer.

    P.S. To Nick and anyone suffering anxiety, in addition to CBT, you really should check out daily mindfulness meditation. I've played the on-off SSRI game for the better part of two decades now, and while they have been instrumental in helping me achieve and maintain some normalcy in my life, nothing has been as effective, encompassing, or devoid of side effects as daily 10 to 20 minutes of mindfulness meditation. I highly recommend giving it a shot. Worst case scenario is you've wasted a bit of time, just be aware that mindfulness is something that requires time to build up and make changes, it's not an "incidental" fix (although it can be used in a CBT-like manner for acute panic).

  • A little off topic of this article, but does anyone know how the interactive graph was made? or keywords to look up to find out how to do this? I am currently building a solar charging station at my university and I am looking to post data to the internet to simplify the information I gather!

    • This graph was actually generated out of Google Sheets. I will say that I'm not a huge fan of the way that the graphs are displayed, they seem pretty taxing on Flash. That said, they are handy and can be embedded with simple code. I was posting the data to a Google Sheet using an online form but it may be possible to post directly from a connected device.

      Hope that helps!

  • If your anxiety symptoms are as severe as you describe, I think you have a moral obligation to stop driving! While I certainly sympathize with your plight, I surely would not want myself or any of my loved ones to be in the vicinity of your vehicle while you are suffering from an anxiety attack! I wish you the best of luck, but by driving you are making a lot of unwitting (and probably, unwilling) people a party to your illness.

    • I appreciate and share your concern. That would be the bit where I stopped leaving the house for a few weeks.

  • This was a great read and I'm looking forward to more. I actually just got a Donorschoose project funded for the Make!Sense sensors and boards (as well as a BP sensor and Oximeter) so my high school students can use Scratch to explore their health through electronics (http://bit.ly/1Nszx7F). I'd really love to see more articles and maybe even videos on how you design and use electronics to monitor your health. Best of luck with your anxiety - a psychologist and running are what worked for me.

  • CBT can be quite effective against some types of depression. But it requires self-awareness to recognize the onset of a depression episode. The sooner the onset of an episode is detected the more effective the CBT becomes, so if you can create a device that detects the onset of depression quickly it could certainly help people.

    Anxiety disorder is tough to fight and I feel for you. Avoid retriggering, stress, caffeine, artificial sweeteners, hope for the best, and never give up.

    • Thanks,

      Creating a device or at least a method for predicting panic episodes is kind of a pie-in-the-sky dream. But if I'm going to be collecting a bunch of related data anyway I might as well try. It's not like I have much to lose by formatting and feeding a bunch of numbers to an ANN.

      Ugh, caffeine. You know I drink de-caf coffee now? What have I become? ;)

  • My first comment: If you are actually having panic attacks, one word: Psychiatrist. These folks are MDs, and often know what to look for in the way of causes and/or triggers, and thy have several things in their "bag of tricks" to help you prevent, or at least deal with, the problems.

    Second comment: Although it is VERY doubtful an indicator in your case, there is another blood metric that has to be measured if you're on certain meds (notably Coumadin [warfarin], which at one time was used as rat poison). That's commonly referred to as "protime" or "prothrombin time" (aka INR) which measures how fast the blood clots. There are little gadgets available similar to the blood glucose tester to measure INR, but they cost $1200 for the little machine, and the strips run about $8 EACH (and they're only good for one test!). Worse, they have a "shelf life" of only a few months. (I usually have to go in once a month for the test. It can also be done with hypodermic blood draw, but fortunately there's a "clinic" locally that uses the "one drop" machine. If the strips were a buck a piece I might spring for the machine and check myself a few times a week. BTW, the little machine takes maybe 90 seconds to get a result -- the blood draw method can take several hours or more, so virtually every ER has the machine, but we all know how much they charge!) A large part of the reason that glucose monitoring machines/strips are so cheap is that there are, unfortunately, a LOT of people who need them and need to use them multiple times a day, so there's a lot of competition between manufacturers/suppliers.

    • Hmm... this got me to read the Wikipedia entry on prothrombin time. It mumbles something about Medicare paying for the INR machine for folks with a mechanical heart valve (which I have). I'm not on Medicare, but will investigate seeing if my insurance will cover it. So, Nick, your post may have some unexpected benefits! Thanks!

    • If you are actually having panic attacks, one word: Psychiatrist.

      This is an issue that I've been working with my doctors with for the better part of a decade now. Rest assured, I'm not shy about professional help.

      As for your second comment, that's interesting I'll have to do some poking around a learn more about protime. Do they not still use Warfarin as a rat poison? My grandfather was on Coumadin for a while, classic old-school blood-thinner. Pretty rough.

  • Thank you for sharing. I share some of your experiences, but don't think I could share as you did (it takes courage!).

    I hope your project goes well, because it sounds like a good one (real life pip-boy perhaps).

  • Sorry to hear that you are prone to panic attacks (and SAD). Thankfully, I haven't experienced a panic attack, but I have some friends who also have panic attacks. I know I can't do anything for them during the attack, but I always try to be there for them when the come out the other side.

    Kudos on making lemonade here.

    Have you found any cloud data systems (like data.sparkfun) but would conform to HIPAA privacy standards? Would a phant installation on a personal home server be sufficient?

    • Really it depends on your usage. HIPAA is really only for health care professionals and what they can release. Unless you were wanting to start a business specifically to post health data I doubt it would be an issue. You can post your own data anywhere, and since data.sparkfun.com is basically anonymous it does afford privacy based on that. For your own data it is really a matter of what level of privacy you want. Disclaimer (I'm not a lawyer, but I have worked jobs where understanding and following HIPAA regulations was required).

Related Posts

Recent Posts

Antenna Connectors

Tags


All Tags