SparkFun Support and Front Desk will be closed on Thursday 11/14 from 1-2:30pm for a company event. Please plan to pick up your orders before or after this timeframe.
Can biometric data help shed light on panic and anxiety?
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.
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:
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:
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:
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.
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:
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, 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.
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.
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...
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!